Remove Contextual Identity
parent
2f95386dbb
commit
8fe1fdda57
|
@ -1250,17 +1250,6 @@ pref("privacy.trackingprotection.ui.enabled", true);
|
|||
pref("privacy.trackingprotection.ui.enabled", false);
|
||||
#endif
|
||||
|
||||
// Enable Contextual Identity Containers
|
||||
#ifdef NIGHTLY_BUILD
|
||||
pref("privacy.userContext.enabled", true);
|
||||
pref("privacy.userContext.ui.enabled", true);
|
||||
pref("privacy.usercontext.about_newtab_segregation.enabled", true);
|
||||
#else
|
||||
pref("privacy.userContext.enabled", false);
|
||||
pref("privacy.userContext.ui.enabled", false);
|
||||
pref("privacy.usercontext.about_newtab_segregation.enabled", false);
|
||||
#endif
|
||||
|
||||
#ifndef RELEASE_OR_BETA
|
||||
// At the moment, autostart.2 is used, while autostart.1 is unused.
|
||||
// We leave it here set to false to reset users' defaults and allow
|
||||
|
|
|
@ -1244,17 +1244,6 @@ pref("privacy.trackingprotection.ui.enabled", true);
|
|||
pref("privacy.trackingprotection.ui.enabled", false);
|
||||
#endif
|
||||
|
||||
// Enable Contextual Identity Containers
|
||||
#ifdef NIGHTLY_BUILD
|
||||
pref("privacy.userContext.enabled", true);
|
||||
pref("privacy.userContext.ui.enabled", true);
|
||||
pref("privacy.usercontext.about_newtab_segregation.enabled", true);
|
||||
#else
|
||||
pref("privacy.userContext.enabled", false);
|
||||
pref("privacy.userContext.ui.enabled", false);
|
||||
pref("privacy.usercontext.about_newtab_segregation.enabled", false);
|
||||
#endif
|
||||
|
||||
#ifndef RELEASE_OR_BETA
|
||||
// At the moment, autostart.2 is used, while autostart.1 is unused.
|
||||
// We leave it here set to false to reset users' defaults and allow
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -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;"
|
||||
|
|
|
@ -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;"
|
||||
|
|
|
@ -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
|
||||
|
@ -826,10 +825,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);
|
||||
|
@ -855,10 +850,6 @@ function _loadURIWithFlags(browser, uri, params) {
|
|||
postData: postData
|
||||
}
|
||||
|
||||
if (params.userContextId) {
|
||||
loadParams.userContextId = params.userContextId;
|
||||
}
|
||||
|
||||
LoadInOtherProcess(browser, loadParams);
|
||||
}
|
||||
} catch (e) {
|
||||
|
@ -871,10 +862,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 {
|
||||
|
@ -938,16 +925,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);
|
||||
});
|
||||
|
||||
|
@ -1131,13 +1108,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.
|
||||
|
@ -1163,9 +1133,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") {
|
||||
|
@ -1177,13 +1146,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.
|
||||
|
@ -2057,7 +2024,7 @@ function BrowserTryToCloseWindow()
|
|||
}
|
||||
|
||||
function loadURI(uri, referrer, postData, allowThirdPartyFixup, referrerPolicy,
|
||||
userContextId, originPrincipal, forceAboutBlankViewerInCurrent,
|
||||
originPrincipal, forceAboutBlankViewerInCurrent,
|
||||
triggeringPrincipal) {
|
||||
try {
|
||||
openLinkIn(uri, "current",
|
||||
|
@ -2065,7 +2032,6 @@ function loadURI(uri, referrer, postData, allowThirdPartyFixup, referrerPolicy,
|
|||
referrerPolicy: referrerPolicy,
|
||||
postData: postData,
|
||||
allowThirdPartyFixup: allowThirdPartyFixup,
|
||||
userContextId: userContextId,
|
||||
originPrincipal,
|
||||
triggeringPrincipal,
|
||||
forceAboutBlankViewerInCurrent,
|
||||
|
@ -3916,66 +3882,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.
|
||||
|
@ -4656,7 +4562,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;
|
||||
|
||||
|
@ -4685,7 +4590,6 @@ nsBrowserAccess.prototype = {
|
|||
triggeringPrincipal: aTriggeringPrincipal,
|
||||
referrerURI: aReferrer,
|
||||
referrerPolicy: aReferrerPolicy,
|
||||
userContextId: aUserContextId,
|
||||
fromExternal: aIsExternal,
|
||||
inBackground: loadInBackground,
|
||||
forceNotRemote: aForceNotRemote,
|
||||
|
@ -4762,13 +4666,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;
|
||||
|
@ -4800,16 +4701,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);
|
||||
|
@ -5366,11 +5261,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;
|
||||
|
@ -5442,8 +5332,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;
|
||||
|
@ -5467,7 +5355,6 @@ function handleDroppedLink(event, urlOrLinks, name)
|
|||
replace: true,
|
||||
allowThirdPartyFixup: false,
|
||||
postDatas,
|
||||
userContextId,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
@ -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
|
||||
|
@ -498,12 +497,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>
|
||||
|
||||
|
|
|
@ -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,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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");
|
||||
|
@ -141,28 +140,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);
|
||||
},
|
||||
|
@ -953,13 +935,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;
|
||||
},
|
||||
|
||||
|
@ -977,7 +952,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;
|
||||
|
||||
|
@ -998,7 +973,6 @@ nsContextMenu.prototype = {
|
|||
|
||||
let params = {
|
||||
allowMixedContent: persistAllowMixedContentInChildTab,
|
||||
userContextId: parseInt(event.target.getAttribute('data-usercontextid')),
|
||||
};
|
||||
|
||||
openLinkIn(this.linkURL, "tab", this._openLinkInParameters(params));
|
||||
|
@ -1774,8 +1748,4 @@ nsContextMenu.prototype = {
|
|||
menuItem.label = menuLabel;
|
||||
menuItem.accessKey = gNavigatorBundle.getString("contextMenuSearch.accesskey");
|
||||
},
|
||||
createContainerMenu: function(aEvent) {
|
||||
return createUserContextMenu(aEvent, true,
|
||||
gContextMenuContentData.userContextId);
|
||||
},
|
||||
};
|
||||
|
|
|
@ -889,33 +889,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();
|
||||
|
||||
#ifdef MOZ_WEBEXTENSIONS
|
||||
ExtensionContent.init(this);
|
||||
addEventListener("unload", () => {
|
||||
|
|
|
@ -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;
|
||||
|
@ -6454,7 +6345,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);
|
||||
|
@ -6464,7 +6354,6 @@
|
|||
allowThirdPartyFixup: true,
|
||||
targetTab,
|
||||
newIndex,
|
||||
userContextId,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -6725,14 +6614,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";
|
||||
|
@ -6860,27 +6741,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>
|
||||
|
@ -7057,30 +6917,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);
|
||||
|
@ -7097,9 +6936,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--) {
|
||||
|
@ -7108,9 +6944,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);
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -1,91 +0,0 @@
|
|||
[data-identity-color="blue"] {
|
||||
--identity-tab-color: #0996f8;
|
||||
--identity-icon-color: #00a7e0;
|
||||
}
|
||||
|
||||
[data-identity-color="turquoise"] {
|
||||
--identity-tab-color: #01bdad;
|
||||
--identity-icon-color: #01bdad;
|
||||
}
|
||||
|
||||
[data-identity-color="green"] {
|
||||
--identity-tab-color: #57bd35;
|
||||
--identity-icon-color: #7dc14c;
|
||||
}
|
||||
|
||||
[data-identity-color="yellow"] {
|
||||
--identity-tab-color: #ffcb00;
|
||||
--identity-icon-color: #ffcb00;
|
||||
}
|
||||
|
||||
[data-identity-color="orange"] {
|
||||
--identity-tab-color: #ff9216;
|
||||
--identity-icon-color: #ff9216;
|
||||
}
|
||||
|
||||
[data-identity-color="red"] {
|
||||
--identity-tab-color: #d92215;
|
||||
--identity-icon-color: #d92215;
|
||||
}
|
||||
|
||||
[data-identity-color="pink"] {
|
||||
--identity-tab-color: #ea385e;
|
||||
--identity-icon-color: #ee5195;
|
||||
}
|
||||
|
||||
[data-identity-color="purple"] {
|
||||
--identity-tab-color: #7a2f7a;
|
||||
--identity-icon-color: #7a2f7a;
|
||||
}
|
||||
|
||||
[data-identity-icon="fingerprint"] {
|
||||
--identity-icon: url("chrome://browser/content/usercontext.svg#fingerprint");
|
||||
}
|
||||
|
||||
[data-identity-icon="briefcase"] {
|
||||
--identity-icon: url("chrome://browser/content/usercontext.svg#briefcase");
|
||||
}
|
||||
|
||||
[data-identity-icon="dollar"] {
|
||||
--identity-icon: url("chrome://browser/content/usercontext.svg#dollar");
|
||||
}
|
||||
|
||||
[data-identity-icon="cart"] {
|
||||
--identity-icon: url("chrome://browser/content/usercontext.svg#cart");
|
||||
}
|
||||
|
||||
[data-identity-icon="circle"] {
|
||||
--identity-icon: url("chrome://browser/content/usercontext.svg#circle");
|
||||
}
|
||||
|
||||
#userContext-indicator {
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
}
|
||||
|
||||
#userContext-label {
|
||||
margin-inline-end: 3px;
|
||||
color: var(--identity-tab-color);
|
||||
}
|
||||
|
||||
#userContext-icons {
|
||||
-moz-box-align: center;
|
||||
}
|
||||
|
||||
.tabbrowser-tab[usercontextid] {
|
||||
background-image: linear-gradient(to right, transparent 20%, var(--identity-tab-color) 30%, var(--identity-tab-color) 70%, transparent 80%);
|
||||
background-size: auto 2px;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
.userContext-icon,
|
||||
.menuitem-iconic[data-usercontextid] > .menu-iconic-left > .menu-iconic-icon,
|
||||
.subviewbutton[usercontextid] > .toolbarbutton-icon,
|
||||
#userContext-indicator {
|
||||
background-image: var(--identity-icon);
|
||||
filter: url(chrome://browser/skin/filters.svg#fill);
|
||||
fill: var(--identity-icon-color);
|
||||
background-size: contain;
|
||||
background-repeat: no-repeat;
|
||||
background-position: center center;
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# 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/.
|
||||
|
||||
browser.jar:
|
||||
content/browser/usercontext/usercontext.css (content/usercontext.css)
|
|
@ -1,7 +0,0 @@
|
|||
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# 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/.
|
||||
|
||||
JAR_MANIFESTS += ['jar.mn']
|
|
@ -23,8 +23,6 @@ XPCOMUtils.defineLazyModuleGetter(this, "CharsetMenu",
|
|||
"resource://gre/modules/CharsetMenu.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils",
|
||||
"resource://gre/modules/PrivateBrowsingUtils.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "ContextualIdentityService",
|
||||
"resource://gre/modules/ContextualIdentityService.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "CharsetBundle", function() {
|
||||
const kCharsetBundle = "chrome://global/locale/charsetMenu.properties";
|
||||
|
@ -839,89 +837,6 @@ const CustomizableWidgets = [
|
|||
let win = aEvent.view;
|
||||
win.MailIntegration.sendLinkForBrowser(win.gBrowser.selectedBrowser)
|
||||
}
|
||||
}, {
|
||||
id: "containers-panelmenu",
|
||||
type: "view",
|
||||
viewId: "PanelUI-containers",
|
||||
hasObserver: false,
|
||||
onCreated: function(aNode) {
|
||||
let doc = aNode.ownerDocument;
|
||||
let win = doc.defaultView;
|
||||
let items = doc.getElementById("PanelUI-containersItems");
|
||||
|
||||
let onItemCommand = function (aEvent) {
|
||||
let item = aEvent.target;
|
||||
if (item.hasAttribute("usercontextid")) {
|
||||
let userContextId = parseInt(item.getAttribute("usercontextid"));
|
||||
win.openUILinkIn(win.BROWSER_NEW_TAB_URL, "tab", {userContextId});
|
||||
}
|
||||
};
|
||||
items.addEventListener("command", onItemCommand);
|
||||
|
||||
if (PrivateBrowsingUtils.isWindowPrivate(win)) {
|
||||
aNode.setAttribute("disabled", "true");
|
||||
}
|
||||
|
||||
this.updateVisibility(aNode);
|
||||
|
||||
if (!this.hasObserver) {
|
||||
Services.prefs.addObserver("privacy.userContext.enabled", this, true);
|
||||
this.hasObserver = true;
|
||||
}
|
||||
},
|
||||
onViewShowing: function(aEvent) {
|
||||
let doc = aEvent.target.ownerDocument;
|
||||
|
||||
let items = doc.getElementById("PanelUI-containersItems");
|
||||
|
||||
while (items.firstChild) {
|
||||
items.firstChild.remove();
|
||||
}
|
||||
|
||||
let fragment = doc.createDocumentFragment();
|
||||
let bundle = doc.getElementById("bundle_browser");
|
||||
|
||||
ContextualIdentityService.getIdentities().forEach(identity => {
|
||||
let label = ContextualIdentityService.getUserContextLabel(identity.userContextId);
|
||||
|
||||
let item = doc.createElementNS(kNSXUL, "toolbarbutton");
|
||||
item.setAttribute("label", label);
|
||||
item.setAttribute("usercontextid", identity.userContextId);
|
||||
item.setAttribute("class", "subviewbutton");
|
||||
item.setAttribute("data-identity-color", identity.color);
|
||||
item.setAttribute("data-identity-icon", identity.icon);
|
||||
|
||||
fragment.appendChild(item);
|
||||
});
|
||||
|
||||
fragment.appendChild(doc.createElementNS(kNSXUL, "menuseparator"));
|
||||
|
||||
let item = doc.createElementNS(kNSXUL, "toolbarbutton");
|
||||
item.setAttribute("label", bundle.getString("userContext.aboutPage.label"));
|
||||
item.setAttribute("command", "Browser:OpenAboutContainers");
|
||||
item.setAttribute("class", "subviewbutton");
|
||||
fragment.appendChild(item);
|
||||
|
||||
items.appendChild(fragment);
|
||||
},
|
||||
|
||||
updateVisibility(aNode) {
|
||||
aNode.hidden = !Services.prefs.getBoolPref("privacy.userContext.enabled");
|
||||
},
|
||||
|
||||
observe(aSubject, aTopic, aData) {
|
||||
let {instances} = CustomizableUI.getWidget("containers-panelmenu");
|
||||
for (let {node} of instances) {
|
||||
if (node) {
|
||||
this.updateVisibility(node);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
QueryInterface: XPCOMUtils.generateQI([
|
||||
Ci.nsISupportsWeakReference,
|
||||
Ci.nsIObserver
|
||||
]),
|
||||
}];
|
||||
|
||||
let preferencesButton = {
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
|
||||
DIRS += [
|
||||
'about',
|
||||
'contextualidentity',
|
||||
'customizableui',
|
||||
'dirprovider',
|
||||
'downloads',
|
||||
|
|
|
@ -1,176 +0,0 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* 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/Services.jsm");
|
||||
Components.utils.import("resource://gre/modules/ContextualIdentityService.jsm");
|
||||
|
||||
const containersBundle = Services.strings.createBundle("chrome://browser/locale/preferences/containers.properties");
|
||||
|
||||
const HTMLNS = "http://www.w3.org/1999/xhtml";
|
||||
|
||||
let gContainersManager = {
|
||||
icons: [
|
||||
"fingerprint",
|
||||
"briefcase",
|
||||
"dollar",
|
||||
"cart",
|
||||
"circle"
|
||||
],
|
||||
|
||||
colors: [
|
||||
"blue",
|
||||
"turquoise",
|
||||
"green",
|
||||
"yellow",
|
||||
"orange",
|
||||
"red",
|
||||
"pink",
|
||||
"purple"
|
||||
],
|
||||
|
||||
onLoad() {
|
||||
let params = window.arguments[0] || {};
|
||||
this.init(params);
|
||||
},
|
||||
|
||||
init(aParams) {
|
||||
this.userContextId = aParams.userContextId || null;
|
||||
this.identity = aParams.identity;
|
||||
|
||||
if (aParams.windowTitle) {
|
||||
document.title = aParams.windowTitle;
|
||||
}
|
||||
|
||||
const iconWrapper = document.getElementById("iconWrapper");
|
||||
iconWrapper.appendChild(this.createIconButtons());
|
||||
|
||||
const colorWrapper = document.getElementById("colorWrapper");
|
||||
colorWrapper.appendChild(this.createColorSwatches());
|
||||
|
||||
if (this.identity.name) {
|
||||
const name = document.getElementById("name");
|
||||
name.value = this.identity.name;
|
||||
this.checkForm();
|
||||
}
|
||||
|
||||
this.setLabelsMinWidth();
|
||||
|
||||
// This is to prevent layout jank caused by the svgs and outlines rendering at different times
|
||||
document.getElementById("containers-content").removeAttribute("hidden");
|
||||
},
|
||||
|
||||
setLabelsMinWidth() {
|
||||
const labelMinWidth = containersBundle.GetStringFromName("containers.labelMinWidth");
|
||||
const labels = [
|
||||
document.getElementById("nameLabel"),
|
||||
document.getElementById("iconLabel"),
|
||||
document.getElementById("colorLabel")
|
||||
];
|
||||
for (let label of labels) {
|
||||
label.style.minWidth = labelMinWidth;
|
||||
}
|
||||
},
|
||||
|
||||
uninit() {
|
||||
},
|
||||
|
||||
// Check if name string as to if the form can be submitted
|
||||
checkForm() {
|
||||
const name = document.getElementById("name");
|
||||
let btnApplyChanges = document.getElementById("btnApplyChanges");
|
||||
if (!name.value) {
|
||||
btnApplyChanges.setAttribute("disabled", true);
|
||||
} else {
|
||||
btnApplyChanges.removeAttribute("disabled");
|
||||
}
|
||||
},
|
||||
|
||||
createIconButtons(defaultIcon) {
|
||||
let radiogroup = document.createElement("radiogroup");
|
||||
radiogroup.setAttribute("id", "icon");
|
||||
radiogroup.className = "icon-buttons";
|
||||
|
||||
for (let icon of this.icons) {
|
||||
let iconSwatch = document.createElement("radio");
|
||||
iconSwatch.id = "iconbutton-" + icon;
|
||||
iconSwatch.name = "icon";
|
||||
iconSwatch.type = "radio";
|
||||
iconSwatch.value = icon;
|
||||
|
||||
if (this.identity.icon && this.identity.icon == icon) {
|
||||
iconSwatch.setAttribute("selected", true);
|
||||
}
|
||||
|
||||
iconSwatch.setAttribute("label",
|
||||
containersBundle.GetStringFromName(`containers.${icon}.label`));
|
||||
let iconElement = document.createElement("hbox");
|
||||
iconElement.className = 'userContext-icon';
|
||||
iconElement.setAttribute("data-identity-icon", icon);
|
||||
|
||||
iconSwatch.appendChild(iconElement);
|
||||
radiogroup.appendChild(iconSwatch);
|
||||
}
|
||||
|
||||
return radiogroup;
|
||||
},
|
||||
|
||||
createColorSwatches(defaultColor) {
|
||||
let radiogroup = document.createElement("radiogroup");
|
||||
radiogroup.setAttribute("id", "color");
|
||||
|
||||
for (let color of this.colors) {
|
||||
let colorSwatch = document.createElement("radio");
|
||||
colorSwatch.id = "colorswatch-" + color;
|
||||
colorSwatch.name = "color";
|
||||
colorSwatch.type = "radio";
|
||||
colorSwatch.value = color;
|
||||
|
||||
if (this.identity.color && this.identity.color == color) {
|
||||
colorSwatch.setAttribute("selected", true);
|
||||
}
|
||||
|
||||
colorSwatch.setAttribute("label",
|
||||
containersBundle.GetStringFromName(`containers.${color}.label`));
|
||||
let iconElement = document.createElement("hbox");
|
||||
iconElement.className = 'userContext-icon';
|
||||
iconElement.setAttribute("data-identity-icon", "circle");
|
||||
iconElement.setAttribute("data-identity-color", color);
|
||||
|
||||
colorSwatch.appendChild(iconElement);
|
||||
radiogroup.appendChild(colorSwatch);
|
||||
}
|
||||
return radiogroup;
|
||||
},
|
||||
|
||||
onApplyChanges() {
|
||||
let icon = document.getElementById("icon").value;
|
||||
let color = document.getElementById("color").value;
|
||||
let name = document.getElementById("name").value;
|
||||
|
||||
if (this.icons.indexOf(icon) == -1) {
|
||||
throw "Internal error. The icon value doesn't match.";
|
||||
}
|
||||
|
||||
if (this.colors.indexOf(color) == -1) {
|
||||
throw "Internal error. The color value doesn't match.";
|
||||
}
|
||||
|
||||
if (this.userContextId) {
|
||||
ContextualIdentityService.update(this.userContextId,
|
||||
name,
|
||||
icon,
|
||||
color);
|
||||
} else {
|
||||
ContextualIdentityService.create(name,
|
||||
icon,
|
||||
color);
|
||||
}
|
||||
window.parent.location.reload()
|
||||
},
|
||||
|
||||
onWindowKeyPress(aEvent) {
|
||||
if (aEvent.keyCode == KeyEvent.DOM_VK_ESCAPE)
|
||||
window.close();
|
||||
}
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- 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/. -->
|
||||
|
||||
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://browser/skin/preferences/containers.css" type="text/css"?>
|
||||
|
||||
<!DOCTYPE dialog SYSTEM "chrome://browser/locale/preferences/containers.dtd" >
|
||||
|
||||
<window id="ContainersDialog" class="windowDialog"
|
||||
windowtype="Browser:Permissions"
|
||||
title="&window.title;"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
style="width: &window.width;;"
|
||||
onload="gContainersManager.onLoad();"
|
||||
onunload="gContainersManager.uninit();"
|
||||
persist="screenX screenY width height"
|
||||
onkeypress="gContainersManager.onWindowKeyPress(event);">
|
||||
|
||||
<script src="chrome://global/content/treeUtils.js"/>
|
||||
<script src="chrome://browser/content/preferences/containers.js"/>
|
||||
|
||||
<stringbundle id="bundlePreferences"
|
||||
src="chrome://browser/locale/preferences/preferences.properties"/>
|
||||
|
||||
<keyset>
|
||||
<key key="&windowClose.key;" modifiers="accel" oncommand="window.close();"/>
|
||||
</keyset>
|
||||
|
||||
<vbox class="contentPane largeDialogContainer" flex="1" hidden="true" id="containers-content">
|
||||
<description id="permissionsText" control="url"/>
|
||||
<separator class="thin"/>
|
||||
<hbox align="start">
|
||||
<label id="nameLabel" control="url" value="&name.label;" accesskey="&name.accesskey;"/>
|
||||
<textbox id="name" flex="1" onkeyup="gContainersManager.checkForm();" />
|
||||
</hbox>
|
||||
<hbox align="center" id="iconWrapper">
|
||||
<label id="iconLabel" control="url" value="&icon.label;" accesskey="&icon.accesskey;"/>
|
||||
</hbox>
|
||||
<hbox align="center" id="colorWrapper">
|
||||
<label id="colorLabel" control="url" value="&color.label;" accesskey="&color.accesskey;"/>
|
||||
</hbox>
|
||||
</vbox>
|
||||
<vbox>
|
||||
<hbox class="actionButtons" align="right" flex="1">
|
||||
<button id="btnApplyChanges" disabled="true" oncommand="gContainersManager.onApplyChanges();" icon="save"
|
||||
label="&button.ok.label;" accesskey="&button.ok.accesskey;"/>
|
||||
</hbox>
|
||||
</vbox>
|
||||
</window>
|
|
@ -7,12 +7,8 @@ const nsICookie = Components.interfaces.nsICookie;
|
|||
|
||||
Components.utils.import("resource://gre/modules/AppConstants.jsm");
|
||||
Components.utils.import("resource://gre/modules/PluralForm.jsm");
|
||||
Components.utils.import("resource://gre/modules/Services.jsm")
|
||||
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "ContextualIdentityService",
|
||||
"resource://gre/modules/ContextualIdentityService.jsm");
|
||||
|
||||
var gCookiesWindow = {
|
||||
_cm : Components.classes["@mozilla.org/cookiemanager;1"]
|
||||
.getService(Components.interfaces.nsICookieManager),
|
||||
|
@ -38,10 +34,6 @@ var gCookiesWindow = {
|
|||
this._populateList(true);
|
||||
|
||||
document.getElementById("filter").focus();
|
||||
|
||||
if (!Services.prefs.getBoolPref("privacy.userContext.enabled")) {
|
||||
document.getElementById("userContextRow").hidden = true;
|
||||
}
|
||||
},
|
||||
|
||||
uninit: function () {
|
||||
|
@ -82,24 +74,11 @@ var gCookiesWindow = {
|
|||
aCookieB.originAttributes);
|
||||
},
|
||||
|
||||
_isPrivateCookie: function (aCookie) {
|
||||
let { userContextId } = aCookie.originAttributes;
|
||||
if (!userContextId) {
|
||||
// Default identity is public.
|
||||
return false;
|
||||
}
|
||||
return !ContextualIdentityService.getIdentityFromId(userContextId).public;
|
||||
},
|
||||
|
||||
observe: function (aCookie, aTopic, aData) {
|
||||
if (aTopic != "cookie-changed")
|
||||
return;
|
||||
|
||||
if (aCookie instanceof Components.interfaces.nsICookie) {
|
||||
if (this._isPrivateCookie(aCookie)) {
|
||||
return;
|
||||
}
|
||||
|
||||
var strippedHost = this._makeStrippedHost(aCookie.host);
|
||||
if (aData == "changed")
|
||||
this._handleCookieChanged(aCookie, strippedHost);
|
||||
|
@ -498,9 +477,6 @@ var gCookiesWindow = {
|
|||
while (e.hasMoreElements()) {
|
||||
var cookie = e.getNext();
|
||||
if (cookie && cookie instanceof Components.interfaces.nsICookie) {
|
||||
if (this._isPrivateCookie(cookie)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
var strippedHost = this._makeStrippedHost(cookie.host);
|
||||
this._addCookie(strippedHost, cookie, hostCount);
|
||||
|
@ -524,17 +500,9 @@ var gCookiesWindow = {
|
|||
return this._bundle.getString("expireAtEndOfSession");
|
||||
},
|
||||
|
||||
_getUserContextString: function(aUserContextId) {
|
||||
if (parseInt(aUserContextId) == 0) {
|
||||
return this._bundle.getString("defaultUserContextLabel");
|
||||
}
|
||||
|
||||
return ContextualIdentityService.getUserContextLabel(aUserContextId);
|
||||
},
|
||||
|
||||
_updateCookieData: function (aItem) {
|
||||
var seln = this._view.selection;
|
||||
var ids = ["name", "value", "host", "path", "isSecure", "expires", "userContext"];
|
||||
var ids = ["name", "value", "host", "path", "isSecure", "expires"];
|
||||
var properties;
|
||||
|
||||
if (aItem && !aItem.container && seln.count > 0) {
|
||||
|
@ -543,8 +511,7 @@ var gCookiesWindow = {
|
|||
isDomain: aItem.isDomain ? this._bundle.getString("domainColon")
|
||||
: this._bundle.getString("hostColon"),
|
||||
isSecure: aItem.isSecure ? this._bundle.getString("forSecureOnly")
|
||||
: this._bundle.getString("forAnyConnection"),
|
||||
userContext: this._getUserContextString(aItem.originAttributes.userContextId) };
|
||||
: this._bundle.getString("forAnyConnection") };
|
||||
for (let id of ids) {
|
||||
document.getElementById(id).disabled = false;
|
||||
}
|
||||
|
@ -553,7 +520,7 @@ var gCookiesWindow = {
|
|||
var noneSelected = this._bundle.getString("noCookieSelected");
|
||||
properties = { name: noneSelected, value: noneSelected, host: noneSelected,
|
||||
path: noneSelected, expires: noneSelected,
|
||||
isSecure: noneSelected, userContext: noneSelected };
|
||||
isSecure: noneSelected };
|
||||
for (let id of ids) {
|
||||
document.getElementById(id).disabled = true;
|
||||
}
|
||||
|
|
|
@ -85,10 +85,6 @@
|
|||
<hbox pack="end"><label id="expiresLabel" control="expires" value="&props.expires.label;"/></hbox>
|
||||
<textbox id="expires" readonly="true" class="plain"/>
|
||||
</row>
|
||||
<row align="center" id="userContextRow">
|
||||
<hbox pack="end"><label id="userContextLabel" control="userContext" value="&props.container.label;"/></hbox>
|
||||
<textbox id="userContext" readonly="true" class="plain"/>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
</hbox>
|
||||
|
|
|
@ -10,10 +10,6 @@
|
|||
-moz-binding: url("chrome://browser/content/preferences/handlers.xml#handler-selected");
|
||||
}
|
||||
|
||||
#containersView > richlistitem {
|
||||
-moz-binding: url("chrome://browser/content/preferences/handlers.xml#container");
|
||||
}
|
||||
|
||||
/**
|
||||
* Make the icons appear.
|
||||
* Note: we display the icon box for every item whether or not it has an icon
|
||||
|
|
|
@ -69,29 +69,6 @@
|
|||
|
||||
</binding>
|
||||
|
||||
<binding id="container">
|
||||
<content>
|
||||
<xul:hbox flex="1" equalsize="always">
|
||||
<xul:hbox flex="1" align="center">
|
||||
<xul:hbox xbl:inherits="data-identity-icon=containerIcon,data-identity-color=containerColor" height="24" width="24" class="userContext-icon"/>
|
||||
<xul:label flex="1" crop="end" xbl:inherits="value=containerName"/>
|
||||
</xul:hbox>
|
||||
<xul:hbox flex="1" align="right">
|
||||
<xul:button anonid="preferencesButton"
|
||||
xbl:inherits="value=userContextId"
|
||||
onclick="gContainersPane.onPeferenceClick(event.originalTarget)">
|
||||
Preferences
|
||||
</xul:button>
|
||||
<xul:button anonid="removeButton"
|
||||
xbl:inherits="value=userContextId"
|
||||
onclick="gContainersPane.onRemoveClick(event.originalTarget)">
|
||||
Remove
|
||||
</xul:button>
|
||||
</xul:hbox>
|
||||
</xul:hbox>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="offlineapp"
|
||||
extends="chrome://global/content/bindings/listbox.xml#listitem">
|
||||
<content>
|
||||
|
|
|
@ -1,73 +0,0 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* 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/AppConstants.jsm");
|
||||
Components.utils.import("resource://gre/modules/ContextualIdentityService.jsm");
|
||||
|
||||
const containersBundle = Services.strings.createBundle("chrome://browser/locale/preferences/containers.properties");
|
||||
|
||||
const defaultContainerIcon = "fingerprint";
|
||||
const defaultContainerColor = "blue";
|
||||
|
||||
let gContainersPane = {
|
||||
|
||||
init() {
|
||||
this._list = document.getElementById("containersView");
|
||||
|
||||
document.getElementById("backContainersLink").addEventListener("click", function () {
|
||||
gotoPref("privacy");
|
||||
});
|
||||
|
||||
this._rebuildView();
|
||||
},
|
||||
|
||||
_rebuildView() {
|
||||
const containers = ContextualIdentityService.getIdentities();
|
||||
while (this._list.firstChild) {
|
||||
this._list.firstChild.remove();
|
||||
}
|
||||
for (let container of containers) {
|
||||
let item = document.createElement("richlistitem");
|
||||
item.setAttribute("containerName", ContextualIdentityService.getUserContextLabel(container.userContextId));
|
||||
item.setAttribute("containerIcon", container.icon);
|
||||
item.setAttribute("containerColor", container.color);
|
||||
item.setAttribute("userContextId", container.userContextId);
|
||||
|
||||
this._list.appendChild(item);
|
||||
}
|
||||
},
|
||||
|
||||
onRemoveClick(button) {
|
||||
let userContextId = button.getAttribute("value");
|
||||
ContextualIdentityService.remove(userContextId);
|
||||
this._rebuildView();
|
||||
},
|
||||
onPeferenceClick(button) {
|
||||
this.openPreferenceDialog(button.getAttribute("value"));
|
||||
},
|
||||
|
||||
onAddButtonClick(button) {
|
||||
this.openPreferenceDialog(null);
|
||||
},
|
||||
|
||||
openPreferenceDialog(userContextId) {
|
||||
let identity = {
|
||||
name: "",
|
||||
icon: defaultContainerIcon,
|
||||
color: defaultContainerColor
|
||||
};
|
||||
let title;
|
||||
if (userContextId) {
|
||||
identity = ContextualIdentityService.getIdentityFromId(userContextId);
|
||||
// This is required to get the translation string from defaults
|
||||
identity.name = ContextualIdentityService.getUserContextLabel(identity.userContextId);
|
||||
title = containersBundle.formatStringFromName("containers.updateContainerTitle", [identity.name], 1);
|
||||
}
|
||||
|
||||
const params = { userContextId, identity, windowTitle: title };
|
||||
gSubDialog.open("chrome://browser/content/preferences/containers.xul",
|
||||
null, params);
|
||||
}
|
||||
|
||||
};
|
|
@ -1,54 +0,0 @@
|
|||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# 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/.
|
||||
|
||||
<!-- Containers panel -->
|
||||
|
||||
<script type="application/javascript"
|
||||
src="chrome://browser/content/preferences/in-content/containers.js"/>
|
||||
|
||||
<preferences id="containerPreferences" hidden="true" data-category="paneContainer">
|
||||
<!-- Containers -->
|
||||
<preference id="privacy.userContext.enabled"
|
||||
name="privacy.userContext.enabled"
|
||||
type="bool"/>
|
||||
|
||||
</preferences>
|
||||
|
||||
<hbox hidden="true"
|
||||
class="container-header-links"
|
||||
data-category="paneContainers">
|
||||
<label class="text-link" id="backContainersLink" value="&backLink.label;" />
|
||||
</hbox>
|
||||
|
||||
<hbox id="header-containers"
|
||||
class="header"
|
||||
hidden="true"
|
||||
data-category="paneContainers">
|
||||
<label class="header-name" flex="1">&paneContainers.title;</label>
|
||||
<button class="help-button"
|
||||
aria-label="&helpButton.label;"/>
|
||||
</hbox>
|
||||
|
||||
<!-- Containers -->
|
||||
<groupbox id="browserContainersGroup" data-category="paneContainers" hidden="true">
|
||||
<vbox id="browserContainersbox">
|
||||
|
||||
<richlistbox id="containersView" orient="vertical" persist="lastSelectedType"
|
||||
flex="1">
|
||||
<listheader equalsize="always">
|
||||
<treecol id="typeColumn" label="&label.label;" value="type"
|
||||
persist="sortDirection"
|
||||
flex="1" sortDirection="ascending"/>
|
||||
<treecol id="actionColumn" value="action"
|
||||
persist="sortDirection"
|
||||
flex="1"/>
|
||||
</listheader>
|
||||
</richlistbox>
|
||||
</vbox>
|
||||
<vbox>
|
||||
<hbox flex="1">
|
||||
<button onclick="gContainersPane.onAddButtonClick();" accesskey="&addButton.accesskey;" label="&addButton.label;"/>
|
||||
</hbox>
|
||||
</vbox>
|
||||
</groupbox>
|
|
@ -9,7 +9,6 @@ browser.jar:
|
|||
|
||||
content/browser/preferences/in-content/main.js
|
||||
* content/browser/preferences/in-content/privacy.js
|
||||
content/browser/preferences/in-content/containers.js
|
||||
content/browser/preferences/in-content/advanced.js
|
||||
content/browser/preferences/in-content/applications.js
|
||||
* content/browser/preferences/in-content/content.js
|
||||
|
|
|
@ -61,7 +61,6 @@ function init_all() {
|
|||
register_module("paneGeneral", gMainPane);
|
||||
register_module("paneSearch", gSearchPane);
|
||||
register_module("panePrivacy", gPrivacyPane);
|
||||
register_module("paneContainers", gContainersPane);
|
||||
register_module("paneAdvanced", gAdvancedPane);
|
||||
register_module("paneApplications", gApplicationsPane);
|
||||
register_module("paneContent", gContentPane);
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
href="chrome://browser/content/preferences/handlers.css"?>
|
||||
<?xml-stylesheet href="chrome://browser/skin/preferences/applications.css"?>
|
||||
<?xml-stylesheet href="chrome://browser/skin/preferences/in-content/search.css"?>
|
||||
<?xml-stylesheet href="chrome://browser/skin/preferences/in-content/containers.css"?>
|
||||
|
||||
<!DOCTYPE page [
|
||||
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
|
||||
|
@ -29,8 +28,6 @@
|
|||
#endif
|
||||
<!ENTITY % securityDTD SYSTEM
|
||||
"chrome://browser/locale/preferences/security.dtd">
|
||||
<!ENTITY % containersDTD SYSTEM
|
||||
"chrome://browser/locale/preferences/containers.dtd">
|
||||
<!ENTITY % sanitizeDTD SYSTEM "chrome://browser/locale/sanitize.dtd">
|
||||
<!ENTITY % mainDTD SYSTEM "chrome://browser/locale/preferences/main.dtd">
|
||||
<!ENTITY % aboutHomeDTD SYSTEM "chrome://browser/locale/aboutHome.dtd">
|
||||
|
@ -50,7 +47,6 @@
|
|||
%syncDTD;
|
||||
#endif
|
||||
%securityDTD;
|
||||
%containersDTD;
|
||||
%sanitizeDTD;
|
||||
%mainDTD;
|
||||
%aboutHomeDTD;
|
||||
|
@ -138,12 +134,6 @@
|
|||
<label class="category-name" flex="1">&panePrivacy.title;</label>
|
||||
</richlistitem>
|
||||
|
||||
<richlistitem id="category-containers"
|
||||
class="category"
|
||||
value="paneContainers"
|
||||
helpTopic="prefs-containers"
|
||||
hidden="true"/>
|
||||
|
||||
<richlistitem id="category-security"
|
||||
class="category"
|
||||
value="paneSecurity"
|
||||
|
@ -189,7 +179,6 @@
|
|||
#include main.xul
|
||||
#include search.xul
|
||||
#include privacy.xul
|
||||
#include containers.xul
|
||||
#include advanced.xul
|
||||
#include applications.xul
|
||||
#include content.xul
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
Components.utils.import("resource://gre/modules/AppConstants.jsm");
|
||||
Components.utils.import("resource://gre/modules/PluralForm.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "ContextualIdentityService",
|
||||
"resource://gre/modules/ContextualIdentityService.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "PluralForm",
|
||||
"resource://gre/modules/PluralForm.jsm");
|
||||
|
||||
|
@ -61,59 +59,6 @@ var gPrivacyPane = {
|
|||
.getService(Components.interfaces.mozIPlacesAutoComplete);
|
||||
},
|
||||
|
||||
/**
|
||||
* Show the Containers UI depending on the privacy.userContext.ui.enabled pref.
|
||||
*/
|
||||
_initBrowserContainers: function () {
|
||||
if (!Services.prefs.getBoolPref("privacy.userContext.ui.enabled")) {
|
||||
return;
|
||||
}
|
||||
|
||||
let link = document.getElementById("browserContainersLearnMore");
|
||||
link.href = Services.urlFormatter.formatURLPref("app.support.baseURL") + "containers";
|
||||
|
||||
document.getElementById("browserContainersbox").hidden = false;
|
||||
|
||||
document.getElementById("browserContainersCheckbox").checked =
|
||||
Services.prefs.getBoolPref("privacy.userContext.enabled");
|
||||
},
|
||||
|
||||
_checkBrowserContainers: function(event) {
|
||||
let checkbox = document.getElementById("browserContainersCheckbox");
|
||||
if (checkbox.checked) {
|
||||
Services.prefs.setBoolPref("privacy.userContext.enabled", true);
|
||||
return;
|
||||
}
|
||||
|
||||
let count = ContextualIdentityService.countContainerTabs();
|
||||
if (count == 0) {
|
||||
Services.prefs.setBoolPref("privacy.userContext.enabled", false);
|
||||
return;
|
||||
}
|
||||
|
||||
let bundlePreferences = document.getElementById("bundlePreferences");
|
||||
|
||||
let title = bundlePreferences.getString("disableContainersAlertTitle");
|
||||
let message = PluralForm.get(count, bundlePreferences.getString("disableContainersMsg"))
|
||||
.replace("#S", count)
|
||||
let okButton = PluralForm.get(count, bundlePreferences.getString("disableContainersOkButton"))
|
||||
.replace("#S", count)
|
||||
let cancelButton = bundlePreferences.getString("disableContainersButton2");
|
||||
|
||||
let buttonFlags = (Ci.nsIPrompt.BUTTON_TITLE_IS_STRING * Ci.nsIPrompt.BUTTON_POS_0) +
|
||||
(Ci.nsIPrompt.BUTTON_TITLE_IS_STRING * Ci.nsIPrompt.BUTTON_POS_1);
|
||||
|
||||
let rv = Services.prompt.confirmEx(window, title, message, buttonFlags,
|
||||
okButton, cancelButton, null, null, {});
|
||||
if (rv == 0) {
|
||||
ContextualIdentityService.closeAllContainerTabs();
|
||||
Services.prefs.setBoolPref("privacy.userContext.enabled", false);
|
||||
return;
|
||||
}
|
||||
|
||||
checkbox.checked = true;
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets up the UI for the number of days of history to keep, and updates the
|
||||
* label of the "Clear Now..." button.
|
||||
|
@ -136,7 +81,6 @@ var gPrivacyPane = {
|
|||
this._initTrackingProtectionPBM();
|
||||
#endif
|
||||
this._initAutocomplete();
|
||||
this._initBrowserContainers();
|
||||
|
||||
setEventListener("privacy.sanitize.sanitizeOnShutdown", "change",
|
||||
gPrivacyPane._updateSanitizeSettingsButton);
|
||||
|
@ -184,10 +128,6 @@ var gPrivacyPane = {
|
|||
setEventListener("changeBlockListPBM", "command",
|
||||
gPrivacyPane.showBlockLists);
|
||||
#endif
|
||||
setEventListener("browserContainersCheckbox", "command",
|
||||
gPrivacyPane._checkBrowserContainers);
|
||||
setEventListener("browserContainersSettings", "command",
|
||||
gPrivacyPane.showContainerSettings);
|
||||
},
|
||||
|
||||
#ifdef MOZ_SAFE_BROWSING
|
||||
|
@ -489,13 +429,6 @@ var gPrivacyPane = {
|
|||
},
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Displays container panel for customising and adding containers.
|
||||
*/
|
||||
showContainerSettings() {
|
||||
gotoPref("containers");
|
||||
},
|
||||
|
||||
#ifdef MOZ_SAFE_BROWSING
|
||||
/**
|
||||
* Displays the available block lists for tracking protection.
|
||||
|
@ -702,25 +635,4 @@ var gPrivacyPane = {
|
|||
|
||||
settingsButton.disabled = !sanitizeOnShutdownPref.value;
|
||||
},
|
||||
|
||||
// CONTAINERS
|
||||
|
||||
/*
|
||||
* preferences:
|
||||
*
|
||||
* privacy.userContext.enabled
|
||||
* - true if containers is enabled
|
||||
*/
|
||||
|
||||
/**
|
||||
* Enables/disables the Settings button used to configure containers
|
||||
*/
|
||||
readBrowserContainersCheckbox: function ()
|
||||
{
|
||||
var pref = document.getElementById("privacy.userContext.enabled");
|
||||
var settings = document.getElementById("browserContainersSettings");
|
||||
|
||||
settings.disabled = !pref.value;
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
@ -302,28 +302,3 @@
|
|||
&suggestionSettings.label;
|
||||
</label>
|
||||
</groupbox>
|
||||
|
||||
<!-- Containers -->
|
||||
<groupbox id="browserContainersGroup" data-category="panePrivacy" hidden="true">
|
||||
<vbox id="browserContainersbox" hidden="true">
|
||||
<caption><label>&browserContainersHeader.label;
|
||||
<label id="browserContainersLearnMore" class="text-link"
|
||||
value="&browserContainersLearnMore.label;"/>
|
||||
</label></caption>
|
||||
<hbox align="start">
|
||||
<vbox>
|
||||
<checkbox id="browserContainersCheckbox"
|
||||
label="&browserContainersEnabled.label;"
|
||||
accesskey="&browserContainersEnabled.accesskey;"
|
||||
preference="privacy.userContext.enabled"
|
||||
onsyncfrompreference="return gPrivacyPane.readBrowserContainersCheckbox();"/>
|
||||
</vbox>
|
||||
<spacer flex="1"/>
|
||||
<vbox>
|
||||
<button id="browserContainersSettings"
|
||||
label="&browserContainersSettings.label;"
|
||||
accesskey="&browserContainersSettings.accesskey;"/>
|
||||
</vbox>
|
||||
</hbox>
|
||||
</vbox>
|
||||
</groupbox>
|
||||
|
|
|
@ -24,8 +24,6 @@ browser.jar:
|
|||
* content/browser/preferences/languages.xul
|
||||
content/browser/preferences/languages.js
|
||||
content/browser/preferences/permissions.xul
|
||||
content/browser/preferences/containers.xul
|
||||
content/browser/preferences/containers.js
|
||||
content/browser/preferences/permissions.js
|
||||
content/browser/preferences/sanitize.xul
|
||||
content/browser/preferences/sanitize.js
|
||||
|
|
|
@ -208,10 +208,6 @@ ContentRestoreInternal.prototype = {
|
|||
? Utils.deserializePrincipal(loadArguments.triggeringPrincipal)
|
||||
: null;
|
||||
|
||||
if (loadArguments.userContextId) {
|
||||
webNavigation.setOriginAttributesBeforeLoading({ userContextId: loadArguments.userContextId });
|
||||
}
|
||||
|
||||
webNavigation.loadURIWithOptions(loadArguments.uri, loadArguments.flags,
|
||||
referrer, referrerPolicy, postData,
|
||||
null, null, triggeringPrincipal);
|
||||
|
|
|
@ -64,11 +64,10 @@ var SessionHistoryInternal = {
|
|||
* The docShell that owns the session history.
|
||||
*/
|
||||
collect: function (docShell) {
|
||||
let loadContext = docShell.QueryInterface(Ci.nsILoadContext);
|
||||
let webNavigation = docShell.QueryInterface(Ci.nsIWebNavigation);
|
||||
let history = webNavigation.sessionHistory.QueryInterface(Ci.nsISHistoryInternal);
|
||||
|
||||
let data = {entries: [], userContextId: loadContext.originAttributes.userContextId };
|
||||
let data = {entries: []};
|
||||
|
||||
if (history && history.count > 0) {
|
||||
// Loop over the transaction linked list directly so we can get the
|
||||
|
|
|
@ -2204,10 +2204,9 @@ var SessionStoreInternal = {
|
|||
}
|
||||
|
||||
// Create a new tab.
|
||||
let userContextId = aTab.getAttribute("usercontextid");
|
||||
let newTab = aTab == aWindow.gBrowser.selectedTab ?
|
||||
aWindow.gBrowser.addTab(null, {relatedToCurrent: true, ownerTab: aTab, userContextId}) :
|
||||
aWindow.gBrowser.addTab(null, {userContextId});
|
||||
aWindow.gBrowser.addTab(null, {relatedToCurrent: true, ownerTab: aTab}) :
|
||||
aWindow.gBrowser.addTab();
|
||||
|
||||
// Set tab title to "Connecting..." and start the throbber to pretend we're
|
||||
// doing something while actually waiting for data from the frame script.
|
||||
|
@ -2296,7 +2295,7 @@ var SessionStoreInternal = {
|
|||
|
||||
// create a new tab
|
||||
let tabbrowser = aWindow.gBrowser;
|
||||
let tab = tabbrowser.selectedTab = tabbrowser.addTab(null, state);
|
||||
let tab = tabbrowser.selectedTab = tabbrowser.addTab();
|
||||
|
||||
// restore tab content
|
||||
this.restoreTab(tab, state);
|
||||
|
@ -3100,31 +3099,13 @@ var SessionStoreInternal = {
|
|||
let numVisibleTabs = 0;
|
||||
|
||||
for (var t = 0; t < newTabCount; t++) {
|
||||
// When trying to restore into existing tab, we also take the userContextId
|
||||
// into account if present.
|
||||
let userContextId = winData.tabs[t].userContextId;
|
||||
let reuseExisting = t < openTabCount &&
|
||||
(tabbrowser.tabs[t].getAttribute("usercontextid") == (userContextId || ""));
|
||||
// If the tab is pinned, then we'll be loading it right away, and
|
||||
// there's no need to cause a remoteness flip by loading it initially
|
||||
// non-remote.
|
||||
let forceNotRemote = !winData.tabs[t].pinned;
|
||||
let tab = reuseExisting ? tabbrowser.tabs[t] :
|
||||
tabbrowser.addTab("about:blank",
|
||||
{skipAnimation: true,
|
||||
forceNotRemote,
|
||||
userContextId,
|
||||
skipBackgroundNotify: true});
|
||||
|
||||
// If we inserted a new tab because the userContextId didn't match with the
|
||||
// open tab, even though `t < openTabCount`, we need to remove that open tab
|
||||
// and put the newly added tab in its place.
|
||||
if (!reuseExisting && t < openTabCount) {
|
||||
tabbrowser.removeTab(tabbrowser.tabs[t]);
|
||||
tabbrowser.moveTabTo(tab, t);
|
||||
}
|
||||
|
||||
tabs.push(tab);
|
||||
tabs.push(t < openTabCount ?
|
||||
tabbrowser.tabs[t] :
|
||||
tabbrowser.addTab("about:blank", {
|
||||
skipAnimation: true,
|
||||
forceNotRemote: true,
|
||||
skipBackgroundNotify: true
|
||||
}));
|
||||
|
||||
if (winData.tabs[t].pinned)
|
||||
tabbrowser.pinTab(tabs[t]);
|
||||
|
@ -3531,9 +3512,6 @@ var SessionStoreInternal = {
|
|||
let uri = activePageData ? activePageData.url || null : null;
|
||||
if (aLoadArguments) {
|
||||
uri = aLoadArguments.uri;
|
||||
if (aLoadArguments.userContextId) {
|
||||
browser.setAttribute("usercontextid", aLoadArguments.userContextId);
|
||||
}
|
||||
}
|
||||
|
||||
// We have to mark this tab as restoring first, otherwise
|
||||
|
|
|
@ -181,10 +181,6 @@ var TabStateInternal = {
|
|||
if (key === "history") {
|
||||
tabData.entries = value.entries;
|
||||
|
||||
if (value.hasOwnProperty("userContextId")) {
|
||||
tabData.userContextId = value.userContextId;
|
||||
}
|
||||
|
||||
if (value.hasOwnProperty("index")) {
|
||||
tabData.index = value.index;
|
||||
}
|
||||
|
|
|
@ -638,37 +638,6 @@ e10s.accessibilityNotice.acceptButton.accesskey = O
|
|||
e10s.accessibilityNotice.enableAndRestart.label = Enable (Requires Restart)
|
||||
e10s.accessibilityNotice.enableAndRestart.accesskey = E
|
||||
|
||||
# LOCALIZATION NOTE (userContextPersonal.label,
|
||||
# userContextWork.label,
|
||||
# userContextShopping.label,
|
||||
# userContextBanking.label,
|
||||
# userContextNone.label):
|
||||
# These strings specify the four predefined contexts included in support of the
|
||||
# Contextual Identity / Containers project. Each context is meant to represent
|
||||
# the context that the user is in when interacting with the site. Different
|
||||
# contexts will store cookies and other information from those sites in
|
||||
# different, isolated locations. You can enable the feature by typing
|
||||
# about:config in the URL bar and changing privacy.userContext.enabled to true.
|
||||
# Once enabled, you can open a new tab in a specific context by clicking
|
||||
# File > New Container Tab > (1 of 4 contexts). Once opened, you will see these
|
||||
# strings on the right-hand side of the URL bar.
|
||||
userContextPersonal.label = Personal
|
||||
userContextWork.label = Work
|
||||
userContextBanking.label = Banking
|
||||
userContextShopping.label = Shopping
|
||||
userContextNone.label = No Container
|
||||
|
||||
userContextPersonal.accesskey = P
|
||||
userContextWork.accesskey = W
|
||||
userContextBanking.accesskey = B
|
||||
userContextShopping.accesskey = S
|
||||
userContextNone.accesskey = N
|
||||
|
||||
userContext.aboutPage.label = Manage containers
|
||||
userContext.aboutPage.accesskey = O
|
||||
|
||||
userContextOpenLink.label = Open Link in New %S Tab
|
||||
|
||||
muteTab.label = Mute Tab
|
||||
muteTab.accesskey = M
|
||||
unmuteTab.label = Unmute Tab
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- 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/. -->
|
||||
|
||||
<!ENTITY label.label "Name">
|
||||
<!ENTITY addButton.label "Add New Container">
|
||||
<!ENTITY addButton.accesskey "A">
|
||||
<!-- « is « however it's not defined in XML -->
|
||||
<!ENTITY backLink.label "« Go Back to Privacy">
|
||||
|
||||
<!ENTITY window.title "Add New Container">
|
||||
<!ENTITY window.width "45em">
|
||||
|
||||
<!ENTITY name.label "Name:">
|
||||
<!ENTITY name.accesskey "N">
|
||||
<!ENTITY icon.label "Icon:">
|
||||
<!ENTITY icon.accesskey "I">
|
||||
<!ENTITY color.label "Color:">
|
||||
<!ENTITY color.accesskey "o">
|
||||
<!ENTITY windowClose.key "w">
|
||||
|
||||
<!ENTITY button.ok.label "Done">
|
||||
<!ENTITY button.ok.accesskey "D">
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# 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/.
|
||||
|
||||
containers.removeButton = Remove
|
||||
containers.preferencesButton = Preferences
|
||||
containers.colorHeading = Color:
|
||||
containers.labelMinWidth = 4rem
|
||||
containers.nameLabel = Name:
|
||||
containers.namePlaceholder = Enter a container name
|
||||
containers.submitButton = Done
|
||||
containers.iconHeading = Icon:
|
||||
containers.updateContainerTitle = %S Container Preferences
|
||||
|
||||
containers.blue.label = Blue
|
||||
containers.turquoise.label = Turquoise
|
||||
containers.green.label = Green
|
||||
containers.yellow.label = Yellow
|
||||
containers.orange.label = Orange
|
||||
containers.red.label = Red
|
||||
containers.pink.label = Pink
|
||||
containers.purple.label = Purple
|
||||
|
||||
containers.fingerprint.label = Fingerprint
|
||||
containers.briefcase.label = Briefcase
|
||||
# LOCALIZATION NOTE (containers.dollar.label)
|
||||
# String represents a money sign but currently uses a dollar sign so don't change to local currency
|
||||
# See Bug 1291672
|
||||
containers.dollar.label = Dollar sign
|
||||
containers.cart.label = Shopping cart
|
||||
containers.circle.label = Dot
|
|
@ -14,7 +14,6 @@
|
|||
<!ENTITY props.path.label "Path:">
|
||||
<!ENTITY props.secure.label "Send For:">
|
||||
<!ENTITY props.expires.label "Expires:">
|
||||
<!ENTITY props.container.label "Container:">
|
||||
|
||||
<!ENTITY window.title "Cookies">
|
||||
<!ENTITY windowClose.key "w">
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
<!ENTITY paneContent.title "Content">
|
||||
<!ENTITY paneApplications.title "Applications">
|
||||
<!ENTITY panePrivacy.title "Privacy">
|
||||
<!ENTITY paneContainers.title "Container Tabs">
|
||||
<!ENTITY paneSecurity.title "Security">
|
||||
<!ENTITY paneAdvanced.title "Advanced">
|
||||
|
||||
|
|
|
@ -191,17 +191,3 @@ revertNoRestartButton=Revert
|
|||
|
||||
restartNow=Restart Now
|
||||
restartLater=Restart Later
|
||||
|
||||
disableContainersAlertTitle=Close All Container Tabs?
|
||||
|
||||
# LOCALIZATION NOTE (disableContainersMsg): Semi-colon list of plural forms.
|
||||
# See: http://developer.mozilla.org/en/docs/Localization_and_Plurals
|
||||
# #S is the number of container tabs
|
||||
disableContainersMsg=If you disable Container Tabs now, #S container tab will be closed. Are you sure you want to disable Container Tabs?;If you disable Container Tabs now, #S container tabs will be closed. Are you sure you want to disable Container Tabs?
|
||||
|
||||
# LOCALIZATION NOTE (disableContainersOkButton): Semi-colon list of plural forms.
|
||||
# See: http://developer.mozilla.org/en/docs/Localization_and_Plurals
|
||||
# #S is the number of container tabs
|
||||
disableContainersOkButton=Close #S Container Tab;Close #S Container Tabs
|
||||
|
||||
disableContainersButton2=Keep enabled
|
||||
|
|
|
@ -110,10 +110,3 @@
|
|||
|
||||
<!ENTITY clearOnCloseSettings.label "Settings…">
|
||||
<!ENTITY clearOnCloseSettings.accesskey "t">
|
||||
|
||||
<!ENTITY browserContainersHeader.label "Container Tabs">
|
||||
<!ENTITY browserContainersLearnMore.label "Learn more">
|
||||
<!ENTITY browserContainersEnabled.label "Enable Container Tabs">
|
||||
<!ENTITY browserContainersEnabled.accesskey "n">
|
||||
<!ENTITY browserContainersSettings.label "Settings…">
|
||||
<!ENTITY browserContainersSettings.accesskey "i">
|
||||
|
|
|
@ -78,10 +78,8 @@
|
|||
locale/browser/preferences/permissions.dtd (%chrome/browser/preferences/permissions.dtd)
|
||||
locale/browser/preferences/preferences.dtd (%chrome/browser/preferences/preferences.dtd)
|
||||
locale/browser/preferences/preferences.properties (%chrome/browser/preferences/preferences.properties)
|
||||
locale/browser/preferences/containers.properties (%chrome/browser/preferences/containers.properties)
|
||||
* locale/browser/preferences/privacy.dtd (%chrome/browser/preferences/privacy.dtd)
|
||||
locale/browser/preferences/security.dtd (%chrome/browser/preferences/security.dtd)
|
||||
locale/browser/preferences/containers.dtd (%chrome/browser/preferences/containers.dtd)
|
||||
locale/browser/preferences/sync.dtd (%chrome/browser/preferences/sync.dtd)
|
||||
locale/browser/preferences/tabs.dtd (%chrome/browser/preferences/tabs.dtd)
|
||||
locale/browser/preferences/search.dtd (%chrome/browser/preferences/search.dtd)
|
||||
|
|
|
@ -88,11 +88,6 @@ var ContentClick = {
|
|||
triggeringPrincipal: json.triggeringPrincipal,
|
||||
};
|
||||
|
||||
// The new tab/window must use the same userContextId.
|
||||
if (json.originAttributes.userContextId) {
|
||||
params.userContextId = json.originAttributes.userContextId;
|
||||
}
|
||||
|
||||
window.openLinkIn(json.href, where, params);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
/* Source Code Form is subject to the terms of the Mozilla Public
|
||||
* 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/. */
|
||||
|
||||
%include ../../../components/contextualidentity/content/usercontext.css
|
||||
|
||||
.container-header-links {
|
||||
margin-block-end: 15px;
|
||||
}
|
||||
|
||||
[data-identity-icon] {
|
||||
margin: 0;
|
||||
margin-inline-end: 16px;
|
||||
}
|
||||
|
||||
#containersView {
|
||||
border: 0 none;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
#containersView richlistitem {
|
||||
margin: 0px;
|
||||
margin-inline-end: 8px;
|
||||
padding: 0;
|
||||
padding-block-end: 8px;
|
||||
border-block-end: 1px solid var(--in-content-header-border-color);
|
||||
}
|
||||
|
||||
#containersView richlistitem:last-of-type {
|
||||
border-block-end: 0 none;
|
||||
margin-block-end: 8px;
|
||||
}
|
|
@ -237,8 +237,7 @@ treecol {
|
|||
/* Privacy pane */
|
||||
|
||||
#trackingProtectionPBMLearnMore,
|
||||
#trackingProtectionLearnMore,
|
||||
#browserContainersLearnMore {
|
||||
#trackingProtectionLearnMore {
|
||||
margin-inline-start: 1.5em !important;
|
||||
margin-top: 0;
|
||||
font-weight: normal;
|
||||
|
|
|
@ -73,8 +73,6 @@
|
|||
skin/classic/browser/preferences/in-content/favicon.ico (../shared/incontentprefs/favicon.ico)
|
||||
skin/classic/browser/preferences/in-content/icons.svg (../shared/incontentprefs/icons.svg)
|
||||
skin/classic/browser/preferences/in-content/search.css (../shared/incontentprefs/search.css)
|
||||
* skin/classic/browser/preferences/in-content/containers.css (../shared/incontentprefs/containers.css)
|
||||
* skin/classic/browser/preferences/containers.css (../shared/preferences/containers.css)
|
||||
skin/classic/browser/fxa/default-avatar.svg (../shared/fxa/default-avatar.svg)
|
||||
skin/classic/browser/fxa/logo.png (../shared/fxa/logo.png)
|
||||
skin/classic/browser/fxa/logo@2x.png (../shared/fxa/logo@2x.png)
|
||||
|
|
|
@ -1,53 +0,0 @@
|
|||
/* Source Code Form is subject to the terms of the Mozilla Public
|
||||
* 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/. */
|
||||
|
||||
%include ../../../components/contextualidentity/content/usercontext.css
|
||||
|
||||
:root {
|
||||
--preference-selected-color: #0996f8;
|
||||
--preference-unselected-color: #333;
|
||||
--preference-active-color: #858585;
|
||||
}
|
||||
|
||||
radiogroup {
|
||||
display: flex;
|
||||
margin-inline-start: 0.35rem;
|
||||
}
|
||||
|
||||
radio {
|
||||
flex: auto;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
-moz-user-select: none;
|
||||
outline: 2px solid transparent;
|
||||
outline-offset: 4px;
|
||||
-moz-outline-radius: 100%;
|
||||
min-block-size: 24px;
|
||||
min-inline-size: 24px;
|
||||
border-radius: 50%;
|
||||
padding: 2px;
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
.icon-buttons > radio > [data-identity-icon] {
|
||||
fill: #4d4d4d;
|
||||
}
|
||||
|
||||
radio > [data-identity-icon] {
|
||||
inline-size: 22px;
|
||||
block-size: 22px;
|
||||
}
|
||||
|
||||
radio[selected=true] {
|
||||
outline-color: var(--preference-unselected-color);
|
||||
}
|
||||
|
||||
radio[focused=true] {
|
||||
outline-color: var(--preference-selected-color);
|
||||
}
|
||||
|
||||
radio:hover:active {
|
||||
outline-color: var(--preference-active-color);
|
||||
}
|
|
@ -1089,8 +1089,6 @@ pref("browser.pagethumbnails.capturing_disabled", false);
|
|||
// enables showing basic placeholders for missing thumbnails
|
||||
pref("browser.newtabpage.thumbnailPlaceholder", false);
|
||||
|
||||
pref("privacy.usercontext.about_newtab_segregation.enabled", false);
|
||||
|
||||
// number of columns of newtab grid
|
||||
pref("browser.newtabpage.columns", 4);
|
||||
|
||||
|
|
|
@ -1089,8 +1089,6 @@ pref("browser.pagethumbnails.capturing_disabled", false);
|
|||
// enables showing basic placeholders for missing thumbnails
|
||||
pref("browser.newtabpage.thumbnailPlaceholder", false);
|
||||
|
||||
pref("privacy.usercontext.about_newtab_segregation.enabled", false);
|
||||
|
||||
// number of columns of newtab grid
|
||||
pref("browser.newtabpage.columns", 4);
|
||||
|
||||
|
|
|
@ -5338,9 +5338,6 @@ function handleDroppedLink(event, urlOrLinks, name)
|
|||
|
||||
let lastLocationChange = gBrowser.selectedBrowser.lastLocationChange;
|
||||
|
||||
let userContextId = gBrowser.selectedBrowser
|
||||
.getAttribute("usercontextid") || 0;
|
||||
|
||||
let inBackground = Services.prefs.getBoolPref("browser.tabs.loadInBackground");
|
||||
if (event.shiftKey)
|
||||
inBackground = !inBackground;
|
||||
|
@ -5359,7 +5356,6 @@ function handleDroppedLink(event, urlOrLinks, name)
|
|||
replace: true,
|
||||
allowThirdPartyFixup: false,
|
||||
postDatas,
|
||||
userContextId,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
@ -139,7 +139,6 @@ var handleContentContextMenu = function (event) {
|
|||
let selectionInfo = BrowserUtils.getSelectionDetails(content);
|
||||
|
||||
let loadContext = docShell.QueryInterface(Ci.nsILoadContext);
|
||||
let userContextId = loadContext.originAttributes.userContextId;
|
||||
|
||||
let browser = docShell.chromeEventHandler;
|
||||
let mainWin = browser.ownerGlobal;
|
||||
|
@ -160,7 +159,6 @@ var handleContentContextMenu = function (event) {
|
|||
selectionInfo: selectionInfo,
|
||||
loginFillInfo,
|
||||
parentAllowsMixedContent,
|
||||
userContextId,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -737,8 +737,7 @@
|
|||
|
||||
let autocomplete = this.mTabBrowser._placesAutocomplete;
|
||||
if (this.mBrowser.registeredOpenURI) {
|
||||
autocomplete.unregisterOpenPage(this.mBrowser.registeredOpenURI,
|
||||
this.mBrowser.getAttribute("usercontextid") || 0);
|
||||
autocomplete.unregisterOpenPage(this.mBrowser.registeredOpenURI);
|
||||
delete this.mBrowser.registeredOpenURI;
|
||||
}
|
||||
// Tabs in private windows aren't registered as "Open" so
|
||||
|
@ -746,8 +745,7 @@
|
|||
if (!isBlankPageURL(aLocation.spec) &&
|
||||
(!PrivateBrowsingUtils.isWindowPrivate(window) ||
|
||||
PrivateBrowsingUtils.permanentPrivateBrowsing)) {
|
||||
autocomplete.registerOpenPage(aLocation,
|
||||
this.mBrowser.getAttribute("usercontextid") || 0);
|
||||
autocomplete.registerOpenPage(aLocation);
|
||||
this.mBrowser.registeredOpenURI = aLocation;
|
||||
}
|
||||
}
|
||||
|
@ -1383,7 +1381,6 @@
|
|||
let aTargetTab;
|
||||
let aNewIndex = -1;
|
||||
let aPostDatas = [];
|
||||
let aUserContextId;
|
||||
if (arguments.length == 2 &&
|
||||
typeof arguments[1] == "object") {
|
||||
let params = arguments[1];
|
||||
|
@ -1394,7 +1391,6 @@
|
|||
aNewIndex = typeof params.newIndex === "number" ?
|
||||
params.newIndex : aNewIndex;
|
||||
aPostDatas = params.postDatas || aPostDatas;
|
||||
aUserContextId = params.userContextId;
|
||||
}
|
||||
|
||||
if (!aURIs.length)
|
||||
|
@ -1443,8 +1439,7 @@
|
|||
ownerTab: owner,
|
||||
skipAnimation: multiple,
|
||||
allowThirdPartyFixup: aAllowThirdPartyFixup,
|
||||
postData: aPostDatas[0],
|
||||
userContextId: aUserContextId
|
||||
postData: aPostDatas[0]
|
||||
});
|
||||
if (aNewIndex !== -1) {
|
||||
this.moveTabTo(firstTabAdded, aNewIndex);
|
||||
|
@ -1457,8 +1452,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);
|
||||
|
@ -2059,8 +2053,7 @@
|
|||
this.mTabListeners[aTab._tPos].destroy();
|
||||
|
||||
if (browser.registeredOpenURI && !aTabWillBeMoved) {
|
||||
this._placesAutocomplete.unregisterOpenPage(browser.registeredOpenURI,
|
||||
browser.getAttribute("usercontextid") || 0);
|
||||
this._placesAutocomplete.unregisterOpenPage(browser.registeredOpenURI);
|
||||
delete browser.registeredOpenURI;
|
||||
}
|
||||
|
||||
|
@ -2428,8 +2421,7 @@
|
|||
<![CDATA[
|
||||
// If the current URI is registered as open remove it from the list.
|
||||
if (aOurBrowser.registeredOpenURI) {
|
||||
this._placesAutocomplete.unregisterOpenPage(aOurBrowser.registeredOpenURI,
|
||||
aOurBrowser.getAttribute("usercontextid") || 0);
|
||||
this._placesAutocomplete.unregisterOpenPage(aOurBrowser.registeredOpenURI);
|
||||
delete aOurBrowser.registeredOpenURI;
|
||||
}
|
||||
|
||||
|
@ -3339,8 +3331,7 @@
|
|||
for (var i = 0; i < this.mTabListeners.length; ++i) {
|
||||
let browser = this.getBrowserAtIndex(i);
|
||||
if (browser.registeredOpenURI) {
|
||||
this._placesAutocomplete.unregisterOpenPage(browser.registeredOpenURI,
|
||||
browser.getAttribute("usercontextid") || 0);
|
||||
this._placesAutocomplete.unregisterOpenPage(browser.registeredOpenURI);
|
||||
delete browser.registeredOpenURI;
|
||||
}
|
||||
browser.webProgress.removeProgressListener(this.mTabFilters[i]);
|
||||
|
@ -4805,8 +4796,6 @@
|
|||
inBackground = !inBackground;
|
||||
|
||||
let targetTab = this._getDragTargetTab(event);
|
||||
let userContextId = this.selectedItem
|
||||
.getAttribute("usercontextid") || 0;
|
||||
let replace = !(!targetTab || dropEffect == "copy");
|
||||
let newIndex = this._getDropIndex(event);
|
||||
let urls = links.map(link => link.url);
|
||||
|
@ -4816,7 +4805,6 @@
|
|||
allowThirdPartyFixup: true,
|
||||
targetTab,
|
||||
newIndex,
|
||||
userContextId,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -96,11 +96,8 @@ browsers are swapped.
|
|||
Browser attributes `gBrowser.swapBrowsersAndCloseOther` transfers between
|
||||
browsers:
|
||||
|
||||
* `usercontextid`
|
||||
|
||||
Tab attributes `gBrowser.swapBrowsersAndCloseOther` transfers between tabs:
|
||||
|
||||
* `usercontextid`
|
||||
* `muted`
|
||||
* `soundplaying`
|
||||
* `busy`
|
||||
|
|
|
@ -76,11 +76,6 @@ const ResponsiveUIManager = exports.ResponsiveUIManager = {
|
|||
this.showRemoteOnlyNotification(window, tab, options);
|
||||
return promise.reject(new Error("RDM only available for remote tabs."));
|
||||
}
|
||||
// Remove this once we support this case in bug 1306975.
|
||||
if (tab.linkedBrowser.hasAttribute("usercontextid")) {
|
||||
this.showNoContainerTabsNotification(window, tab, options);
|
||||
return promise.reject(new Error("RDM not available for container tabs."));
|
||||
}
|
||||
if (!this.isActiveForTab(tab)) {
|
||||
this.initMenuCheckListenerFor(window);
|
||||
|
||||
|
@ -218,16 +213,7 @@ const ResponsiveUIManager = exports.ResponsiveUIManager = {
|
|||
}
|
||||
}),
|
||||
|
||||
showRemoteOnlyNotification(window, tab, options) {
|
||||
this.showErrorNotification(window, tab, options, getStr("responsive.remoteOnly"));
|
||||
},
|
||||
|
||||
showNoContainerTabsNotification(window, tab, options) {
|
||||
this.showErrorNotification(window, tab, options,
|
||||
getStr("responsive.noContainerTabs"));
|
||||
},
|
||||
|
||||
showErrorNotification(window, tab, { command } = {}, msg) {
|
||||
showRemoteOnlyNotification(window, tab, { command } = {}) {
|
||||
// Default to using the browser's per-tab notification box
|
||||
let nbox = window.gBrowser.getNotificationBox(tab.linkedBrowser);
|
||||
|
||||
|
|
|
@ -77,7 +77,6 @@ support-files =
|
|||
[browser_styleeditor_init.js]
|
||||
[browser_styleeditor_inline_friendly_names.js]
|
||||
[browser_styleeditor_loading.js]
|
||||
[browser_styleeditor_loading_with_containers.js]
|
||||
[browser_styleeditor_media_sidebar.js]
|
||||
[browser_styleeditor_media_sidebar_links.js]
|
||||
skip-if = e10s && debug # Bug 1252201 - Docshell leak on debug e10s
|
||||
|
|
|
@ -1,63 +0,0 @@
|
|||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
// Test that the stylesheets can be loaded correctly with containers
|
||||
// (bug 1282660).
|
||||
|
||||
const TESTCASE_URI = TEST_BASE_HTTP + "simple.html";
|
||||
const EXPECTED_SHEETS = [
|
||||
{
|
||||
sheetIndex: 0,
|
||||
name: /^simple.css$/,
|
||||
rules: 1,
|
||||
active: true
|
||||
}, {
|
||||
sheetIndex: 1,
|
||||
name: /^<.*>$/,
|
||||
rules: 3,
|
||||
active: false
|
||||
}
|
||||
];
|
||||
|
||||
add_task(function* () {
|
||||
// Using the personal container.
|
||||
let userContextId = 1;
|
||||
let { tab } = yield* openTabInUserContext(TESTCASE_URI, userContextId);
|
||||
let { ui } = yield openStyleEditor(tab);
|
||||
|
||||
is(ui.editors.length, 2, "The UI contains two style sheets.");
|
||||
checkSheet(ui.editors[0], EXPECTED_SHEETS[0]);
|
||||
checkSheet(ui.editors[1], EXPECTED_SHEETS[1]);
|
||||
});
|
||||
|
||||
function* openTabInUserContext(uri, userContextId) {
|
||||
// Open the tab in the correct userContextId.
|
||||
let tab = gBrowser.addTab(uri, {userContextId});
|
||||
|
||||
// Select tab and make sure its browser is focused.
|
||||
gBrowser.selectedTab = tab;
|
||||
tab.ownerDocument.defaultView.focus();
|
||||
|
||||
let browser = gBrowser.getBrowserForTab(tab);
|
||||
yield BrowserTestUtils.browserLoaded(browser);
|
||||
return {tab, browser};
|
||||
}
|
||||
|
||||
function checkSheet(editor, expected) {
|
||||
is(editor.styleSheet.styleSheetIndex, expected.sheetIndex,
|
||||
"Style sheet has correct index.");
|
||||
|
||||
let summary = editor.summary;
|
||||
let name = summary.querySelector(".stylesheet-name > label")
|
||||
.getAttribute("value");
|
||||
ok(expected.name.test(name), "The name '" + name + "' is correct.");
|
||||
|
||||
let ruleCount = summary.querySelector(".stylesheet-rule-count").textContent;
|
||||
is(parseInt(ruleCount, 10), expected.rules, "the rule count is correct");
|
||||
|
||||
is(summary.classList.contains("splitview-active"), expected.active,
|
||||
"The active status for this sheet is correct.");
|
||||
}
|
|
@ -657,8 +657,7 @@ stubPackets.set("console.log('foobar', 'test')", {
|
|||
"appId": 0,
|
||||
"firstPartyDomain": "",
|
||||
"inIsolatedMozBrowser": false,
|
||||
"privateBrowsingId": 0,
|
||||
"userContextId": 0
|
||||
"privateBrowsingId": 0
|
||||
},
|
||||
"private": false,
|
||||
"styles": [],
|
||||
|
@ -690,8 +689,7 @@ stubPackets.set("console.log(undefined)", {
|
|||
"appId": 0,
|
||||
"firstPartyDomain": "",
|
||||
"inIsolatedMozBrowser": false,
|
||||
"privateBrowsingId": 0,
|
||||
"userContextId": 0
|
||||
"privateBrowsingId": 0
|
||||
},
|
||||
"private": false,
|
||||
"styles": [],
|
||||
|
@ -721,8 +719,7 @@ stubPackets.set("console.warn('danger, will robinson!')", {
|
|||
"appId": 0,
|
||||
"firstPartyDomain": "",
|
||||
"inIsolatedMozBrowser": false,
|
||||
"privateBrowsingId": 0,
|
||||
"userContextId": 0
|
||||
"privateBrowsingId": 0
|
||||
},
|
||||
"private": false,
|
||||
"styles": [],
|
||||
|
@ -754,8 +751,7 @@ stubPackets.set("console.log(NaN)", {
|
|||
"appId": 0,
|
||||
"firstPartyDomain": "",
|
||||
"inIsolatedMozBrowser": false,
|
||||
"privateBrowsingId": 0,
|
||||
"userContextId": 0
|
||||
"privateBrowsingId": 0
|
||||
},
|
||||
"private": false,
|
||||
"styles": [],
|
||||
|
@ -787,8 +783,7 @@ stubPackets.set("console.log(null)", {
|
|||
"appId": 0,
|
||||
"firstPartyDomain": "",
|
||||
"inIsolatedMozBrowser": false,
|
||||
"privateBrowsingId": 0,
|
||||
"userContextId": 0
|
||||
"privateBrowsingId": 0
|
||||
},
|
||||
"private": false,
|
||||
"styles": [],
|
||||
|
@ -818,8 +813,7 @@ stubPackets.set("console.log('鼬')", {
|
|||
"appId": 0,
|
||||
"firstPartyDomain": "",
|
||||
"inIsolatedMozBrowser": false,
|
||||
"privateBrowsingId": 0,
|
||||
"userContextId": 0
|
||||
"privateBrowsingId": 0
|
||||
},
|
||||
"private": false,
|
||||
"styles": [],
|
||||
|
@ -847,8 +841,7 @@ stubPackets.set("console.clear()", {
|
|||
"appId": 0,
|
||||
"firstPartyDomain": "",
|
||||
"inIsolatedMozBrowser": false,
|
||||
"privateBrowsingId": 0,
|
||||
"userContextId": 0
|
||||
"privateBrowsingId": 0
|
||||
},
|
||||
"private": false,
|
||||
"timeStamp": 1477086275587,
|
||||
|
@ -881,8 +874,7 @@ stubPackets.set("console.count('bar')", {
|
|||
"appId": 0,
|
||||
"firstPartyDomain": "",
|
||||
"inIsolatedMozBrowser": false,
|
||||
"privateBrowsingId": 0,
|
||||
"userContextId": 0
|
||||
"privateBrowsingId": 0
|
||||
},
|
||||
"private": false,
|
||||
"timeStamp": 1477086277812,
|
||||
|
@ -933,8 +925,7 @@ stubPackets.set("console.assert(false, {message: 'foobar'})", {
|
|||
"appId": 0,
|
||||
"firstPartyDomain": "",
|
||||
"inIsolatedMozBrowser": false,
|
||||
"privateBrowsingId": 0,
|
||||
"userContextId": 0
|
||||
"privateBrowsingId": 0
|
||||
},
|
||||
"private": false,
|
||||
"styles": [],
|
||||
|
@ -973,8 +964,7 @@ stubPackets.set("console.log('hello \nfrom \rthe \"string world!')", {
|
|||
"appId": 0,
|
||||
"firstPartyDomain": "",
|
||||
"inIsolatedMozBrowser": false,
|
||||
"privateBrowsingId": 0,
|
||||
"userContextId": 0
|
||||
"privateBrowsingId": 0
|
||||
},
|
||||
"private": false,
|
||||
"styles": [],
|
||||
|
@ -1004,8 +994,7 @@ stubPackets.set("console.log('úṇĩçödê țĕșť')", {
|
|||
"appId": 0,
|
||||
"firstPartyDomain": "",
|
||||
"inIsolatedMozBrowser": false,
|
||||
"privateBrowsingId": 0,
|
||||
"userContextId": 0
|
||||
"privateBrowsingId": 0
|
||||
},
|
||||
"private": false,
|
||||
"styles": [],
|
||||
|
@ -1047,8 +1036,7 @@ stubPackets.set("console.dirxml(window)", {
|
|||
"appId": 0,
|
||||
"firstPartyDomain": "",
|
||||
"inIsolatedMozBrowser": false,
|
||||
"privateBrowsingId": 0,
|
||||
"userContextId": 0
|
||||
"privateBrowsingId": 0
|
||||
},
|
||||
"private": false,
|
||||
"timeStamp": 1477086285483,
|
||||
|
@ -1076,8 +1064,7 @@ stubPackets.set("console.trace()", {
|
|||
"appId": 0,
|
||||
"firstPartyDomain": "",
|
||||
"inIsolatedMozBrowser": false,
|
||||
"privateBrowsingId": 0,
|
||||
"userContextId": 0
|
||||
"privateBrowsingId": 0
|
||||
},
|
||||
"private": false,
|
||||
"timeStamp": 1477086287286,
|
||||
|
@ -1130,8 +1117,7 @@ stubPackets.set("console.time('bar')", {
|
|||
"appId": 0,
|
||||
"firstPartyDomain": "",
|
||||
"inIsolatedMozBrowser": false,
|
||||
"privateBrowsingId": 0,
|
||||
"userContextId": 0
|
||||
"privateBrowsingId": 0
|
||||
},
|
||||
"private": false,
|
||||
"timeStamp": 1477086289137,
|
||||
|
@ -1164,8 +1150,7 @@ stubPackets.set("console.timeEnd('bar')", {
|
|||
"appId": 0,
|
||||
"firstPartyDomain": "",
|
||||
"inIsolatedMozBrowser": false,
|
||||
"privateBrowsingId": 0,
|
||||
"userContextId": 0
|
||||
"privateBrowsingId": 0
|
||||
},
|
||||
"private": false,
|
||||
"timeStamp": 1477086289138,
|
||||
|
@ -1198,8 +1183,7 @@ stubPackets.set("console.table('bar')", {
|
|||
"appId": 0,
|
||||
"firstPartyDomain": "",
|
||||
"inIsolatedMozBrowser": false,
|
||||
"privateBrowsingId": 0,
|
||||
"userContextId": 0
|
||||
"privateBrowsingId": 0
|
||||
},
|
||||
"private": false,
|
||||
"timeStamp": 1477086290984,
|
||||
|
@ -1246,8 +1230,7 @@ stubPackets.set("console.table(['a', 'b', 'c'])", {
|
|||
"appId": 0,
|
||||
"firstPartyDomain": "",
|
||||
"inIsolatedMozBrowser": false,
|
||||
"privateBrowsingId": 0,
|
||||
"userContextId": 0
|
||||
"privateBrowsingId": 0
|
||||
},
|
||||
"private": false,
|
||||
"timeStamp": 1477086292762,
|
||||
|
@ -1277,8 +1260,7 @@ stubPackets.set("console.group('bar')", {
|
|||
"appId": 0,
|
||||
"firstPartyDomain": "",
|
||||
"inIsolatedMozBrowser": false,
|
||||
"privateBrowsingId": 0,
|
||||
"userContextId": 0
|
||||
"privateBrowsingId": 0
|
||||
},
|
||||
"private": false,
|
||||
"timeStamp": 1477086294628,
|
||||
|
@ -1308,8 +1290,7 @@ stubPackets.set("console.groupEnd('bar')", {
|
|||
"appId": 0,
|
||||
"firstPartyDomain": "",
|
||||
"inIsolatedMozBrowser": false,
|
||||
"privateBrowsingId": 0,
|
||||
"userContextId": 0
|
||||
"privateBrowsingId": 0
|
||||
},
|
||||
"private": false,
|
||||
"timeStamp": 1477086294630,
|
||||
|
@ -1339,8 +1320,7 @@ stubPackets.set("console.groupCollapsed('foo')", {
|
|||
"appId": 0,
|
||||
"firstPartyDomain": "",
|
||||
"inIsolatedMozBrowser": false,
|
||||
"privateBrowsingId": 0,
|
||||
"userContextId": 0
|
||||
"privateBrowsingId": 0
|
||||
},
|
||||
"private": false,
|
||||
"timeStamp": 1477086296567,
|
||||
|
@ -1370,8 +1350,7 @@ stubPackets.set("console.groupEnd('foo')", {
|
|||
"appId": 0,
|
||||
"firstPartyDomain": "",
|
||||
"inIsolatedMozBrowser": false,
|
||||
"privateBrowsingId": 0,
|
||||
"userContextId": 0
|
||||
"privateBrowsingId": 0
|
||||
},
|
||||
"private": false,
|
||||
"timeStamp": 1477086296570,
|
||||
|
@ -1399,8 +1378,7 @@ stubPackets.set("console.group()", {
|
|||
"appId": 0,
|
||||
"firstPartyDomain": "",
|
||||
"inIsolatedMozBrowser": false,
|
||||
"privateBrowsingId": 0,
|
||||
"userContextId": 0
|
||||
"privateBrowsingId": 0
|
||||
},
|
||||
"private": false,
|
||||
"timeStamp": 1477086298462,
|
||||
|
@ -1428,8 +1406,7 @@ stubPackets.set("console.groupEnd()", {
|
|||
"appId": 0,
|
||||
"firstPartyDomain": "",
|
||||
"inIsolatedMozBrowser": false,
|
||||
"privateBrowsingId": 0,
|
||||
"userContextId": 0
|
||||
"privateBrowsingId": 0
|
||||
},
|
||||
"private": false,
|
||||
"timeStamp": 1477086298464,
|
||||
|
@ -1460,8 +1437,7 @@ stubPackets.set("console.log(%cfoobar)", {
|
|||
"appId": 0,
|
||||
"firstPartyDomain": "",
|
||||
"inIsolatedMozBrowser": false,
|
||||
"privateBrowsingId": 0,
|
||||
"userContextId": 0
|
||||
"privateBrowsingId": 0
|
||||
},
|
||||
"private": false,
|
||||
"styles": [
|
||||
|
|
|
@ -451,21 +451,10 @@ var StyleSheetActor = protocol.ActorClassWithSpec(styleSheetSpec, {
|
|||
let options = {
|
||||
loadFromCache: true,
|
||||
policy: Ci.nsIContentPolicy.TYPE_INTERNAL_STYLESHEET,
|
||||
window: this.window,
|
||||
charset: this._getCSSCharset()
|
||||
};
|
||||
|
||||
// Bug 1282660 - We use the system principal to load the default internal
|
||||
// stylesheets instead of the content principal since such stylesheets
|
||||
// require system principal to load. At meanwhile, we strip the loadGroup
|
||||
// for preventing the assertion of the userContextId mismatching.
|
||||
// The default internal stylesheets load from the 'resource:' URL.
|
||||
// Bug 1287607, 1291321 - 'chrome' and 'file' protocols should also be handled in the
|
||||
// same way.
|
||||
if (!/^(chrome|file|resource):\/\//.test(this.href)) {
|
||||
options.window = this.window;
|
||||
options.principal = this.document.nodePrincipal;
|
||||
}
|
||||
|
||||
return fetch(this.href, options).then(({ content }) => {
|
||||
this.text = content;
|
||||
return content;
|
||||
|
|
|
@ -124,9 +124,7 @@ function defaultQuery(conditions = "") {
|
|||
h.visit_count, h.typed, h.id, t.open_count, h.frecency
|
||||
FROM moz_places h
|
||||
LEFT JOIN moz_favicons f ON f.id = h.favicon_id
|
||||
LEFT JOIN moz_openpages_temp t
|
||||
ON t.url = h.url
|
||||
AND t.userContextId = :userContextId
|
||||
LEFT JOIN moz_openpages_temp t ON t.url = h.url
|
||||
WHERE h.frecency <> 0
|
||||
AND AUTOCOMPLETE_MATCH(:searchString, h.url,
|
||||
CASE WHEN bookmarked THEN
|
||||
|
@ -150,7 +148,6 @@ const SQL_SWITCHTAB_QUERY =
|
|||
FROM moz_openpages_temp t
|
||||
LEFT JOIN moz_places h ON h.url_hash = hash(t.url) AND h.url = t.url
|
||||
WHERE h.id IS NULL
|
||||
AND t.userContextId = :userContextId
|
||||
AND AUTOCOMPLETE_MATCH(:searchString, t.url, t.url, NULL,
|
||||
NULL, NULL, NULL, t.open_count,
|
||||
:matchBehavior, :searchBehavior)
|
||||
|
@ -170,9 +167,7 @@ const SQL_ADAPTIVE_QUERY =
|
|||
) AS i
|
||||
JOIN moz_places h ON h.id = i.place_id
|
||||
LEFT JOIN moz_favicons f ON f.id = h.favicon_id
|
||||
LEFT JOIN moz_openpages_temp t
|
||||
ON t.url = h.url
|
||||
AND t.userContextId = :userContextId
|
||||
LEFT JOIN moz_openpages_temp t ON t.url = h.url
|
||||
WHERE AUTOCOMPLETE_MATCH(NULL, h.url,
|
||||
IFNULL(btitle, h.title), tags,
|
||||
h.visit_count, h.typed, bookmarked,
|
||||
|
@ -301,17 +296,15 @@ XPCOMUtils.defineLazyServiceGetter(this, "textURIService",
|
|||
XPCOMUtils.defineLazyGetter(this, "SwitchToTabStorage", () => Object.seal({
|
||||
_conn: null,
|
||||
// Temporary queue used while the database connection is not available.
|
||||
_queue: new Map(),
|
||||
_queue: new Set(),
|
||||
initDatabase: Task.async(function* (conn) {
|
||||
// To reduce IO use an in-memory table for switch-to-tab tracking.
|
||||
// Note: this should be kept up-to-date with the definition in
|
||||
// nsPlacesTables.h.
|
||||
yield conn.execute(
|
||||
`CREATE TEMP TABLE moz_openpages_temp (
|
||||
url TEXT,
|
||||
userContextId INTEGER,
|
||||
open_count INTEGER,
|
||||
PRIMARY KEY (url, userContextId)
|
||||
url TEXT PRIMARY KEY,
|
||||
open_count INTEGER
|
||||
)`);
|
||||
|
||||
// Note: this should be kept up-to-date with the definition in
|
||||
|
@ -322,64 +315,44 @@ XPCOMUtils.defineLazyGetter(this, "SwitchToTabStorage", () => Object.seal({
|
|||
WHEN NEW.open_count = 0
|
||||
BEGIN
|
||||
DELETE FROM moz_openpages_temp
|
||||
WHERE url = NEW.url
|
||||
AND userContextId = NEW.userContextId;
|
||||
WHERE url = NEW.url;
|
||||
END`);
|
||||
|
||||
this._conn = conn;
|
||||
|
||||
// Populate the table with the current cache contents...
|
||||
for (let [userContextId, uris] of this._queue) {
|
||||
for (let uri of uris) {
|
||||
this.add(uri, userContextId);
|
||||
}
|
||||
}
|
||||
this._queue.forEach(this.add, this);
|
||||
|
||||
// ...then clear it to avoid double additions.
|
||||
this._queue.clear();
|
||||
}),
|
||||
|
||||
add(uri, userContextId) {
|
||||
add: function (uri) {
|
||||
if (!this._conn) {
|
||||
if (!this._queue.has(userContextId)) {
|
||||
this._queue.set(userContextId, new Set());
|
||||
}
|
||||
this._queue.get(userContextId).add(uri);
|
||||
this._queue.add(uri);
|
||||
return;
|
||||
}
|
||||
this._conn.executeCached(
|
||||
`INSERT OR REPLACE INTO moz_openpages_temp (url, userContextId, open_count)
|
||||
VALUES ( :url,
|
||||
:userContextId,
|
||||
IFNULL( ( SELECT open_count + 1
|
||||
FROM moz_openpages_temp
|
||||
WHERE url = :url
|
||||
AND userContextId = :userContextId ),
|
||||
1
|
||||
)
|
||||
`INSERT OR REPLACE INTO moz_openpages_temp (url, open_count)
|
||||
VALUES ( :url, IFNULL( (SELECT open_count + 1
|
||||
FROM moz_openpages_temp
|
||||
WHERE url = :url),
|
||||
1
|
||||
)
|
||||
)`
|
||||
, { url: uri.spec, userContextId });
|
||||
, { url: uri.spec });
|
||||
},
|
||||
|
||||
delete(uri, userContextId) {
|
||||
delete: function (uri) {
|
||||
if (!this._conn) {
|
||||
// This should not happen.
|
||||
if (!this._queue.has(userContextId)) {
|
||||
throw new Error("Unknown userContextId!");
|
||||
}
|
||||
|
||||
this._queue.get(userContextId).delete(uri);
|
||||
if (this._queue.get(userContextId).size == 0) {
|
||||
this._queue.delete(userContextId);
|
||||
}
|
||||
this._queue.delete(uri);
|
||||
return;
|
||||
}
|
||||
this._conn.executeCached(
|
||||
`UPDATE moz_openpages_temp
|
||||
SET open_count = open_count - 1
|
||||
WHERE url = :url
|
||||
AND userContextId = :userContextId`
|
||||
, { url: uri.spec, userContextId });
|
||||
WHERE url = :url`
|
||||
, { url: uri.spec });
|
||||
},
|
||||
|
||||
shutdown: function () {
|
||||
|
@ -1781,7 +1754,6 @@ Search.prototype = {
|
|||
// We only want to search the tokens that we are left with - not the
|
||||
// original search string.
|
||||
searchString: this._searchTokens.join(" "),
|
||||
userContextId: this._userContextId,
|
||||
// Limit the query to the the maximum number of desired results.
|
||||
// This way we can avoid doing more work than needed.
|
||||
maxResults: Prefs.maxRichResults
|
||||
|
@ -1805,7 +1777,6 @@ Search.prototype = {
|
|||
// We only want to search the tokens that we are left with - not the
|
||||
// original search string.
|
||||
searchString: this._searchTokens.join(" "),
|
||||
userContextId: this._userContextId,
|
||||
maxResults: Prefs.maxRichResults
|
||||
}
|
||||
];
|
||||
|
@ -1825,8 +1796,7 @@ Search.prototype = {
|
|||
search_string: this._searchString,
|
||||
query_type: QUERYTYPE_FILTERED,
|
||||
matchBehavior: this._matchBehavior,
|
||||
searchBehavior: this._behavior,
|
||||
userContextId: this._userContextId,
|
||||
searchBehavior: this._behavior
|
||||
}
|
||||
];
|
||||
},
|
||||
|
@ -2010,12 +1980,12 @@ UnifiedComplete.prototype = {
|
|||
|
||||
// mozIPlacesAutoComplete
|
||||
|
||||
registerOpenPage(uri, userContextId) {
|
||||
SwitchToTabStorage.add(uri, userContextId);
|
||||
registerOpenPage: function PAC_registerOpenPage(uri) {
|
||||
SwitchToTabStorage.add(uri);
|
||||
},
|
||||
|
||||
unregisterOpenPage(uri, userContextId) {
|
||||
SwitchToTabStorage.delete(uri, userContextId);
|
||||
unregisterOpenPage: function PAC_unregisterOpenPage(uri) {
|
||||
SwitchToTabStorage.delete(uri);
|
||||
},
|
||||
|
||||
// nsIAutoCompleteSearch
|
||||
|
|
|
@ -116,10 +116,8 @@ interface mozIPlacesAutoComplete : nsISupports
|
|||
*
|
||||
* @param aURI
|
||||
* The URI to register as an open page.
|
||||
* @param aUserContextId
|
||||
* The Container Id of the tab.
|
||||
*/
|
||||
void registerOpenPage(in nsIURI aURI, in uint32_t aUserContextId);
|
||||
void registerOpenPage(in nsIURI aURI);
|
||||
|
||||
/**
|
||||
* Mark a page as no longer being open (either by closing the window or tab,
|
||||
|
@ -131,8 +129,6 @@ interface mozIPlacesAutoComplete : nsISupports
|
|||
*
|
||||
* @param aURI
|
||||
* The URI to unregister as an open page.
|
||||
* @param aUserContextId
|
||||
* The Container Id of the tab.
|
||||
*/
|
||||
void unregisterOpenPage(in nsIURI aURI, in uint32_t aUserContextId);
|
||||
void unregisterOpenPage(in nsIURI aURI);
|
||||
};
|
||||
|
|
|
@ -133,10 +133,8 @@
|
|||
// nsPlacesAutoComplete.js.
|
||||
#define CREATE_MOZ_OPENPAGES_TEMP NS_LITERAL_CSTRING( \
|
||||
"CREATE TEMP TABLE moz_openpages_temp (" \
|
||||
" url TEXT" \
|
||||
", userContextId INTEGER" \
|
||||
" url TEXT PRIMARY KEY" \
|
||||
", open_count INTEGER" \
|
||||
", PRIMARY KEY (url, userContextId)" \
|
||||
")" \
|
||||
)
|
||||
|
||||
|
|
|
@ -192,8 +192,7 @@
|
|||
"WHEN NEW.open_count = 0 " \
|
||||
"BEGIN " \
|
||||
"DELETE FROM moz_openpages_temp " \
|
||||
"WHERE url = NEW.url " \
|
||||
"AND userContextId = NEW.userContextId;" \
|
||||
"WHERE url = NEW.url;" \
|
||||
"END" \
|
||||
)
|
||||
|
||||
|
|
|
@ -286,19 +286,19 @@ var addBookmark = Task.async(function* (aBookmarkObj) {
|
|||
}
|
||||
});
|
||||
|
||||
function addOpenPages(aUri, aCount=1, aUserContextId=0) {
|
||||
function addOpenPages(aUri, aCount=1) {
|
||||
let ac = Cc["@mozilla.org/autocomplete/search;1?name=unifiedcomplete"]
|
||||
.getService(Ci.mozIPlacesAutoComplete);
|
||||
for (let i = 0; i < aCount; i++) {
|
||||
ac.registerOpenPage(aUri, aUserContextId);
|
||||
ac.registerOpenPage(aUri);
|
||||
}
|
||||
}
|
||||
|
||||
function removeOpenPages(aUri, aCount=1, aUserContextId=0) {
|
||||
function removeOpenPages(aUri, aCount=1) {
|
||||
let ac = Cc["@mozilla.org/autocomplete/search;1?name=unifiedcomplete"]
|
||||
.getService(Ci.mozIPlacesAutoComplete);
|
||||
for (let i = 0; i < aCount; i++) {
|
||||
ac.unregisterOpenPage(aUri, aUserContextId);
|
||||
ac.unregisterOpenPage(aUri);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,11 +11,9 @@ add_task(function* test_tab_matches() {
|
|||
let uri2 = NetUtil.newURI("http://xyz.net/");
|
||||
let uri3 = NetUtil.newURI("about:mozilla");
|
||||
let uri4 = NetUtil.newURI("data:text/html,test");
|
||||
let uri5 = NetUtil.newURI("http://foobar.org");
|
||||
yield PlacesTestUtils.addVisits([
|
||||
{ uri: uri1, title: "ABC rocks" },
|
||||
{ uri: uri2, title: "xyz.net - we're better than ABC" },
|
||||
{ uri: uri5, title: "foobar.org - much better than ABC, definitely better than XYZ" }
|
||||
{ uri: uri2, title: "xyz.net - we're better than ABC" }
|
||||
]);
|
||||
addOpenPages(uri1, 1);
|
||||
// Pages that cannot be registered in history.
|
||||
|
@ -37,8 +35,7 @@ add_task(function* test_tab_matches() {
|
|||
searchParam: "enable-actions",
|
||||
matches: [ makeSearchMatch("abc", { heuristic: true }),
|
||||
makeSwitchToTabMatch("http://abc.com/", { title: "ABC rocks" }),
|
||||
{ uri: uri2, title: "xyz.net - we're better than ABC", style: [ "favicon" ] },
|
||||
{ uri: uri5, title: "foobar.org - much better than ABC, definitely better than XYZ", style: [ "favicon" ] } ]
|
||||
{ uri: uri2, title: "xyz.net - we're better than ABC", style: [ "favicon" ] } ]
|
||||
});
|
||||
|
||||
do_print("three results, both normal results are tab matches");
|
||||
|
@ -48,39 +45,7 @@ add_task(function* test_tab_matches() {
|
|||
searchParam: "enable-actions",
|
||||
matches: [ makeSearchMatch("abc", { heuristic: true }),
|
||||
makeSwitchToTabMatch("http://abc.com/", { title: "ABC rocks" }),
|
||||
makeSwitchToTabMatch("http://xyz.net/", { title: "xyz.net - we're better than ABC" }),
|
||||
{ uri: uri5, title: "foobar.org - much better than ABC, definitely better than XYZ", style: [ "favicon" ] } ]
|
||||
});
|
||||
|
||||
do_print("a container tab is not visible in 'switch to tab'");
|
||||
addOpenPages(uri5, 1, /* userContextId: */ 3);
|
||||
yield check_autocomplete({
|
||||
search: "abc",
|
||||
searchParam: "enable-actions",
|
||||
matches: [ makeSearchMatch("abc", { heuristic: true }),
|
||||
makeSwitchToTabMatch("http://abc.com/", { title: "ABC rocks" }),
|
||||
makeSwitchToTabMatch("http://xyz.net/", { title: "xyz.net - we're better than ABC" }),
|
||||
{ uri: uri5, title: "foobar.org - much better than ABC, definitely better than XYZ", style: [ "favicon" ] } ]
|
||||
});
|
||||
|
||||
do_print("a container tab should not see 'switch to tab' for other container tabs");
|
||||
yield check_autocomplete({
|
||||
search: "abc",
|
||||
searchParam: "enable-actions user-context-id:3",
|
||||
matches: [ makeSearchMatch("abc", { heuristic: true }),
|
||||
makeSwitchToTabMatch("http://foobar.org/", { title: "foobar.org - much better than ABC, definitely better than XYZ" }),
|
||||
{ uri: uri1, title: "ABC rocks", style: [ "favicon" ] },
|
||||
{ uri: uri2, title: "xyz.net - we're better than ABC", style: [ "favicon" ] } ]
|
||||
});
|
||||
|
||||
do_print("a different container tab should not see any 'switch to tab'");
|
||||
yield check_autocomplete({
|
||||
search: "abc",
|
||||
searchParam: "enable-actions user-context-id:2",
|
||||
matches: [ makeSearchMatch("abc", { heuristic: true }),
|
||||
{ uri: uri1, title: "ABC rocks", style: [ "favicon" ] },
|
||||
{ uri: uri2, title: "xyz.net - we're better than ABC", style: [ "favicon" ] },
|
||||
{ uri: uri5, title: "foobar.org - much better than ABC, definitely better than XYZ", style: [ "favicon" ] } ]
|
||||
makeSwitchToTabMatch("http://xyz.net/", { title: "xyz.net - we're better than ABC" }) ]
|
||||
});
|
||||
|
||||
do_print("three results, both normal results are tab matches, one has multiple tabs");
|
||||
|
@ -90,8 +55,7 @@ add_task(function* test_tab_matches() {
|
|||
searchParam: "enable-actions",
|
||||
matches: [ makeSearchMatch("abc", { heuristic: true }),
|
||||
makeSwitchToTabMatch("http://abc.com/", { title: "ABC rocks" }),
|
||||
makeSwitchToTabMatch("http://xyz.net/", { title: "xyz.net - we're better than ABC" }),
|
||||
{ uri: uri5, title: "foobar.org - much better than ABC, definitely better than XYZ", style: [ "favicon" ] } ]
|
||||
makeSwitchToTabMatch("http://xyz.net/", { title: "xyz.net - we're better than ABC" }) ]
|
||||
});
|
||||
|
||||
do_print("three results, no tab matches (disable-private-actions)");
|
||||
|
@ -100,8 +64,7 @@ add_task(function* test_tab_matches() {
|
|||
searchParam: "enable-actions disable-private-actions",
|
||||
matches: [ makeSearchMatch("abc", { heuristic: true }),
|
||||
{ uri: uri1, title: "ABC rocks", style: [ "favicon" ] },
|
||||
{ uri: uri2, title: "xyz.net - we're better than ABC", style: [ "favicon" ] },
|
||||
{ uri: uri5, title: "foobar.org - much better than ABC, definitely better than XYZ", style: [ "favicon" ] } ]
|
||||
{ uri: uri2, title: "xyz.net - we're better than ABC", style: [ "favicon" ] } ]
|
||||
});
|
||||
|
||||
do_print("two results (actions disabled)");
|
||||
|
@ -109,8 +72,7 @@ add_task(function* test_tab_matches() {
|
|||
search: "abc",
|
||||
searchParam: "",
|
||||
matches: [ { uri: uri1, title: "ABC rocks", style: [ "favicon" ] },
|
||||
{ uri: uri2, title: "xyz.net - we're better than ABC", style: [ "favicon" ] },
|
||||
{ uri: uri5, title: "foobar.org - much better than ABC, definitely better than XYZ", style: [ "favicon" ] } ]
|
||||
{ uri: uri2, title: "xyz.net - we're better than ABC", style: [ "favicon" ] } ]
|
||||
});
|
||||
|
||||
do_print("three results, no tab matches");
|
||||
|
@ -121,8 +83,7 @@ add_task(function* test_tab_matches() {
|
|||
searchParam: "enable-actions",
|
||||
matches: [ makeSearchMatch("abc", { heuristic: true }),
|
||||
{ uri: uri1, title: "ABC rocks", style: [ "favicon" ] },
|
||||
{ uri: uri2, title: "xyz.net - we're better than ABC", style: [ "favicon" ] },
|
||||
{ uri: uri5, title: "foobar.org - much better than ABC, definitely better than XYZ", style: [ "favicon" ] } ]
|
||||
{ uri: uri2, title: "xyz.net - we're better than ABC", style: [ "favicon" ] } ]
|
||||
});
|
||||
|
||||
do_print("tab match search with restriction character");
|
||||
|
|
|
@ -15,8 +15,6 @@ const TELEMETRY_HISTOGRAM_ID_PREFIX = "FX_THUMBNAILS_BG_";
|
|||
const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||
const HTML_NS = "http://www.w3.org/1999/xhtml";
|
||||
|
||||
const ABOUT_NEWTAB_SEGREGATION_PREF = "privacy.usercontext.about_newtab_segregation.enabled";
|
||||
|
||||
const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
|
||||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm", this);
|
||||
|
@ -37,8 +35,6 @@ XPCOMUtils.defineConstant(this, "TEL_CAPTURE_DONE_TIMEOUT", TEL_CAPTURE_DONE_TIM
|
|||
XPCOMUtils.defineConstant(this, "TEL_CAPTURE_DONE_CRASHED", TEL_CAPTURE_DONE_CRASHED);
|
||||
XPCOMUtils.defineConstant(this, "TEL_CAPTURE_DONE_BAD_URI", TEL_CAPTURE_DONE_BAD_URI);
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "ContextualIdentityService",
|
||||
"resource://gre/modules/ContextualIdentityService.jsm");
|
||||
const global = this;
|
||||
|
||||
// contains base64 version of a placeholder thumbnail
|
||||
|
@ -138,14 +134,6 @@ const BackgroundPageThumbs = {
|
|||
return url;
|
||||
}),
|
||||
|
||||
/**
|
||||
* Tell the service that the thumbnail browser should be recreated at next
|
||||
* call of _ensureBrowser().
|
||||
*/
|
||||
renewThumbnailBrowser: function() {
|
||||
this._renewThumbBrowser = true;
|
||||
},
|
||||
|
||||
/**
|
||||
* Ensures that initialization of the thumbnail browser's parent window has
|
||||
* begun.
|
||||
|
@ -201,12 +189,9 @@ const BackgroundPageThumbs = {
|
|||
* Creates the thumbnail browser if it doesn't already exist.
|
||||
*/
|
||||
_ensureBrowser: function () {
|
||||
if (this._thumbBrowser && !this._renewThumbBrowser)
|
||||
if (this._thumbBrowser)
|
||||
return;
|
||||
|
||||
this._destroyBrowser();
|
||||
this._renewThumbBrowser = false;
|
||||
|
||||
let browser = this._parentWin.document.createElementNS(XUL_NS, "browser");
|
||||
browser.setAttribute("type", "content");
|
||||
browser.setAttribute("disableglobalhistory", "true");
|
||||
|
@ -216,13 +201,6 @@ const BackgroundPageThumbs = {
|
|||
browser.setAttribute("remote", "true");
|
||||
}
|
||||
|
||||
if (Services.prefs.getBoolPref(ABOUT_NEWTAB_SEGREGATION_PREF)) {
|
||||
// Use the private container for thumbnails.
|
||||
let privateIdentity =
|
||||
ContextualIdentityService.getPrivateIdentity("userContextIdInternal.thumbnail");
|
||||
browser.setAttribute("usercontextid", privateIdentity.userContextId);
|
||||
}
|
||||
|
||||
// Size the browser. Make its aspect ratio the same as the canvases' that
|
||||
// the thumbnails are drawn into; the canvases' aspect ratio is the same as
|
||||
// the screen's, so use that. Aim for a size in the ballpark of 1024x768.
|
||||
|
@ -325,14 +303,6 @@ const BackgroundPageThumbs = {
|
|||
_destroyBrowserTimeout: DESTROY_BROWSER_TIMEOUT,
|
||||
};
|
||||
|
||||
Services.prefs.addObserver(ABOUT_NEWTAB_SEGREGATION_PREF,
|
||||
function(aSubject, aTopic, aData) {
|
||||
if (aTopic == "nsPref:changed" && aData == ABOUT_NEWTAB_SEGREGATION_PREF) {
|
||||
BackgroundPageThumbs.renewThumbnailBrowser();
|
||||
}
|
||||
},
|
||||
false);
|
||||
|
||||
Object.defineProperty(this, "BackgroundPageThumbs", {
|
||||
value: BackgroundPageThumbs,
|
||||
enumerable: true,
|
||||
|
@ -467,14 +437,6 @@ Capture.prototype = {
|
|||
Cu.reportError(err);
|
||||
}
|
||||
}
|
||||
|
||||
if (Services.prefs.getBoolPref(ABOUT_NEWTAB_SEGREGATION_PREF)) {
|
||||
// Clear the data in the private container for thumbnails.
|
||||
let privateIdentity =
|
||||
ContextualIdentityService.getPrivateIdentity("userContextIdInternal.thumbnail");
|
||||
Services.obs.notifyObservers(null, "clear-origin-attributes-data",
|
||||
JSON.stringify({ userContextId: privateIdentity.userContextId }));
|
||||
}
|
||||
};
|
||||
|
||||
if (!data) {
|
||||
|
|
Loading…
Reference in New Issue