diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
commit | 40a355a42d4a9444dc753c04c6608dade2f06a23 (patch) | |
tree | 871fc667d2de662f171103ce5ec067014ef85e61 /browser/base/content/browser.js | |
parent | Adding upstream version 124.0.1. (diff) | |
download | firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.tar.xz firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.zip |
Adding upstream version 125.0.1.upstream/125.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'browser/base/content/browser.js')
-rw-r--r-- | browser/base/content/browser.js | 155 |
1 files changed, 82 insertions, 73 deletions
diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index 4f145c4949..c91a5d4db2 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -29,7 +29,6 @@ ChromeUtils.defineESModuleGetters(this, { ContextualIdentityService: "resource://gre/modules/ContextualIdentityService.sys.mjs", CustomizableUI: "resource:///modules/CustomizableUI.sys.mjs", - Deprecated: "resource://gre/modules/Deprecated.sys.mjs", DevToolsSocketStatus: "resource://devtools/shared/security/DevToolsSocketStatus.sys.mjs", DownloadUtils: "resource://gre/modules/DownloadUtils.sys.mjs", @@ -185,8 +184,13 @@ XPCOMUtils.defineLazyScriptGetter( ); XPCOMUtils.defineLazyScriptGetter( this, - "TranslationsPanel", - "chrome://browser/content/translations/translationsPanel.js" + "SelectTranslationsPanel", + "chrome://browser/content/translations/selectTranslationsPanel.js" +); +XPCOMUtils.defineLazyScriptGetter( + this, + "FullPageTranslationsPanel", + "chrome://browser/content/translations/fullPageTranslationsPanel.js" ); XPCOMUtils.defineLazyScriptGetter( this, @@ -272,6 +276,11 @@ XPCOMUtils.defineLazyScriptGetter( "gPageStyleMenu", "chrome://browser/content/browser-pagestyle.js" ); +XPCOMUtils.defineLazyScriptGetter( + this, + "gProfiles", + "chrome://browser/content/browser-profiles.js" +); // lazy service getters @@ -524,13 +533,6 @@ XPCOMUtils.defineLazyPreferenceGetter( XPCOMUtils.defineLazyPreferenceGetter( this, - "gBookmarksToolbarShowInPrivate", - "browser.toolbars.bookmarks.showInPrivateBrowsing", - false -); - -XPCOMUtils.defineLazyPreferenceGetter( - this, "gFxaToolbarEnabled", "identity.fxaccounts.toolbar.enabled", false, @@ -720,6 +722,7 @@ var gInitialPages = [ "about:welcome", "about:welcomeback", "chrome://browser/content/blanktab.html", + "about:profilemanager", ]; function isInitialPage(url) { @@ -740,22 +743,13 @@ function browserWindows() { } function updateBookmarkToolbarVisibility() { - // Bug 1846583 - hide bookmarks toolbar in PBM - if ( - gUseFeltPrivacyUI && - !gBookmarksToolbarShowInPrivate && - PrivateBrowsingUtils.isWindowPrivate(window) - ) { - setToolbarVisibility(BookmarkingUI.toolbar, false, false, false); - } else { - BookmarkingUI.updateEmptyToolbarMessage(); - setToolbarVisibility( - BookmarkingUI.toolbar, - gBookmarksToolbarVisibility, - false, - false - ); - } + BookmarkingUI.updateEmptyToolbarMessage(); + setToolbarVisibility( + BookmarkingUI.toolbar, + gBookmarksToolbarVisibility, + false, + false + ); } // This is a stringbundle-like interface to gBrowserBundle, formerly a getter for @@ -1686,13 +1680,13 @@ var gBrowserInit = { gBrowser.addEventListener("DOMUpdateBlockedPopups", gPopupBlockerObserver); gBrowser.addEventListener( "TranslationsParent:LanguageState", - TranslationsPanel + FullPageTranslationsPanel ); gBrowser.addEventListener( "TranslationsParent:OfferTranslation", - TranslationsPanel + FullPageTranslationsPanel ); - gBrowser.addTabsProgressListener(TranslationsPanel); + gBrowser.addTabsProgressListener(FullPageTranslationsPanel); window.addEventListener("AppCommand", HandleAppCommandEvent, true); @@ -1705,12 +1699,10 @@ var gBrowserInit = { if (!gMultiProcessBrowser) { // There is a Content:Click message manually sent from content. - Services.els.addSystemEventListener( - gBrowser.tabpanels, - "click", - contentAreaClick, - true - ); + gBrowser.tabpanels.addEventListener("click", contentAreaClick, { + capture: true, + mozSystemGroup: true, + }); } // hook up UI through progress listener @@ -2424,6 +2416,10 @@ var gBrowserInit = { "browser-idle-startup-tasks-finished" ); }); + + scheduleIdleTask(() => { + gProfiles.init(); + }); }, // Returns the URI(s) to load at startup if it is immediately known, or a @@ -3035,7 +3031,7 @@ function BrowserOpenFileWindow() { }; fp.init( - window, + window.browsingContext, gNavigatorBundle.getString("openFile"), nsIFilePicker.modeOpen ); @@ -3243,15 +3239,6 @@ function BrowserPageInfo( browsingContext, browser ) { - if (HTMLDocument.isInstance(documentURL)) { - Deprecated.warning( - "Please pass the location URL instead of the document " + - "to BrowserPageInfo() as the first argument.", - "https://bugzilla.mozilla.org/show_bug.cgi?id=1238180" - ); - documentURL = documentURL.location; - } - let args = { initialTab, imageElement, browsingContext, browser }; documentURL = documentURL || window.gBrowser.selectedBrowser.currentURI.spec; @@ -4549,7 +4536,23 @@ function toOpenWindowByType(inType, uri, features) { * @return a reference to the new window. */ function OpenBrowserWindow(options = {}) { - return BrowserWindowTracker.openWindow({ openerWindow: window, ...options }); + let telemetryObj = {}; + TelemetryStopwatch.start("FX_NEW_WINDOW_MS", telemetryObj); + + let win = BrowserWindowTracker.openWindow({ + openerWindow: window, + ...options, + }); + + win.addEventListener( + "MozAfterPaint", + () => { + TelemetryStopwatch.finish("FX_NEW_WINDOW_MS", telemetryObj); + }, + { once: true } + ); + + return win; } /** @@ -6456,6 +6459,37 @@ function onViewToolbarsPopupShowing(aEvent, aInsertPoint) { return; } + // triggerNode can be a nested child element of a toolbaritem. + let toolbarItem = popup.triggerNode; + while (toolbarItem) { + let localName = toolbarItem.localName; + if (localName == "toolbar") { + toolbarItem = null; + break; + } + if (localName == "toolbarpaletteitem") { + toolbarItem = toolbarItem.firstElementChild; + break; + } + if (localName == "menupopup") { + aEvent.preventDefault(); + aEvent.stopPropagation(); + return; + } + let parent = toolbarItem.parentElement; + if (parent) { + if ( + parent.classList.contains("customization-target") || + parent.getAttribute("overflowfortoolbar") || // Needs to work in the overflow list as well. + parent.localName == "toolbarpaletteitem" || + parent.localName == "toolbar" + ) { + break; + } + } + toolbarItem = parent; + } + // Empty the menu for (var i = popup.children.length - 1; i >= 0; --i) { var deadItem = popup.children[i]; @@ -6509,30 +6543,7 @@ function onViewToolbarsPopupShowing(aEvent, aInsertPoint) { return; } - // triggerNode can be a nested child element of a toolbaritem. - let toolbarItem = popup.triggerNode; - - if (toolbarItem && toolbarItem.localName == "toolbarpaletteitem") { - toolbarItem = toolbarItem.firstElementChild; - } else if (toolbarItem && toolbarItem.localName != "toolbar") { - while (toolbarItem && toolbarItem.parentElement) { - let parent = toolbarItem.parentElement; - if ( - (parent.classList && - parent.classList.contains("customization-target")) || - parent.getAttribute("overflowfortoolbar") || // Needs to work in the overflow list as well. - parent.localName == "toolbarpaletteitem" || - parent.localName == "toolbar" - ) { - break; - } - toolbarItem = parent; - } - } else { - toolbarItem = null; - } - - let showTabStripItems = toolbarItem && toolbarItem.id == "tabbrowser-tabs"; + let showTabStripItems = toolbarItem?.id == "tabbrowser-tabs"; for (let node of popup.querySelectorAll( 'menuitem[contexttype="toolbaritem"]' )) { @@ -6588,9 +6599,7 @@ function onViewToolbarsPopupShowing(aEvent, aInsertPoint) { } let movable = - toolbarItem && - toolbarItem.id && - CustomizableUI.isWidgetRemovable(toolbarItem); + toolbarItem?.id && CustomizableUI.isWidgetRemovable(toolbarItem); if (movable) { if (CustomizableUI.isSpecialWidget(toolbarItem.id)) { moveToPanel.setAttribute("disabled", true); |