diff options
Diffstat (limited to 'application/basilisk/base/content')
-rw-r--r-- | application/basilisk/base/content/browser-context.inc | 16 | ||||
-rw-r--r-- | application/basilisk/base/content/browser-menubar.inc | 9 | ||||
-rw-r--r-- | application/basilisk/base/content/browser.js | 125 | ||||
-rw-r--r-- | application/basilisk/base/content/browser.xul | 8 | ||||
-rw-r--r-- | application/basilisk/base/content/content.js | 6 | ||||
-rw-r--r-- | application/basilisk/base/content/nsContextMenu.js | 34 | ||||
-rw-r--r-- | application/basilisk/base/content/tab-content.js | 27 | ||||
-rw-r--r-- | application/basilisk/base/content/tabbrowser.xml | 187 | ||||
-rw-r--r-- | application/basilisk/base/content/utilityOverlay.js | 81 |
9 files changed, 24 insertions, 469 deletions
diff --git a/application/basilisk/base/content/browser-context.inc b/application/basilisk/base/content/browser-context.inc index 36e0478af..2f6b19da0 100644 --- a/application/basilisk/base/content/browser-context.inc +++ b/application/basilisk/base/content/browser-context.inc @@ -51,23 +51,11 @@ label="&openLinkCmdInCurrent.label;" accesskey="&openLinkCmdInCurrent.accesskey;" oncommand="gContextMenu.openLinkInCurrent();"/> -# label and data-usercontextid are dynamically set. - <menuitem id="context-openlinkincontainertab" - accesskey="&openLinkCmdInTab.accesskey;" - oncommand="gContextMenu.openLinkInTab(event);"/> +# label is dynamically set. <menuitem id="context-openlinkintab" label="&openLinkCmdInTab.label;" accesskey="&openLinkCmdInTab.accesskey;" - data-usercontextid="0" - oncommand="gContextMenu.openLinkInTab(event);"/> - - <menu id="context-openlinkinusercontext-menu" - label="&openLinkCmdInContainerTab.label;" - accesskey="&openLinkCmdInContainerTab.accesskey;" - hidden="true"> - <menupopup oncommand="gContextMenu.openLinkInTab(event);" - onpopupshowing="return gContextMenu.createContainerMenu(event);" /> - </menu> + oncommand="gContextMenu.openLinkInTab();"/> <menuitem id="context-openlink" label="&openLinkCmd.label;" diff --git a/application/basilisk/base/content/browser-menubar.inc b/application/basilisk/base/content/browser-menubar.inc index 41734711c..0549ad915 100644 --- a/application/basilisk/base/content/browser-menubar.inc +++ b/application/basilisk/base/content/browser-menubar.inc @@ -11,19 +11,12 @@ style="border:0px;padding:0px;margin:0px;-moz-appearance:none"> <menu id="file-menu" label="&fileMenu.label;" accesskey="&fileMenu.accesskey;"> - <menupopup id="menu_FilePopup" - onpopupshowing="updateUserContextUIVisibility();"> + <menupopup id="menu_FilePopup"> <menuitem id="menu_newNavigatorTab" label="&tabCmd.label;" command="cmd_newNavigatorTab" key="key_newNavigatorTab" accesskey="&tabCmd.accesskey;"/> - <menu id="menu_newUserContext" - label="&newUserContext.label;" - accesskey="&newUserContext.accesskey;" - hidden="true"> - <menupopup onpopupshowing="return createUserContextMenu(event);" /> - </menu> <menuitem id="menu_newNavigator" label="&newNavigatorCmd.label;" accesskey="&newNavigatorCmd.accesskey;" diff --git a/application/basilisk/base/content/browser.js b/application/basilisk/base/content/browser.js index 336670fa0..aa8a8413e 100644 --- a/application/basilisk/base/content/browser.js +++ b/application/basilisk/base/content/browser.js @@ -8,7 +8,6 @@ var Cu = Components.utils; var Cc = Components.classes; Cu.import("resource://gre/modules/XPCOMUtils.jsm"); -Cu.import("resource://gre/modules/ContextualIdentityService.jsm"); Cu.import("resource://gre/modules/NotificationDB.jsm"); // lazy module getters @@ -827,10 +826,6 @@ function _loadURIWithFlags(browser, uri, params) { } try { if (!mustChangeProcess) { - if (params.userContextId) { - browser.webNavigation.setOriginAttributesBeforeLoading({ userContextId: params.userContextId }); - } - browser.webNavigation.loadURIWithOptions(uri, flags, referrer, referrerPolicy, postData, null, null, triggeringPrincipal); @@ -856,10 +851,6 @@ function _loadURIWithFlags(browser, uri, params) { postData: postData } - if (params.userContextId) { - loadParams.userContextId = params.userContextId; - } - LoadInOtherProcess(browser, loadParams); } } catch (e) { @@ -872,10 +863,6 @@ function _loadURIWithFlags(browser, uri, params) { Cu.reportError(e); gBrowser.updateBrowserRemotenessByURL(browser, uri); - if (params.userContextId) { - browser.webNavigation.setOriginAttributesBeforeLoading({ userContextId: params.userContextId }); - } - browser.webNavigation.loadURIWithOptions(uri, flags, referrer, referrerPolicy, postData, null, null, triggeringPrincipal); } else { @@ -939,16 +926,6 @@ addEventListener("DOMContentLoaded", function onDCL() { let initBrowser = document.getAnonymousElementByAttribute(gBrowser, "anonid", "initialBrowser"); - // The window's first argument is a tab if and only if we are swapping tabs. - // We must set the browser's usercontextid before updateBrowserRemoteness(), - // so that the newly created remote tab child has the correct usercontextid. - if (window.arguments) { - let tabToOpen = window.arguments[0]; - if (tabToOpen instanceof XULElement && tabToOpen.hasAttribute("usercontextid")) { - initBrowser.setAttribute("usercontextid", tabToOpen.getAttribute("usercontextid")); - } - } - gBrowser.updateBrowserRemoteness(initBrowser, gMultiProcessBrowser); }); @@ -1133,13 +1110,6 @@ var gBrowserInit = { // make sure it has a docshell gBrowser.docShell; - // We must set usercontextid before updateBrowserRemoteness() - // so that the newly created remote tab child has correct usercontextid - if (tabToOpen.hasAttribute("usercontextid")) { - let usercontextid = tabToOpen.getAttribute("usercontextid"); - gBrowser.selectedBrowser.setAttribute("usercontextid", usercontextid); - } - // If the browser that we're swapping in was remote, then we'd better // be able to support remote browsers, and then make our selectedTab // remote. @@ -1165,9 +1135,8 @@ var gBrowserInit = { // [3]: postData (nsIInputStream) // [4]: allowThirdPartyFixup (bool) // [5]: referrerPolicy (int) - // [6]: userContextId (int) - // [7]: originPrincipal (nsIPrincipal) - // [8]: triggeringPrincipal (nsIPrincipal) + // [6]: originPrincipal (nsIPrincipal) + // [7]: triggeringPrincipal (nsIPrincipal) else if (window.arguments.length >= 3) { let referrerURI = window.arguments[2]; if (typeof(referrerURI) == "string") { @@ -1179,13 +1148,11 @@ var gBrowserInit = { } let referrerPolicy = (window.arguments[5] != undefined ? window.arguments[5] : Ci.nsIHttpChannel.REFERRER_POLICY_DEFAULT); - let userContextId = (window.arguments[6] != undefined ? - window.arguments[6] : Ci.nsIScriptSecurityManager.DEFAULT_USER_CONTEXT_ID); loadURI(uriToLoad, referrerURI, window.arguments[3] || null, - window.arguments[4] || false, referrerPolicy, userContextId, + window.arguments[4] || false, referrerPolicy, // pass the origin principal (if any) and force its use to create // an initial about:blank viewer if present: - window.arguments[7], !!window.arguments[7], window.arguments[8]); + window.arguments[6], !!window.arguments[6], window.arguments[7]); window.focus(); } // Note: loadOneOrMoreURIs *must not* be called if window.arguments.length >= 3. @@ -2070,7 +2037,7 @@ function BrowserTryToCloseWindow() } function loadURI(uri, referrer, postData, allowThirdPartyFixup, referrerPolicy, - userContextId, originPrincipal, forceAboutBlankViewerInCurrent, + originPrincipal, forceAboutBlankViewerInCurrent, triggeringPrincipal) { try { openLinkIn(uri, "current", @@ -2078,7 +2045,6 @@ function loadURI(uri, referrer, postData, allowThirdPartyFixup, referrerPolicy, referrerPolicy: referrerPolicy, postData: postData, allowThirdPartyFixup: allowThirdPartyFixup, - userContextId: userContextId, originPrincipal, triggeringPrincipal, forceAboutBlankViewerInCurrent, @@ -3951,66 +3917,6 @@ function updateEditUIVisibility() } /** - * Opens a new tab with the userContextId specified as an attribute of - * sourceEvent. This attribute is propagated to the top level originAttributes - * living on the tab's docShell. - * - * @param event - * A click event on a userContext File Menu option - */ -function openNewUserContextTab(event) -{ - openUILinkIn(BROWSER_NEW_TAB_URL, "tab", { - userContextId: parseInt(event.target.getAttribute('data-usercontextid')), - }); -} - -/** - * Updates File Menu User Context UI visibility depending on - * privacy.userContext.enabled pref state. - */ -function updateUserContextUIVisibility() -{ - let menu = document.getElementById("menu_newUserContext"); - menu.hidden = !Services.prefs.getBoolPref("privacy.userContext.enabled"); - if (PrivateBrowsingUtils.isWindowPrivate(window)) { - menu.setAttribute("disabled", "true"); - } -} - -/** - * Updates the User Context UI indicators if the browser is in a non-default context - */ -function updateUserContextUIIndicator() -{ - let hbox = document.getElementById("userContext-icons"); - - let userContextId = gBrowser.selectedBrowser.getAttribute("usercontextid"); - if (!userContextId) { - hbox.setAttribute("data-identity-color", ""); - hbox.hidden = true; - return; - } - - let identity = ContextualIdentityService.getIdentityFromId(userContextId); - if (!identity) { - hbox.setAttribute("data-identity-color", ""); - hbox.hidden = true; - return; - } - - hbox.setAttribute("data-identity-color", identity.color); - - let label = document.getElementById("userContext-label"); - label.setAttribute("value", ContextualIdentityService.getUserContextLabel(userContextId)); - - let indicator = document.getElementById("userContext-indicator"); - indicator.setAttribute("data-identity-icon", identity.icon); - - hbox.hidden = false; -} - -/** * Makes the Character Encoding menu enabled or disabled as appropriate. * To be called when the View menu or the app menu is opened. */ @@ -4690,7 +4596,6 @@ nsBrowserAccess.prototype = { _openURIInNewTab: function(aURI, aReferrer, aReferrerPolicy, aIsPrivate, aIsExternal, aForceNotRemote=false, - aUserContextId=Ci.nsIScriptSecurityManager.DEFAULT_USER_CONTEXT_ID, aOpener = null, aTriggeringPrincipal = null) { let win, needToFocusWin; @@ -4719,7 +4624,6 @@ nsBrowserAccess.prototype = { triggeringPrincipal: aTriggeringPrincipal, referrerURI: aReferrer, referrerPolicy: aReferrerPolicy, - userContextId: aUserContextId, fromExternal: aIsExternal, inBackground: loadInBackground, forceNotRemote: aForceNotRemote, @@ -4796,13 +4700,10 @@ nsBrowserAccess.prototype = { // will do the job of shuttling off the newly opened browser to run in // the right process once it starts loading a URI. let forceNotRemote = !!aOpener; - let userContextId = aOpener && aOpener.document - ? aOpener.document.nodePrincipal.originAttributes.userContextId - : Ci.nsIScriptSecurityManager.DEFAULT_USER_CONTEXT_ID; let openerWindow = (aFlags & Ci.nsIBrowserDOMWindow.OPEN_NO_OPENER) ? null : aOpener; let browser = this._openURIInNewTab(aURI, referrer, referrerPolicy, isPrivate, isExternal, - forceNotRemote, userContextId, + forceNotRemote, openerWindow, triggeringPrincipal); if (browser) newWindow = browser.contentWindow; @@ -4834,16 +4735,10 @@ nsBrowserAccess.prototype = { var isExternal = !!(aFlags & Ci.nsIBrowserDOMWindow.OPEN_EXTERNAL); - var userContextId = aParams.openerOriginAttributes && - ("userContextId" in aParams.openerOriginAttributes) - ? aParams.openerOriginAttributes.userContextId - : Ci.nsIScriptSecurityManager.DEFAULT_USER_CONTEXT_ID - let browser = this._openURIInNewTab(aURI, aParams.referrer, aParams.referrerPolicy, aParams.isPrivate, isExternal, false, - userContextId, null, aParams.triggeringPrincipal); if (browser) return browser.QueryInterface(Ci.nsIFrameLoaderOwner); @@ -5400,11 +5295,6 @@ function handleLinkClick(event, href, linkNode) { triggeringPrincipal: doc.nodePrincipal, }; - // The new tab/window must use the same userContextId - if (doc.nodePrincipal.originAttributes.userContextId) { - params.userContextId = doc.nodePrincipal.originAttributes.userContextId; - } - openLinkIn(href, where, params); event.preventDefault(); return true; @@ -5476,8 +5366,6 @@ function handleDroppedLink(event, urlOrLinks, name) let lastLocationChange = gBrowser.selectedBrowser.lastLocationChange; - let userContextId = gBrowser.selectedBrowser.getAttribute("usercontextid"); - // event is null if links are dropped in content process. // inBackground should be false, as it's loading into current browser. let inBackground = false; @@ -5501,7 +5389,6 @@ function handleDroppedLink(event, urlOrLinks, name) replace: true, allowThirdPartyFixup: false, postDatas, - userContextId, }); } }); diff --git a/application/basilisk/base/content/browser.xul b/application/basilisk/base/content/browser.xul index be64f1bac..0cc4c982a 100644 --- a/application/basilisk/base/content/browser.xul +++ b/application/basilisk/base/content/browser.xul @@ -8,7 +8,6 @@ <?xml-stylesheet href="chrome://browser/content/browser.css" type="text/css"?> <?xml-stylesheet href="chrome://browser/content/places/places.css" type="text/css"?> -<?xml-stylesheet href="chrome://browser/content/usercontext/usercontext.css" type="text/css"?> #ifdef MOZ_DEVTOOLS <?xml-stylesheet href="chrome://devtools/skin/devtools-browser.css" type="text/css"?> #endif @@ -551,12 +550,7 @@ key="key_undoCloseTab" label="&undoCloseTab.label;" observes="History:UndoCloseTab"/> - <menuseparator id="alltabs-popup-separator-1"/> - <menu id="alltabs_containersTab" - label="&newUserContext.label;"> - <menupopup id="alltabs_containersMenuTab" /> - </menu> - <menuseparator id="alltabs-popup-separator-2"/> + <menuseparator id="alltabs-popup-separator"/> </menupopup> </toolbarbutton> diff --git a/application/basilisk/base/content/content.js b/application/basilisk/base/content/content.js index 5accbdf7b..d2a70ba11 100644 --- a/application/basilisk/base/content/content.js +++ b/application/basilisk/base/content/content.js @@ -162,9 +162,6 @@ var handleContentContextMenu = function (event) { let selectionInfo = BrowserUtils.getSelectionDetails(content); - let loadContext = docShell.QueryInterface(Ci.nsILoadContext); - let userContextId = loadContext.originAttributes.userContextId; - if (Services.appinfo.processType == Services.appinfo.PROCESS_TYPE_CONTENT) { let editFlags = SpellCheckHelper.isEditable(event.target, content); let spellInfo; @@ -188,7 +185,7 @@ var handleContentContextMenu = function (event) { principal, docLocation, charSet, baseURI, referrer, referrerPolicy, contentType, contentDisposition, frameOuterWindowID, selectionInfo, disableSetDesktopBg, - loginFillInfo, parentAllowsMixedContent, userContextId }, + loginFillInfo, parentAllowsMixedContent }, { event, popupNode: event.target }); } else { @@ -212,7 +209,6 @@ var handleContentContextMenu = function (event) { disableSetDesktopBackground: disableSetDesktopBg, loginFillInfo, parentAllowsMixedContent, - userContextId, }; } } diff --git a/application/basilisk/base/content/nsContextMenu.js b/application/basilisk/base/content/nsContextMenu.js index 3f77dcb90..74a2e7a8e 100644 --- a/application/basilisk/base/content/nsContextMenu.js +++ b/application/basilisk/base/content/nsContextMenu.js @@ -4,7 +4,6 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -Components.utils.import("resource://gre/modules/ContextualIdentityService.jsm"); Components.utils.import("resource://gre/modules/PrivateBrowsingUtils.jsm"); Components.utils.import("resource://gre/modules/InlineSpellChecker.jsm"); Components.utils.import("resource://gre/modules/LoginManagerContextMenu.jsm"); @@ -142,28 +141,11 @@ nsContextMenu.prototype = { this.onPlainTextLink = true; } - var inContainer = false; - if (gContextMenuContentData.userContextId) { - inContainer = true; - var item = document.getElementById("context-openlinkincontainertab"); - - item.setAttribute("data-usercontextid", gContextMenuContentData.userContextId); - - var label = - ContextualIdentityService.getUserContextLabel(gContextMenuContentData.userContextId); - item.setAttribute("label", - gBrowserBundle.formatStringFromName("userContextOpenLink.label", - [label], 1)); - } - var shouldShow = this.onSaveableLink || isMailtoInternal || this.onPlainTextLink; var isWindowPrivate = PrivateBrowsingUtils.isWindowPrivate(window); - var showContainers = Services.prefs.getBoolPref("privacy.userContext.enabled"); this.showItem("context-openlink", shouldShow && !isWindowPrivate); this.showItem("context-openlinkprivate", shouldShow); - this.showItem("context-openlinkintab", shouldShow && !inContainer); - this.showItem("context-openlinkincontainertab", shouldShow && inContainer); - this.showItem("context-openlinkinusercontext-menu", shouldShow && !isWindowPrivate && showContainers); + this.showItem("context-openlinkintab", shouldShow); this.showItem("context-openlinkincurrent", this.onPlainTextLink); this.showItem("context-sep-open", shouldShow); }, @@ -958,13 +940,6 @@ nsContextMenu.prototype = { params[p] = extra[p]; } - // If we want to change userContextId, we must be sure that we don't - // propagate the referrer. - if ("userContextId" in params && - params.userContextId != gContextMenuContentData.userContextId) { - params.noReferrer = true; - } - return params; }, @@ -982,7 +957,7 @@ nsContextMenu.prototype = { }, // Open linked-to URL in a new tab. - openLinkInTab: function(event) { + openLinkInTab: function() { urlSecurityCheck(this.linkURL, this.principal); let referrerURI = gContextMenuContentData.documentURIObject; @@ -1003,7 +978,6 @@ nsContextMenu.prototype = { let params = { allowMixedContent: persistAllowMixedContentInChildTab, - userContextId: parseInt(event.target.getAttribute('data-usercontextid')), }; openLinkIn(this.linkURL, "tab", this._openLinkInParameters(params)); @@ -1779,8 +1753,4 @@ nsContextMenu.prototype = { menuItem.label = menuLabel; menuItem.accessKey = gNavigatorBundle.getString("contextMenuSearch.accesskey"); }, - createContainerMenu: function(aEvent) { - return createUserContextMenu(aEvent, true, - gContextMenuContentData.userContextId); - }, }; diff --git a/application/basilisk/base/content/tab-content.js b/application/basilisk/base/content/tab-content.js index 7441b2140..35ef8ceb2 100644 --- a/application/basilisk/base/content/tab-content.js +++ b/application/basilisk/base/content/tab-content.js @@ -886,33 +886,6 @@ var RefreshBlocker = { RefreshBlocker.init(); -var UserContextIdNotifier = { - init() { - addEventListener("DOMWindowCreated", this); - }, - - uninit() { - removeEventListener("DOMWindowCreated", this); - }, - - handleEvent(aEvent) { - // When the window is created, we want to inform the tabbrowser about - // the userContextId in use in order to update the UI correctly. - // Just because we cannot change the userContextId from an active docShell, - // we don't need to check DOMContentLoaded again. - this.uninit(); - - // We use the docShell because content.document can have been loaded before - // setting the originAttributes. - let loadContext = docShell.QueryInterface(Ci.nsILoadContext); - let userContextId = loadContext.originAttributes.userContextId; - - sendAsyncMessage("Browser:WindowCreated", { userContextId }); - } -}; - -UserContextIdNotifier.init(); - addMessageListener("AllowScriptsToClose", () => { content.QueryInterface(Ci.nsIInterfaceRequestor) .getInterface(Ci.nsIDOMWindowUtils) diff --git a/application/basilisk/base/content/tabbrowser.xml b/application/basilisk/base/content/tabbrowser.xml index 52c51db69..c2f02512d 100644 --- a/application/basilisk/base/content/tabbrowser.xml +++ b/application/basilisk/base/content/tabbrowser.xml @@ -814,10 +814,8 @@ } let unifiedComplete = this.mTabBrowser._unifiedComplete; - let userContextId = this.mBrowser.getAttribute("usercontextid") || 0; if (this.mBrowser.registeredOpenURI) { - unifiedComplete.unregisterOpenPage(this.mBrowser.registeredOpenURI, - userContextId); + unifiedComplete.unregisterOpenPage(this.mBrowser.registeredOpenURI); delete this.mBrowser.registeredOpenURI; } // Tabs in private windows aren't registered as "Open" so @@ -825,7 +823,7 @@ if (!isBlankPageURL(aLocation.spec) && (!PrivateBrowsingUtils.isWindowPrivate(window) || PrivateBrowsingUtils.permanentPrivateBrowsing)) { - unifiedComplete.registerOpenPage(aLocation, userContextId); + unifiedComplete.registerOpenPage(aLocation); this.mBrowser.registeredOpenURI = aLocation; } } @@ -1230,7 +1228,6 @@ this._adjustFocusAfterTabSwitch(this.mCurrentTab); } - updateUserContextUIIndicator(); gIdentityHandler.updateSharingIndicator(); this.tabContainer._setPositionalAttributes(); @@ -1486,7 +1483,6 @@ var aSkipAnimation; var aForceNotRemote; var aNoReferrer; - var aUserContextId; var aRelatedBrowser; var aOriginPrincipal; var aOpener; @@ -1507,7 +1503,6 @@ aSkipAnimation = params.skipAnimation; aForceNotRemote = params.forceNotRemote; aNoReferrer = params.noReferrer; - aUserContextId = params.userContextId; aRelatedBrowser = params.relatedBrowser; aOriginPrincipal = params.originPrincipal; aOpener = params.opener; @@ -1530,7 +1525,6 @@ allowMixedContent: aAllowMixedContent, forceNotRemote: aForceNotRemote, noReferrer: aNoReferrer, - userContextId: aUserContextId, originPrincipal: aOriginPrincipal, relatedBrowser: aRelatedBrowser, opener: aOpener }); @@ -1551,7 +1545,6 @@ let aTargetTab; let aNewIndex = -1; let aPostDatas = []; - let aUserContextId; if (arguments.length == 2 && typeof arguments[1] == "object") { let params = arguments[1]; @@ -1562,7 +1555,6 @@ aNewIndex = typeof params.newIndex === "number" ? params.newIndex : aNewIndex; aPostDatas = params.postDatas || aPostDatas; - aUserContextId = params.userContextId; } if (!aURIs.length) @@ -1611,8 +1603,7 @@ ownerTab: owner, skipAnimation: multiple, allowThirdPartyFixup: aAllowThirdPartyFixup, - postData: aPostDatas[0], - userContextId: aUserContextId + postData: aPostDatas[0] }); if (aNewIndex !== -1) { this.moveTabTo(firstTabAdded, aNewIndex); @@ -1625,8 +1616,7 @@ let tab = this.addTab(aURIs[i], { skipAnimation: true, allowThirdPartyFixup: aAllowThirdPartyFixup, - postData: aPostDatas[i], - userContextId: aUserContextId + postData: aPostDatas[i] }); if (targetTabIndex !== -1) this.moveTabTo(tab, ++tabNum); @@ -1899,7 +1889,7 @@ <body> <![CDATA[ // Supported parameters: - // userContextId, remote, isPreloadBrowser, uriIsAboutBlank, permanentKey + // remote, isPreloadBrowser, uriIsAboutBlank, permanentKey const NS_XUL = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; @@ -1911,10 +1901,6 @@ b.setAttribute("contextmenu", this.getAttribute("contentcontextmenu")); b.setAttribute("tooltip", this.getAttribute("contenttooltip")); - if (aParams.userContextId) { - b.setAttribute("usercontextid", aParams.userContextId); - } - if (aParams.remote) { b.setAttribute("remote", "true"); } @@ -1993,7 +1979,7 @@ "use strict"; // Supported parameters: - // forceNotRemote, userContextId + // forceNotRemote let uriIsAboutBlank = !aURI || aURI == "about:blank"; @@ -2011,7 +1997,6 @@ // Private windows are not included because both the label and the // icon for the tab would be set incorrectly (see bug 1195981). if (aURI == BROWSER_NEW_TAB_URL && - !aParams.userContextId && !PrivateBrowsingUtils.isWindowPrivate(window)) { browser = this._getPreloadedBrowser(); if (browser) { @@ -2025,7 +2010,6 @@ browser = this._createBrowser({permanentKey: aTab.permanentKey, remote: remote, uriIsAboutBlank: uriIsAboutBlank, - userContextId: aParams.userContextId, relatedBrowser: aParams.relatedBrowser, opener: aParams.opener}); } @@ -2100,7 +2084,6 @@ var aAllowMixedContent; var aForceNotRemote; var aNoReferrer; - var aUserContextId; var aEventDetail; var aRelatedBrowser; var aOriginPrincipal; @@ -2123,7 +2106,6 @@ aAllowMixedContent = params.allowMixedContent; aForceNotRemote = params.forceNotRemote; aNoReferrer = params.noReferrer; - aUserContextId = params.userContextId; aEventDetail = params.eventDetail; aRelatedBrowser = params.relatedBrowser; aOriginPrincipal = params.originPrincipal; @@ -2150,11 +2132,6 @@ t.setAttribute("label", aURI); } - if (aUserContextId) { - t.setAttribute("usercontextid", aUserContextId); - ContextualIdentityService.setTabStyle(t); - } - t.setAttribute("crop", "end"); t.setAttribute("onerror", "this.removeAttribute('image');"); @@ -2204,7 +2181,6 @@ // of tab.linkedBrowser. let browserParams = { forceNotRemote: aForceNotRemote, - userContextId: aUserContextId, relatedBrowser: aRelatedBrowser, opener: aOpener, }; @@ -2583,8 +2559,7 @@ listener.destroy(); if (browser.registeredOpenURI && !aAdoptedByTab) { - this._unifiedComplete.unregisterOpenPage(browser.registeredOpenURI, - browser.getAttribute("usercontextid") || 0); + this._unifiedComplete.unregisterOpenPage(browser.registeredOpenURI); delete browser.registeredOpenURI; } @@ -2783,11 +2758,6 @@ if (ourBrowser.isRemoteBrowser != otherBrowser.isRemoteBrowser) return; - // Keep the userContextId if set on other browser - if (otherBrowser.hasAttribute("usercontextid")) { - ourBrowser.setAttribute("usercontextid", otherBrowser.getAttribute("usercontextid")); - } - // That's gBrowser for the other window, not the tab's browser! var remoteBrowser = aOtherTab.ownerDocument.defaultView.gBrowser; var isPending = aOtherTab.hasAttribute("pending"); @@ -2820,10 +2790,6 @@ aOurTab.setAttribute("soundplaying", "true"); modifiedAttrs.push("soundplaying"); } - if (aOtherTab.hasAttribute("usercontextid")) { - aOurTab.setUserContextId(aOtherTab.getAttribute("usercontextid")); - modifiedAttrs.push("usercontextid"); - } if (aOtherTab.hasAttribute("sharing")) { aOurTab.setAttribute("sharing", aOtherTab.getAttribute("sharing")); modifiedAttrs.push("sharing"); @@ -2961,8 +2927,7 @@ <![CDATA[ // If the current URI is registered as open remove it from the list. if (aOurBrowser.registeredOpenURI) { - this._unifiedComplete.unregisterOpenPage(aOurBrowser.registeredOpenURI, - aOurBrowser.getAttribute("usercontextid") || 0); + this._unifiedComplete.unregisterOpenPage(aOurBrowser.registeredOpenURI); delete aOurBrowser.registeredOpenURI; } @@ -3302,10 +3267,6 @@ // it in the other window (making it seem to have moved between // windows). let params = { eventDetail: { adoptedTab: aTab } }; - if (aTab.hasAttribute("usercontextid")) { - // new tab must have the same usercontextid as the old one - params.userContextId = aTab.getAttribute("usercontextid"); - } let newTab = this.addTab("about:blank", params); let newBrowser = this.getBrowserForTab(newTab); let newURL = aTab.linkedBrowser.currentURI.spec; @@ -4625,7 +4586,6 @@ disableSetDesktopBackground: data.disableSetDesktopBg, loginFillInfo: data.loginFillInfo, parentAllowsMixedContent: data.parentAllowsMixedContent, - userContextId: data.userContextId, }; let popup = browser.ownerDocument.getElementById("contentAreaContextMenu"); let event = gContextMenuContentData.event; @@ -4652,17 +4612,6 @@ } case "Browser:WindowCreated": { let tab = this.getTabForBrowser(browser); - if (tab && data.userContextId) { - ContextualIdentityService.telemetry(data.userContextId); - tab.setUserContextId(data.userContextId); - } - - // We don't want to update the container icon and identifier if - // this is not the selected browser. - if (browser == gBrowser.selectedBrowser) { - updateUserContextUIIndicator(); - } - break; } case "Findbar:Keypress": { @@ -4845,8 +4794,7 @@ for (let tab of this.tabs) { let browser = tab.linkedBrowser; if (browser.registeredOpenURI) { - this._unifiedComplete.unregisterOpenPage(browser.registeredOpenURI, - browser.getAttribute("usercontextid") || 0); + this._unifiedComplete.unregisterOpenPage(browser.registeredOpenURI); delete browser.registeredOpenURI; } let filter = this._tabFilters.get(tab); @@ -5247,7 +5195,7 @@ </xul:arrowscrollbox> </content> - <implementation implements="nsIDOMEventListener, nsIObserver"> + <implementation implements="nsIDOMEventListener"> <constructor> <![CDATA[ this.mTabClipWidth = Services.prefs.getIntPref("browser.tabs.tabClipWidth"); @@ -5266,17 +5214,9 @@ this._tabAnimationLoggingEnabled = false; } this._browserNewtabpageEnabled = Services.prefs.getBoolPref("browser.newtabpage.enabled"); - this.observe(null, "nsPref:changed", "privacy.userContext.enabled"); - Services.prefs.addObserver("privacy.userContext.enabled", this, false); ]]> </constructor> - <destructor> - <![CDATA[ - Services.prefs.removeObserver("privacy.userContext.enabled", this); - ]]> - </destructor> - <field name="tabbrowser" readonly="true"> document.getElementById(this.getAttribute("tabbrowser")); </field> @@ -5302,55 +5242,6 @@ <field name="_afterHoveredTab">null</field> <field name="_hoveredTab">null</field> - <method name="observe"> - <parameter name="aSubject"/> - <parameter name="aTopic"/> - <parameter name="aData"/> - <body><![CDATA[ - switch (aTopic) { - case "nsPref:changed": - // This is the only pref observed. - let containersEnabled = Services.prefs.getBoolPref("privacy.userContext.enabled"); - - const newTab = document.getElementById("new-tab-button"); - const newTab2 = document.getAnonymousElementByAttribute(this, "anonid", "tabs-newtab-button") - - if (containersEnabled) { - for (let parent of [newTab, newTab2]) { - if (!parent) - continue; - let popup = document.createElementNS( - "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", - "menupopup"); - if (parent.id) { - popup.id = "newtab-popup"; - } else { - popup.setAttribute("anonid", "newtab-popup"); - } - popup.className = "new-tab-popup"; - popup.setAttribute("position", "after_end"); - parent.appendChild(popup); - - gClickAndHoldListenersOnElement.add(parent); - parent.setAttribute("type", "menu"); - } - } else { - for (let parent of [newTab, newTab2]) { - if (!parent) - continue; - gClickAndHoldListenersOnElement.remove(parent); - parent.removeAttribute("type"); - if (!parent.firstChild) - continue; - parent.firstChild.remove(); - } - } - - break; - } - ]]></body> - </method> - <property name="_isCustomizing" readonly="true"> <getter> let root = document.documentElement; @@ -6451,7 +6342,6 @@ inBackground = !inBackground; let targetTab = this._getDragTargetTab(event, true); - let userContextId = this.selectedItem.getAttribute("usercontextid"); let replace = !!targetTab; let newIndex = this._getDropIndex(event, true); let urls = links.map(link => link.url); @@ -6461,7 +6351,6 @@ allowThirdPartyFixup: true, targetTab, newIndex, - userContextId, }); } @@ -6722,14 +6611,6 @@ --> <field name="muteReason">undefined</field> - <property name="userContextId" readonly="true"> - <getter> - return this.hasAttribute("usercontextid") - ? parseInt(this.getAttribute("usercontextid")) - : 0; - </getter> - </property> - <property name="soundPlaying" readonly="true"> <getter> return this.getAttribute("soundplaying") == "true"; @@ -6857,27 +6738,6 @@ ]]> </body> </method> - - <method name="setUserContextId"> - <parameter name="aUserContextId"/> - <body> - <![CDATA[ - if (aUserContextId) { - if (this.linkedBrowser) { - this.linkedBrowser.setAttribute("usercontextid", aUserContextId); - } - this.setAttribute("usercontextid", aUserContextId); - } else { - if (this.linkedBrowser) { - this.linkedBrowser.removeAttribute("usercontextid"); - } - this.removeAttribute("usercontextid"); - } - - ContextualIdentityService.setTabStyle(this); - ]]> - </body> - </method> </implementation> <handlers> @@ -7054,30 +6914,9 @@ <handlers> <handler event="popupshowing"> <![CDATA[ - if (event.target.getAttribute("id") == "alltabs_containersMenuTab") { - createUserContextMenu(event); - return; - } - - let containersEnabled = Services.prefs.getBoolPref("privacy.userContext.enabled"); - - if (event.target.getAttribute("anonid") == "newtab-popup" || - event.target.id == "newtab-popup") { - createUserContextMenu(event); - } else { - document.getElementById("alltabs-popup-separator-1").hidden = !containersEnabled; - let containersTab = document.getElementById("alltabs_containersTab"); - - containersTab.hidden = !containersEnabled; - if (PrivateBrowsingUtils.isWindowPrivate(window)) { - containersTab.setAttribute("disabled", "true"); - } - document.getElementById("alltabs_undoCloseTab").disabled = SessionStore.getClosedTabCount(window) == 0; - var tabcontainer = gBrowser.tabContainer; - // Listen for changes in the tab bar. tabcontainer.addEventListener("TabAttrModified", this, false); tabcontainer.addEventListener("TabClose", this, false); @@ -7094,9 +6933,6 @@ <handler event="popuphidden"> <![CDATA[ - if (event.target.getAttribute("id") == "alltabs_containersMenuTab") { - return; - } // clear out the menu popup and remove the listeners for (let i = this.childNodes.length - 1; i > 0; i--) { @@ -7105,9 +6941,6 @@ menuItem.tab.mCorrespondingMenuitem = null; this.removeChild(menuItem); } - if (menuItem.hasAttribute("usercontextid")) { - this.removeChild(menuItem); - } } var tabcontainer = gBrowser.tabContainer; tabcontainer.mTabstrip.removeEventListener("scroll", this, false); diff --git a/application/basilisk/base/content/utilityOverlay.js b/application/basilisk/base/content/utilityOverlay.js index 38ca82f55..c8d85212f 100644 --- a/application/basilisk/base/content/utilityOverlay.js +++ b/application/basilisk/base/content/utilityOverlay.js @@ -5,7 +5,6 @@ // Services = object with smart getters for common XPCOM services Components.utils.import("resource://gre/modules/AppConstants.jsm"); -Components.utils.import("resource://gre/modules/ContextualIdentityService.jsm"); Components.utils.import("resource://gre/modules/Services.jsm"); Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); Components.utils.import("resource://gre/modules/PrivateBrowsingUtils.jsm"); @@ -176,7 +175,6 @@ function whereToOpenLink( e, ignoreButton, ignoreAlt ) * skipTabAnimation (boolean) * allowPinnedTabHostChange (boolean) * allowPopups (boolean) - * userContextId (unsigned int) */ function openUILinkIn(url, where, aAllowThirdPartyFixup, aPostData, aReferrerURI) { var params; @@ -222,7 +220,6 @@ function openLinkIn(url, where, params) { var aAllowPinnedTabHostChange = !!params.allowPinnedTabHostChange; var aNoReferrer = params.noReferrer; var aAllowPopups = !!params.allowPopups; - var aUserContextId = params.userContextId; var aIndicateErrorPageLoad = params.indicateErrorPageLoad; var aPrincipal = params.originPrincipal; var aTriggeringPrincipal = params.triggeringPrincipal; @@ -268,7 +265,6 @@ function openLinkIn(url, where, params) { function useOAForPrincipal(principal) { if (principal && principal.isCodebasePrincipal) { let attrs = { - userContextId: aUserContextId, privateBrowsingId: aIsPrivate || (w && PrivateBrowsingUtils.isWindowPrivate(w)), }; return Services.scriptSecurityManager.createCodebasePrincipal(principal.URI, attrs); @@ -315,17 +311,12 @@ function openLinkIn(url, where, params) { createInstance(Ci.nsISupportsPRUint32); referrerPolicySupports.data = aReferrerPolicy; - var userContextIdSupports = Cc["@mozilla.org/supports-PRUint32;1"]. - createInstance(Ci.nsISupportsPRUint32); - userContextIdSupports.data = aUserContextId; - sa.appendElement(wuri, /* weak =*/ false); sa.appendElement(charset, /* weak =*/ false); sa.appendElement(referrerURISupports, /* weak =*/ false); sa.appendElement(aPostData, /* weak =*/ false); sa.appendElement(allowThirdPartyFixupSupports, /* weak =*/ false); sa.appendElement(referrerPolicySupports, /* weak =*/ false); - sa.appendElement(userContextIdSupports, /* weak =*/ false); sa.appendElement(aPrincipal, /* weak =*/ false); sa.appendElement(aTriggeringPrincipal, /* weak =*/ false); @@ -418,8 +409,7 @@ function openLinkIn(url, where, params) { flags: flags, referrerURI: aNoReferrer ? null : aReferrerURI, referrerPolicy: aReferrerPolicy, - postData: aPostData, - userContextId: aUserContextId + postData: aPostData }); browserUsedForLoad = aCurrentBrowser; break; @@ -438,7 +428,6 @@ function openLinkIn(url, where, params) { skipAnimation: aSkipTabAnimation, allowMixedContent: aAllowMixedContent, noReferrer: aNoReferrer, - userContextId: aUserContextId, originPrincipal: aPrincipal, triggeringPrincipal: aTriggeringPrincipal, }); @@ -482,74 +471,6 @@ function checkForMiddleClick(node, event) { } } -// Populate a menu with user-context menu items. This method should be called -// by onpopupshowing passing the event as first argument. -function createUserContextMenu(event, isContextMenu = false, excludeUserContextId = 0) { - while (event.target.hasChildNodes()) { - event.target.removeChild(event.target.firstChild); - } - - let bundle = document.getElementById("bundle_browser"); - let docfrag = document.createDocumentFragment(); - - // If we are excluding a userContextId, we want to add a 'no-container' item. - if (excludeUserContextId) { - let menuitem = document.createElement("menuitem"); - menuitem.setAttribute("data-usercontextid", "0"); - menuitem.setAttribute("label", bundle.getString("userContextNone.label")); - menuitem.setAttribute("accesskey", bundle.getString("userContextNone.accesskey")); - - // We don't set an oncommand/command attribute because if we have - // to exclude a userContextId we are generating the contextMenu and - // isContextMenu will be true. - - docfrag.appendChild(menuitem); - - let menuseparator = document.createElement("menuseparator"); - docfrag.appendChild(menuseparator); - } - - ContextualIdentityService.getIdentities().forEach(identity => { - if (identity.userContextId == excludeUserContextId) { - return; - } - - let menuitem = document.createElement("menuitem"); - menuitem.setAttribute("data-usercontextid", identity.userContextId); - menuitem.setAttribute("label", ContextualIdentityService.getUserContextLabel(identity.userContextId)); - - if (identity.accessKey) { - menuitem.setAttribute("accesskey", bundle.getString(identity.accessKey)); - } - - menuitem.classList.add("menuitem-iconic"); - menuitem.setAttribute("data-identity-color", identity.color); - - if (!isContextMenu) { - menuitem.setAttribute("command", "Browser:NewUserContextTab"); - } - - menuitem.setAttribute("data-identity-icon", identity.icon); - - docfrag.appendChild(menuitem); - }); - - if (!isContextMenu) { - docfrag.appendChild(document.createElement("menuseparator")); - - let menuitem = document.createElement("menuitem"); - menuitem.setAttribute("label", - bundle.getString("userContext.aboutPage.label")); - menuitem.setAttribute("accesskey", - bundle.getString("userContext.aboutPage.accesskey")); - menuitem.setAttribute("command", "Browser:OpenAboutContainers"); - docfrag.appendChild(menuitem); - } - - event.target.appendChild(docfrag); - return true; -} - // Closes all popups that are ancestors of the node. function closeMenus(node) { |