1
0
Fork 1
mirror of https://github.com/zen-browser/desktop.git synced 2025-07-08 12:59:58 +02:00
zen-desktop/src/browser/base/content/browser-js.patch

73 lines
2.8 KiB
C++

diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js
index 9a65dcc7ad41ab961907c95338e023b173d4f474..9477e0c115ed3c4a670f1ac63846b6de01bf8b8c 100644
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -32,6 +32,7 @@ ChromeUtils.defineESModuleGetters(this, {
ContextualIdentityService:
"resource://gre/modules/ContextualIdentityService.sys.mjs",
CustomizableUI: "resource:///modules/CustomizableUI.sys.mjs",
+ ZenCustomizableUI: "chrome://browser/content/ZenCustomizableUI.sys.mjs",
DevToolsSocketStatus:
"resource://devtools/shared/security/DevToolsSocketStatus.sys.mjs",
DownloadUtils: "resource://gre/modules/DownloadUtils.sys.mjs",
@@ -630,6 +631,15 @@ XPCOMUtils.defineLazyPreferenceGetter(
false
);
+const ZEN_WELCOME_PATH = "zen-welcome";
+const ZEN_WELCOME_ELEMENT_ATTR = "zen-dialog-welcome-element";
+XPCOMUtils.defineLazyServiceGetter(
+ this,
+ "ProfileService",
+ "@mozilla.org/toolkit/profile-service;1",
+ "nsIToolkitProfileService"
+);
+
customElements.setElementCreationCallback("screenshots-buttons", () => {
Services.scriptloader.loadSubScript(
"chrome://browser/content/screenshots/screenshots-buttons.js",
@@ -3440,6 +3450,11 @@ var XULBrowserWindow = {
AboutReaderParent.updateReaderButton(gBrowser.selectedBrowser);
TranslationsParent.onLocationChange(gBrowser.selectedBrowser);
+ gZenViewSplitter.onLocationChange(gBrowser.selectedBrowser);
+ ZenWorkspaces.onLocationChange(gBrowser.selectedBrowser);
+ gZenTabUnloader.onLocationChange(gBrowser.selectedBrowser);
+ gZenGlanceManager.onLocationChange(gBrowser.selectedBrowser);
+
PictureInPicture.updateUrlbarToggle(gBrowser.selectedBrowser);
if (!gMultiProcessBrowser) {
@@ -4435,7 +4450,7 @@ nsBrowserAccess.prototype = {
// Passing a null-URI to only create the content window,
// and pass true for aSkipLoad to prevent loading of
// about:blank
- return this.getContentWindowOrOpenURIInFrame(
+ let res = this.getContentWindowOrOpenURIInFrame(
null,
aParams,
aWhere,
@@ -4443,6 +4458,10 @@ nsBrowserAccess.prototype = {
aName,
true
);
+ if (typeof window.gZenGlanceManager !== "undefined" && window.toolbar.visible) {
+ window.gZenGlanceManager.onTabOpen(res, aURI);
+ }
+ return res;
},
openURIInFrame: function browser_openURIInFrame(
@@ -7281,6 +7300,12 @@ var gDialogBox = {
parentElement.showModal();
this._didOpenHTMLDialog = true;
+ if (uri.includes(ZEN_WELCOME_PATH)) {
+ parentElement.setAttribute(ZEN_WELCOME_ELEMENT_ATTR, true);
+ } else if (parentElement.hasAttribute(ZEN_WELCOME_ELEMENT_ATTR)) {
+ parentElement.removeAttribute(ZEN_WELCOME_ELEMENT_ATTR);
+ }
+
// Disable menus and shortcuts.
this._updateMenuAndCommandState(false /* to disable */);