summaryrefslogtreecommitdiff
path: root/base
diff options
context:
space:
mode:
authorGaming4JC <g4jc@bulletmail.org>2018-09-07 20:48:23 -0400
committerGaming4JC <g4jc@bulletmail.org>2018-09-07 20:48:23 -0400
commitd537c7feaa440254f371a2355208fae09dd95316 (patch)
treebffcb19cd6245bcc0ad58f2220a16974dec43978 /base
parent691cd930f487a5dd9f60d68dc701ebd4bef96ad0 (diff)
downloadiceweasel-uxp-d537c7feaa440254f371a2355208fae09dd95316.tar.gz
Remove contextual identityv2.0
Diffstat (limited to 'base')
-rwxr-xr-xbase/content/browser.js46
-rw-r--r--base/content/browser.xul8
-rw-r--r--base/content/nsContextMenu.js34
-rw-r--r--base/content/tabbrowser.xml124
-rw-r--r--base/content/utilityOverlay.js81
5 files changed, 5 insertions, 288 deletions
diff --git a/base/content/browser.js b/base/content/browser.js
index 035cf2c..ae0e3c1 100755
--- a/base/content/browser.js
+++ b/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
@@ -3984,51 +3983,6 @@ function openNewUserContextTab(event)
}
/**
- * 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.
*/
diff --git a/base/content/browser.xul b/base/content/browser.xul
index 06e05cc..0e6ea75 100644
--- a/base/content/browser.xul
+++ b/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/base/content/nsContextMenu.js b/base/content/nsContextMenu.js
index 7bcd5d9..f7d4a2d 100644
--- a/base/content/nsContextMenu.js
+++ b/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");
@@ -104,28 +103,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);
},
@@ -918,13 +900,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;
},
@@ -942,7 +917,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;
@@ -963,7 +938,6 @@ nsContextMenu.prototype = {
let params = {
allowMixedContent: persistAllowMixedContentInChildTab,
- userContextId: parseInt(event.target.getAttribute('data-usercontextid')),
};
openLinkIn(this.linkURL, "tab", this._openLinkInParameters(params));
@@ -1739,8 +1713,4 @@ nsContextMenu.prototype = {
menuItem.label = menuLabel;
menuItem.accessKey = gNavigatorBundle.getString("contextMenuSearch.accesskey");
},
- createContainerMenu: function(aEvent) {
- return createUserContextMenu(aEvent, true,
- gContextMenuContentData.userContextId);
- },
};
diff --git a/base/content/tabbrowser.xml b/base/content/tabbrowser.xml
index 76ea5d1..44b8acb 100644
--- a/base/content/tabbrowser.xml
+++ b/base/content/tabbrowser.xml
@@ -1230,7 +1230,6 @@
this._adjustFocusAfterTabSwitch(this.mCurrentTab);
}
- updateUserContextUIIndicator();
gIdentityHandler.updateSharingIndicator();
this.tabContainer._setPositionalAttributes();
@@ -2144,11 +2143,6 @@
t.setAttribute("label", aURI);
}
- if (aUserContextId) {
- t.setAttribute("usercontextid", aUserContextId);
- ContextualIdentityService.setTabStyle(t);
- }
-
t.setAttribute("crop", "end");
t.setAttribute("onerror", "this.removeAttribute('image');");
t.className = "tabbrowser-tab";
@@ -4638,16 +4632,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;
}
@@ -5233,7 +5217,7 @@
</xul:arrowscrollbox>
</content>
- <implementation implements="nsIDOMEventListener, nsIObserver">
+ <implementation implements="nsIDOMEventListener">
<constructor>
<![CDATA[
this.mTabClipWidth = Services.prefs.getIntPref("browser.tabs.tabClipWidth");
@@ -5252,17 +5236,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>
@@ -5288,55 +5264,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;
@@ -6839,27 +6766,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>
@@ -7036,30 +6942,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);
@@ -7076,10 +6961,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--) {
let menuItem = this.childNodes[i];
@@ -7087,9 +6968,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/base/content/utilityOverlay.js b/base/content/utilityOverlay.js
index 38ca82f..c8d8521 100644
--- a/base/content/utilityOverlay.js
+++ b/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)
{