Merge remote-tracking branch 'origin/master' into custom

This commit is contained in:
Roy Tam 2019-03-29 22:29:22 +08:00
commit 583edc6020
98 changed files with 458 additions and 2348 deletions

View file

@ -1293,17 +1293,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

View file

@ -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;"

View file

@ -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;"

View file

@ -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
@ -832,10 +831,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);
@ -861,10 +856,6 @@ function _loadURIWithFlags(browser, uri, params) {
postData: postData
}
if (params.userContextId) {
loadParams.userContextId = params.userContextId;
}
LoadInOtherProcess(browser, loadParams);
}
} catch (e) {
@ -877,10 +868,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 {
@ -944,16 +931,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);
});
@ -1138,13 +1115,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.
@ -1170,9 +1140,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") {
@ -1184,13 +1153,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.
@ -1282,7 +1249,7 @@ var gBrowserInit = {
// Setup click-and-hold gestures access to the session history
// menus if global click-and-hold isn't turned on
if (!getBoolPref("ui.click_hold_context_menus", false))
if (!Services.prefs.getBoolPref("ui.click_hold_context_menus", false))
SetClickAndHoldHandlers();
let NP = {};
@ -1873,7 +1840,7 @@ function BrowserGoHome(aEvent) {
case "tabshifted":
case "tab":
urls = homePage.split("|");
var loadInBackground = getBoolPref("browser.tabs.loadBookmarksInBackground", false);
var loadInBackground = Services.prefs.getBoolPref("browser.tabs.loadBookmarksInBackground", false);
gBrowser.loadTabs(urls, loadInBackground);
break;
case "window":
@ -2075,7 +2042,7 @@ function BrowserTryToCloseWindow()
}
function loadURI(uri, referrer, postData, allowThirdPartyFixup, referrerPolicy,
userContextId, originPrincipal, forceAboutBlankViewerInCurrent,
originPrincipal, forceAboutBlankViewerInCurrent,
triggeringPrincipal) {
try {
openLinkIn(uri, "current",
@ -2083,7 +2050,6 @@ function loadURI(uri, referrer, postData, allowThirdPartyFixup, referrerPolicy,
referrerPolicy: referrerPolicy,
postData: postData,
allowThirdPartyFixup: allowThirdPartyFixup,
userContextId: userContextId,
originPrincipal,
triggeringPrincipal,
forceAboutBlankViewerInCurrent,
@ -3957,66 +3923,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.
@ -4697,7 +4603,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;
@ -4726,7 +4631,6 @@ nsBrowserAccess.prototype = {
triggeringPrincipal: aTriggeringPrincipal,
referrerURI: aReferrer,
referrerPolicy: aReferrerPolicy,
userContextId: aUserContextId,
fromExternal: aIsExternal,
inBackground: loadInBackground,
forceNotRemote: aForceNotRemote,
@ -4803,13 +4707,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;
@ -4841,16 +4742,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);
@ -5408,11 +5303,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;
@ -5484,8 +5374,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;
@ -5509,7 +5397,6 @@ function handleDroppedLink(event, urlOrLinks, name)
replace: true,
allowThirdPartyFixup: false,
postDatas,
userContextId,
});
}
});

View file

@ -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
@ -553,12 +552,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>

View file

@ -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,
};
}
}

View file

@ -4,7 +4,6 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
Components.utils.import("resource://gre/modules/ContextualIdentityService.jsm");
Components.utils.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
Components.utils.import("resource://gre/modules/InlineSpellChecker.jsm");
Components.utils.import("resource://gre/modules/LoginManagerContextMenu.jsm");
@ -142,28 +141,11 @@ nsContextMenu.prototype = {
this.onPlainTextLink = true;
}
var inContainer = false;
if (gContextMenuContentData.userContextId) {
inContainer = true;
var item = document.getElementById("context-openlinkincontainertab");
item.setAttribute("data-usercontextid", gContextMenuContentData.userContextId);
var label =
ContextualIdentityService.getUserContextLabel(gContextMenuContentData.userContextId);
item.setAttribute("label",
gBrowserBundle.formatStringFromName("userContextOpenLink.label",
[label], 1));
}
var shouldShow = this.onSaveableLink || isMailtoInternal || this.onPlainTextLink;
var isWindowPrivate = PrivateBrowsingUtils.isWindowPrivate(window);
var showContainers = Services.prefs.getBoolPref("privacy.userContext.enabled");
this.showItem("context-openlink", shouldShow && !isWindowPrivate);
this.showItem("context-openlinkprivate", shouldShow);
this.showItem("context-openlinkintab", shouldShow && !inContainer);
this.showItem("context-openlinkincontainertab", shouldShow && inContainer);
this.showItem("context-openlinkinusercontext-menu", shouldShow && !isWindowPrivate && showContainers);
this.showItem("context-openlinkintab", shouldShow);
this.showItem("context-openlinkincurrent", this.onPlainTextLink);
this.showItem("context-sep-open", shouldShow);
},
@ -958,13 +940,6 @@ nsContextMenu.prototype = {
params[p] = extra[p];
}
// If we want to change userContextId, we must be sure that we don't
// propagate the referrer.
if ("userContextId" in params &&
params.userContextId != gContextMenuContentData.userContextId) {
params.noReferrer = true;
}
return params;
},
@ -982,7 +957,7 @@ nsContextMenu.prototype = {
},
// Open linked-to URL in a new tab.
openLinkInTab: function(event) {
openLinkInTab: function() {
urlSecurityCheck(this.linkURL, this.principal);
let referrerURI = gContextMenuContentData.documentURIObject;
@ -1003,7 +978,6 @@ nsContextMenu.prototype = {
let params = {
allowMixedContent: persistAllowMixedContentInChildTab,
userContextId: parseInt(event.target.getAttribute('data-usercontextid')),
};
openLinkIn(this.linkURL, "tab", this._openLinkInParameters(params));
@ -1779,8 +1753,4 @@ nsContextMenu.prototype = {
menuItem.label = menuLabel;
menuItem.accessKey = gNavigatorBundle.getString("contextMenuSearch.accesskey");
},
createContainerMenu: function(aEvent) {
return createUserContextMenu(aEvent, true,
gContextMenuContentData.userContextId);
},
};

View file

@ -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", () => {

View file

@ -826,10 +826,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
@ -837,7 +835,7 @@
if (!isBlankPageURL(aLocation.spec) &&
(!PrivateBrowsingUtils.isWindowPrivate(window) ||
PrivateBrowsingUtils.permanentPrivateBrowsing)) {
unifiedComplete.registerOpenPage(aLocation, userContextId);
unifiedComplete.registerOpenPage(aLocation);
this.mBrowser.registeredOpenURI = aLocation;
}
}
@ -1242,7 +1240,6 @@
this._adjustFocusAfterTabSwitch(this.mCurrentTab);
}
updateUserContextUIIndicator();
gIdentityHandler.updateSharingIndicator();
this.tabContainer._setPositionalAttributes();
@ -1498,7 +1495,6 @@
var aSkipAnimation;
var aForceNotRemote;
var aNoReferrer;
var aUserContextId;
var aRelatedBrowser;
var aOriginPrincipal;
var aOpener;
@ -1519,7 +1515,6 @@
aSkipAnimation = params.skipAnimation;
aForceNotRemote = params.forceNotRemote;
aNoReferrer = params.noReferrer;
aUserContextId = params.userContextId;
aRelatedBrowser = params.relatedBrowser;
aOriginPrincipal = params.originPrincipal;
aOpener = params.opener;
@ -1542,7 +1537,6 @@
allowMixedContent: aAllowMixedContent,
forceNotRemote: aForceNotRemote,
noReferrer: aNoReferrer,
userContextId: aUserContextId,
originPrincipal: aOriginPrincipal,
relatedBrowser: aRelatedBrowser,
opener: aOpener });
@ -1563,7 +1557,6 @@
let aTargetTab;
let aNewIndex = -1;
let aPostDatas = [];
let aUserContextId;
if (arguments.length == 2 &&
typeof arguments[1] == "object") {
let params = arguments[1];
@ -1574,7 +1567,6 @@
aNewIndex = typeof params.newIndex === "number" ?
params.newIndex : aNewIndex;
aPostDatas = params.postDatas || aPostDatas;
aUserContextId = params.userContextId;
}
if (!aURIs.length)
@ -1623,8 +1615,7 @@
ownerTab: owner,
skipAnimation: multiple,
allowThirdPartyFixup: aAllowThirdPartyFixup,
postData: aPostDatas[0],
userContextId: aUserContextId
postData: aPostDatas[0]
});
if (aNewIndex !== -1) {
this.moveTabTo(firstTabAdded, aNewIndex);
@ -1637,8 +1628,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);
@ -1911,7 +1901,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";
@ -1923,10 +1913,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");
}
@ -2009,7 +1995,7 @@
"use strict";
// Supported parameters:
// forceNotRemote, userContextId
// forceNotRemote
let uriIsAboutBlank = !aURI || aURI == "about:blank";
@ -2027,7 +2013,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) {
@ -2041,7 +2026,6 @@
browser = this._createBrowser({permanentKey: aTab.permanentKey,
remote: remote,
uriIsAboutBlank: uriIsAboutBlank,
userContextId: aParams.userContextId,
relatedBrowser: aParams.relatedBrowser,
opener: aParams.opener});
}
@ -2116,7 +2100,6 @@
var aAllowMixedContent;
var aForceNotRemote;
var aNoReferrer;
var aUserContextId;
var aEventDetail;
var aRelatedBrowser;
var aOriginPrincipal;
@ -2139,7 +2122,6 @@
aAllowMixedContent = params.allowMixedContent;
aForceNotRemote = params.forceNotRemote;
aNoReferrer = params.noReferrer;
aUserContextId = params.userContextId;
aEventDetail = params.eventDetail;
aRelatedBrowser = params.relatedBrowser;
aOriginPrincipal = params.originPrincipal;
@ -2166,11 +2148,6 @@
t.setAttribute("label", aURI);
}
if (aUserContextId) {
t.setAttribute("usercontextid", aUserContextId);
ContextualIdentityService.setTabStyle(t);
}
t.setAttribute("crop", "end");
t.setAttribute("onerror", "this.removeAttribute('image');");
@ -2220,7 +2197,6 @@
// of tab.linkedBrowser.
let browserParams = {
forceNotRemote: aForceNotRemote,
userContextId: aUserContextId,
relatedBrowser: aRelatedBrowser,
opener: aOpener,
};
@ -2599,8 +2575,7 @@
listener.destroy();
if (browser.registeredOpenURI && !aAdoptedByTab) {
this._unifiedComplete.unregisterOpenPage(browser.registeredOpenURI,
browser.getAttribute("usercontextid") || 0);
this._unifiedComplete.unregisterOpenPage(browser.registeredOpenURI);
delete browser.registeredOpenURI;
}
@ -2799,11 +2774,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");
@ -2836,10 +2806,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");
@ -2977,8 +2943,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;
}
@ -3318,10 +3283,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;
@ -4641,7 +4602,6 @@
disableSetDesktopBackground: data.disableSetDesktopBg,
loginFillInfo: data.loginFillInfo,
parentAllowsMixedContent: data.parentAllowsMixedContent,
userContextId: data.userContextId,
};
let popup = browser.ownerDocument.getElementById("contentAreaContextMenu");
let event = gContextMenuContentData.event;
@ -4668,17 +4628,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": {
@ -4862,8 +4811,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);
@ -5264,7 +5212,7 @@
</xul:arrowscrollbox>
</content>
<implementation implements="nsIDOMEventListener, nsIObserver">
<implementation implements="nsIDOMEventListener">
<constructor>
<![CDATA[
this.mTabClipWidth = Services.prefs.getIntPref("browser.tabs.tabClipWidth");
@ -5283,17 +5231,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>
@ -5319,55 +5259,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;
@ -6470,7 +6361,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);
@ -6480,7 +6370,6 @@
allowThirdPartyFixup: true,
targetTab,
newIndex,
userContextId,
});
}
@ -6741,14 +6630,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";
@ -6876,27 +6757,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>
@ -7073,30 +6933,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);
@ -7113,9 +6952,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--) {
@ -7124,9 +6960,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);

View file

@ -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");
@ -61,16 +60,6 @@ function openTopWin(url) {
openUILinkIn(url, "current");
}
function getBoolPref(prefname, def)
{
try {
return Services.prefs.getBoolPref(prefname);
}
catch (er) {
return def;
}
}
/* openUILink handles clicks on UI elements that cause URLs to load.
*
* As the third argument, you may pass an object with the same properties as
@ -137,7 +126,7 @@ function whereToOpenLink( e, ignoreButton, ignoreAlt )
// ignoreButton allows "middle-click paste" to use function without always opening in a new window.
var middle = !ignoreButton && e.button == 1;
var middleUsesTabs = getBoolPref("browser.tabs.opentabfor.middleclick", true);
var middleUsesTabs = Services.prefs.getBoolPref("browser.tabs.opentabfor.middleclick", true);
// Don't do anything special with right-mouse clicks. They're probably clicks on context menu items.
@ -145,7 +134,7 @@ function whereToOpenLink( e, ignoreButton, ignoreAlt )
if (metaKey || (middle && middleUsesTabs))
return shift ? "tabshifted" : "tab";
if (alt && getBoolPref("browser.altClickSave", false))
if (alt && Services.prefs.getBoolPref("browser.altClickSave", false))
return "save";
if (shift || (middle && !middleUsesTabs))
@ -176,7 +165,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 +210,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 +255,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 +301,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);
@ -342,7 +323,7 @@ function openLinkIn(url, where, params) {
if (loadInBackground == null) {
loadInBackground = aFromChrome ?
false :
getBoolPref("browser.tabs.loadInBackground");
Services.prefs.getBoolPref("browser.tabs.loadInBackground");
}
let uriObj;
@ -418,8 +399,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 +418,6 @@ function openLinkIn(url, where, params) {
skipAnimation: aSkipTabAnimation,
allowMixedContent: aAllowMixedContent,
noReferrer: aNoReferrer,
userContextId: aUserContextId,
originPrincipal: aPrincipal,
triggeringPrincipal: aTriggeringPrincipal,
});
@ -482,74 +461,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)
{
@ -652,7 +563,7 @@ function getShellService()
function isBidiEnabled() {
// first check the pref.
if (getBoolPref("bidi.browser.ui", false))
if (Services.prefs.getBoolPref("bidi.browser.ui", false))
return true;
// then check intl.uidirection.<locale>
@ -914,7 +825,7 @@ function openHelpLink(aHelpTopic, aCalledFromModal, aWhere) {
function openPrefsHelp() {
// non-instant apply prefwindows are usually modal, so we can't open in the topmost window,
// since its probably behind the window.
var instantApply = getBoolPref("browser.preferences.instantApply");
var instantApply = Services.prefs.getBoolPref("browser.preferences.instantApply");
var helpTopic = document.getElementsByTagName("prefwindow")[0].currentPane.helpTopic;
openHelpLink(helpTopic, !instantApply);

View file

@ -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;
}

View file

@ -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)

View file

@ -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']

View file

@ -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";
@ -977,89 +975,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 = {

View file

@ -6,7 +6,6 @@
DIRS += [
'about',
'contextualidentity',
'customizableui',
'dirprovider',
'downloads',

View file

@ -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();
}
}

View file

@ -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>

View file

@ -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;
}

View file

@ -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>

View file

@ -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

View file

@ -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>

View file

@ -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);
}
};

View file

@ -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>

View file

@ -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

View file

@ -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);

View file

@ -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">
@ -27,8 +26,6 @@
<!ENTITY % syncDTD SYSTEM "chrome://browser/locale/preferences/sync.dtd">
<!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">
@ -46,7 +43,6 @@
%syncBrandDTD;
%syncDTD;
%securityDTD;
%containersDTD;
%sanitizeDTD;
%mainDTD;
%aboutHomeDTD;
@ -134,12 +130,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"
@ -183,7 +173,6 @@
#include main.xul
#include search.xul
#include privacy.xul
#include containers.xul
#include advanced.xul
#include applications.xul
#include content.xul

View file

@ -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;
}
};

View file

@ -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>

View file

@ -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

View file

@ -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);

View file

@ -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

View file

@ -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

View file

@ -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;
}

View file

@ -52,23 +52,6 @@ XPCOMUtils.defineLazyModuleGetter(this, 'PdfjsChromeUtils',
'resource://pdf.js/PdfjsChromeUtils.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'PdfjsContentUtils',
'resource://pdf.js/PdfjsContentUtils.jsm');
function getBoolPref(aPref, aDefaultValue) {
try {
return Services.prefs.getBoolPref(aPref);
} catch (ex) {
return aDefaultValue;
}
}
function getIntPref(aPref, aDefaultValue) {
try {
return Services.prefs.getIntPref(aPref);
} catch (ex) {
return aDefaultValue;
}
}
function isDefaultHandler() {
if (Services.appinfo.processType === Services.appinfo.PROCESS_TYPE_CONTENT) {
return PdfjsContentUtils.isDefaultHandlerApp();
@ -172,7 +155,7 @@ var PdfJs = {
}
this._initialized = true;
if (!getBoolPref(PREF_DISABLED, true)) {
if (!Services.prefs.getBoolPref(PREF_DISABLED, true)) {
this._migrate();
}
@ -209,7 +192,7 @@ var PdfJs = {
_migrate: function migrate() {
const VERSION = 2;
var currentVersion = getIntPref(PREF_MIGRATION_VERSION, 0);
var currentVersion = Services.prefs.getIntPref(PREF_MIGRATION_VERSION, 0);
if (currentVersion >= VERSION) {
return;
}
@ -284,7 +267,7 @@ var PdfJs = {
* @return {boolean} Whether or not it's enabled.
*/
get enabled() {
var disabled = getBoolPref(PREF_DISABLED, true);
var disabled = Services.prefs.getBoolPref(PREF_DISABLED, true);
if (disabled) {
return false;
}

View file

@ -78,22 +78,6 @@ function getFindBar(domWindow) {
}
}
function getBoolPref(pref, def) {
try {
return Services.prefs.getBoolPref(pref);
} catch (ex) {
return def;
}
}
function getIntPref(pref, def) {
try {
return Services.prefs.getIntPref(pref);
} catch (ex) {
return def;
}
}
function getStringPref(pref, def) {
try {
return Services.prefs.getComplexValue(pref, Ci.nsISupportsString).data;
@ -103,7 +87,7 @@ function getStringPref(pref, def) {
}
function log(aMsg) {
if (!getBoolPref(PREF_PREFIX + '.pdfBugEnabled', false)) {
if (!Services.prefs.getBoolPref(PREF_PREFIX + '.pdfBugEnabled', false)) {
return;
}
var msg = 'PdfStreamConverter.js: ' + (aMsg.join ? aMsg.join('') : aMsg);
@ -359,17 +343,17 @@ ChromeActions.prototype = {
return !!findBar && ('updateControlState' in findBar);
},
supportsDocumentFonts: function() {
var prefBrowser = getIntPref('browser.display.use_document_fonts', 1);
var prefGfx = getBoolPref('gfx.downloadable_fonts.enabled', true);
var prefBrowser = Services.prefs.getIntPref('browser.display.use_document_fonts', 1);
var prefGfx = Services.prefs.getBoolPref('gfx.downloadable_fonts.enabled', true);
return (!!prefBrowser && prefGfx);
},
supportsDocumentColors: function() {
return getIntPref('browser.display.document_color_use', 0) !== 2;
return Services.prefs.getIntPref('browser.display.document_color_use', 0) !== 2;
},
supportedMouseWheelZoomModifierKeys: function() {
return {
ctrlKey: getIntPref('mousewheel.with_control.action', 3) === 3,
metaKey: getIntPref('mousewheel.with_meta.action', 1) === 3,
ctrlKey: Services.prefs.getIntPref('mousewheel.with_control.action', 3) === 3,
metaKey: Services.prefs.getIntPref('mousewheel.with_meta.action', 1) === 3,
};
},
reportTelemetry: function (data) {
@ -531,10 +515,10 @@ ChromeActions.prototype = {
prefName = (PREF_PREFIX + '.' + key);
switch (typeof prefValue) {
case 'boolean':
currentPrefs[key] = getBoolPref(prefName, prefValue);
currentPrefs[key] = Services.prefs.getBoolPref(prefName, prefValue);
break;
case 'number':
currentPrefs[key] = getIntPref(prefName, prefValue);
currentPrefs[key] = Services.prefs.getIntPref(prefName, prefValue);
break;
case 'string':
currentPrefs[key] = getStringPref(prefName, prefValue);
@ -921,16 +905,16 @@ PdfStreamConverter.prototype = {
} catch (e) {}
var hash = aRequest.URI.ref;
var isPDFBugEnabled = getBoolPref(PREF_PREFIX + '.pdfBugEnabled', false);
var isPDFBugEnabled = Services.prefs.getBoolPref(PREF_PREFIX + '.pdfBugEnabled', false);
rangeRequest = contentEncoding === 'identity' &&
acceptRanges === 'bytes' &&
aRequest.contentLength >= 0 &&
!getBoolPref(PREF_PREFIX + '.disableRange', false) &&
!Services.prefs.getBoolPref(PREF_PREFIX + '.disableRange', false) &&
(!isPDFBugEnabled ||
hash.toLowerCase().indexOf('disablerange=true') < 0);
streamRequest = contentEncoding === 'identity' &&
aRequest.contentLength >= 0 &&
!getBoolPref(PREF_PREFIX + '.disableStream', false) &&
!Services.prefs.getBoolPref(PREF_PREFIX + '.disableStream', false) &&
(!isPDFBugEnabled ||
hash.toLowerCase().indexOf('disablestream=true') < 0);
}

View file

@ -1113,7 +1113,6 @@ Function .onInit
!insertmacro InitInstallOptionsFile "options.ini"
!insertmacro InitInstallOptionsFile "shortcuts.ini"
!insertmacro InitInstallOptionsFile "components.ini"
!insertmacro InitInstallOptionsFile "summary.ini"
WriteINIStr "$PLUGINSDIR\options.ini" "Settings" NumFields "5"
@ -1188,36 +1187,6 @@ Function .onInit
WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 3" Bottom "50"
WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 3" State "1"
; Don't offer to install the quick launch shortcut on Windows 7
${Unless} ${AtLeastWin7}
WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 4" Type "checkbox"
WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 4" Text "$(ICONS_QUICKLAUNCH)"
WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 4" Left "0"
WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 4" Right "-1"
WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 4" Top "60"
WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 4" Bottom "70"
WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 4" State "1"
${EndUnless}
; Setup the components.ini file for the Components Page
WriteINIStr "$PLUGINSDIR\components.ini" "Settings" NumFields "2"
WriteINIStr "$PLUGINSDIR\components.ini" "Field 1" Type "label"
WriteINIStr "$PLUGINSDIR\components.ini" "Field 1" Text "$(OPTIONAL_COMPONENTS_DESC)"
WriteINIStr "$PLUGINSDIR\components.ini" "Field 1" Left "0"
WriteINIStr "$PLUGINSDIR\components.ini" "Field 1" Right "-1"
WriteINIStr "$PLUGINSDIR\components.ini" "Field 1" Top "5"
WriteINIStr "$PLUGINSDIR\components.ini" "Field 1" Bottom "25"
WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" Type "checkbox"
WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" Text "$(MAINTENANCE_SERVICE_CHECKBOX_DESC)"
WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" Left "0"
WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" Right "-1"
WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" Top "27"
WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" Bottom "37"
WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" State "1"
WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" Flags "GROUP"
; There must always be a core directory.
${GetSize} "$EXEDIR\core\" "/S=0K" $R5 $R7 $R8
SectionSetSize ${APP_IDX} $R5

View file

@ -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

View file

@ -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">
<!-- &#171; is &laquo; however it's not defined in XML -->
<!ENTITY backLink.label "&#171; 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">

View file

@ -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

View file

@ -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">

View file

@ -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">

View file

@ -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

View file

@ -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">

View file

@ -25,10 +25,6 @@ OPTIONS_PAGE_TITLE=Setup Type
OPTIONS_PAGE_SUBTITLE=Choose setup options
SHORTCUTS_PAGE_TITLE=Set Up Shortcuts
SHORTCUTS_PAGE_SUBTITLE=Create Program Icons
COMPONENTS_PAGE_TITLE=Set Up Optional Components
COMPONENTS_PAGE_SUBTITLE=Optional Recommended Components
OPTIONAL_COMPONENTS_DESC=The Maintenance Service will allow you to update $BrandShortName silently in the background.
MAINTENANCE_SERVICE_CHECKBOX_DESC=Install &Maintenance Service
SUMMARY_PAGE_TITLE=Summary
SUMMARY_PAGE_SUBTITLE=Ready to start installing $BrandShortName
SUMMARY_INSTALLED_TO=$BrandShortName will be installed to the following location:

View file

@ -79,10 +79,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)

View file

@ -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);
}
};

View file

@ -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;
}

View file

@ -237,8 +237,7 @@ treecol {
/* Privacy pane */
#trackingProtectionPBMLearnMore,
#trackingProtectionLearnMore,
#browserContainersLearnMore {
#trackingProtectionLearnMore {
margin-inline-start: 1.5em !important;
margin-top: 0;
font-weight: normal;

View file

@ -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)

View file

@ -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);
}

View file

@ -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);

View file

@ -24,9 +24,6 @@
id="PMaboutDialog"
windowtype="Browser:About"
onload="init(event);"
#ifdef MOZ_UPDATER
onunload="onUnload(event);"
#endif
#ifdef XP_MACOSX
inwindowmenu="false"
#else

View file

@ -52,11 +52,9 @@ var browserMenuDragging = {
initPref: function(){
this.STAY_OPEN_ONDRAGEXIT =
this.getPref('browser.menu.dragging.stayOpen',
'bool', false);
Services.prefs.getBoolPref('browser.menu.dragging.stayOpen', false);
this.DEBUG =
this.getPref('browser.menu.dragging.debug',
'bool', false);
Services.prefs.getBoolPref('browser.menu.dragging.debug', false);
},
//delayed startup
@ -291,26 +289,6 @@ var browserMenuDragging = {
.logStringMessage(aMsg);
},
getPref: function(aPrefString, aPrefType, aDefault){
var xpPref = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefService);
try{
switch (aPrefType){
case 'complex':
return xpPref.getComplexValue(aPrefString, Components.interfaces.nsILocalFile); break;
case 'str':
return xpPref.getCharPref(aPrefString).toString(); break;
case 'int':
return xpPref.getIntPref(aPrefString); break;
case 'bool':
default:
return xpPref.getBoolPref(aPrefString); break;
}
}catch(e){
}
return aDefault;
},
setPref: function(aPrefString, aPrefType, aValue){
var xpPref = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefService);

View file

@ -1147,7 +1147,7 @@ var gBrowserInit = {
// Setup click-and-hold gestures access to the session history
// menus if global click-and-hold isn't turned on
if (!getBoolPref("ui.click_hold_context_menus", false))
if (!Services.prefs.getBoolPref("ui.click_hold_context_menus", false))
SetClickAndHoldHandlers();
// Initialize the full zoom setting.
@ -1783,7 +1783,7 @@ function BrowserGoHome(aEvent) {
case "tabshifted":
case "tab":
urls = homePage.split("|");
var loadInBackground = getBoolPref("browser.tabs.loadBookmarksInBackground", false);
var loadInBackground = Services.prefs.getBoolPref("browser.tabs.loadBookmarksInBackground", false);
gBrowser.loadTabs(urls, loadInBackground);
break;
case "window":
@ -3402,7 +3402,7 @@ function BrowserCustomizeToolbar() {
TabsInTitlebar.allowedBy("customizing-toolbars", false);
var customizeURL = "chrome://global/content/customizeToolbar.xul";
gCustomizeSheet = getBoolPref("toolbar.customization.usesheet", false);
gCustomizeSheet = Services.prefs.getBoolPref("toolbar.customization.usesheet", false);
if (gCustomizeSheet) {
let sheetFrame = document.createElement("iframe");
@ -3486,7 +3486,7 @@ function BrowserToolboxCustomizeDone(aToolboxChanged) {
cmd.removeAttribute("disabled");
// make sure to re-enable click-and-hold
if (!getBoolPref("ui.click_hold_context_menus", false))
if (!Services.prefs.getBoolPref("ui.click_hold_context_menus", false))
SetClickAndHoldHandlers();
gBrowser.selectedBrowser.focus();
@ -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,
});
}
});

View file

@ -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,
};
}

View file

@ -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]);
@ -4799,8 +4790,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);
@ -4810,7 +4799,6 @@
allowThirdPartyFixup: true,
targetTab,
newIndex,
userContextId,
});
}

View file

@ -75,16 +75,6 @@ function openTopWin(url) {
openUILinkIn(url, "current");
}
function getBoolPref(prefname, def)
{
try {
return Services.prefs.getBoolPref(prefname);
}
catch(er) {
return def;
}
}
/* openUILink handles clicks on UI elements that cause URLs to load.
*
* As the third argument, you may pass an object with the same properties as
@ -151,7 +141,7 @@ function whereToOpenLink( e, ignoreButton, ignoreAlt )
// ignoreButton allows "middle-click paste" to use function without always opening in a new window.
var middle = !ignoreButton && e.button == 1;
var middleUsesTabs = getBoolPref("browser.tabs.opentabfor.middleclick", true);
var middleUsesTabs = Services.prefs.getBoolPref("browser.tabs.opentabfor.middleclick", true);
// Don't do anything special with right-mouse clicks. They're probably clicks on context menu items.
@ -162,7 +152,7 @@ function whereToOpenLink( e, ignoreButton, ignoreAlt )
#endif
return shift ? "tabshifted" : "tab";
if (alt && getBoolPref("browser.altClickSave", false))
if (alt && Services.prefs.getBoolPref("browser.altClickSave", false))
return "save";
if (shift || (middle && !middleUsesTabs))
@ -334,7 +324,7 @@ function openLinkIn(url, where, params) {
if (loadInBackground == null) {
loadInBackground = aFromChrome ?
false :
getBoolPref("browser.tabs.loadInBackground");
Services.prefs.getBoolPref("browser.tabs.loadInBackground");
}
let uriObj;
@ -515,7 +505,7 @@ function getShellService()
function isBidiEnabled() {
// first check the pref.
if (getBoolPref("bidi.browser.ui", false))
if (Services.prefs.getBoolPref("bidi.browser.ui", false))
return true;
// if the pref isn't set, check for an RTL locale and force the pref to true
@ -673,7 +663,7 @@ function openAboutDialog() {
function openPreferences(paneID, extraArgs)
{
var instantApply = getBoolPref("browser.preferences.instantApply", false);
var instantApply = Services.prefs.getBoolPref("browser.preferences.instantApply", false);
var features = "chrome,titlebar,toolbar,centerscreen" + (instantApply ? ",dialog=no" : ",modal");
var win = Services.wm.getMostRecentWindow("Browser:Preferences");
@ -854,7 +844,7 @@ function openHelpLink(aHelpTopic, aCalledFromModal) {
function openPrefsHelp() {
// non-instant apply prefwindows are usually modal, so we can't open in the topmost window,
// since its probably behind the window.
var instantApply = getBoolPref("browser.preferences.instantApply");
var instantApply = Services.prefs.getBoolPref("browser.preferences.instantApply");
var helpTopic = document.getElementsByTagName("prefwindow")[0].currentPane.helpTopic;
openHelpLink(helpTopic, !instantApply);

View file

@ -22,7 +22,11 @@ var gNewtabUrl = {
return;
}
} else {
newtabUrlChoice = Services.prefs.getIntPref("browser.newtab.choice");
if (this.newtabUrlChoiceIsSet) {
newtabUrlChoice = Services.prefs.getIntPref("browser.newtab.choice");
} else {
newtabUrlChoice = this.getNewtabChoice();
}
}
if (browserHomepageUrl || browserHomepageUrl == "") {
if (Services.prefs.getBoolPref("browser.preferences.instantApply")) {
@ -64,5 +68,35 @@ var gNewtabUrl = {
}
Services.prefs.setCharPref("browser.newtab.url",newtabUrlPref);
} catch(e) { console.error(e); }
},
/**
* Determines the value of browser.newtab.choice based
* on the value of browser.newtab.url
*
* @returns the value of browser.newtab.choice
*/
getNewtabChoice: function() {
let newtabUrlPref = Services.prefs.getCharPref("browser.newtab.url");
let browserHomepageUrl = Services.prefs.getComplexValue("browser.startup.homepage",
Components.interfaces.nsIPrefLocalizedString).data;
let newtabUrlSanitizedPref = browserHomepageUrl.split("|")[0];
let defaultStartupHomepage = Services.prefs.getDefaultBranch("browser.")
.getComplexValue("startup.homepage",
Components.interfaces.nsIPrefLocalizedString).data;
switch (newtabUrlPref) {
case "about:logopage":
return 1;
case defaultStartupHomepage:
return 2;
case newtabUrlSanitizedPref:
return 3;
case "about:newtab":
return 4;
default: // Custom URL entered.
// We need this to consider instantApply.
this.newtabPageCustom = newtabUrlPref;
return 0;
}
}
};

View file

@ -78,34 +78,13 @@ var gTabsPane = {
/**
* Determines the value of the New Tab display drop-down based
* on the value of browser.newtab.url.
*
* @returns the appropriate value of browser.newtab.choice
*/
readNewtabUrl: function() {
let newtabUrlPref = document.getElementById("browser.newtab.url");
let newtabUrlSanitizedPref = document.getElementById("browser.newtab.myhome");
let newtabUrlChoice = document.getElementById("browser.newtab.choice");
let defaultStartupHomepage = Services.prefs.getDefaultBranch("browser.")
.getComplexValue("startup.homepage",
Components.interfaces.nsIPrefLocalizedString).data;
switch (newtabUrlPref.value) {
case "about:logopage":
newtabUrlChoice.value = 1;
break;
case defaultStartupHomepage:
newtabUrlChoice.value = 2;
break;
case newtabUrlSanitizedPref.value:
newtabUrlChoice.value = 3;
break;
case "about:newtab":
newtabUrlChoice.value = 4;
break;
default: // Custom URL entered.
document.getElementById("newtabPageCustom").hidden = false;
newtabUrlChoice.value = 0;
// We need this to consider instantApply.
this.newtabPageCustom = newtabUrlPref.value;
newtabUrlChoice.value = gNewtabUrl.getNewtabChoice();
if (newtabUrlChoice.value == 0) {
document.getElementById("newtabPageCustom").hidden = false;
}
gNewtabUrl.newtabUrlChoiceIsSet = true;
}
};

View file

@ -1080,7 +1080,6 @@ Function .onInit
!insertmacro InitInstallOptionsFile "options.ini"
!insertmacro InitInstallOptionsFile "shortcuts.ini"
!insertmacro InitInstallOptionsFile "components.ini"
!insertmacro InitInstallOptionsFile "summary.ini"
WriteINIStr "$PLUGINSDIR\options.ini" "Settings" NumFields "5"
@ -1155,36 +1154,6 @@ Function .onInit
WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 3" Bottom "50"
WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 3" State "1"
; Don't offer to install the quick launch shortcut on Windows 7
${Unless} ${AtLeastWin7}
WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 4" Type "checkbox"
WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 4" Text "$(ICONS_QUICKLAUNCH)"
WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 4" Left "0"
WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 4" Right "-1"
WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 4" Top "60"
WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 4" Bottom "70"
WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 4" State "1"
${EndUnless}
; Setup the components.ini file for the Components Page
WriteINIStr "$PLUGINSDIR\components.ini" "Settings" NumFields "2"
WriteINIStr "$PLUGINSDIR\components.ini" "Field 1" Type "label"
WriteINIStr "$PLUGINSDIR\components.ini" "Field 1" Text "$(OPTIONAL_COMPONENTS_DESC)"
WriteINIStr "$PLUGINSDIR\components.ini" "Field 1" Left "0"
WriteINIStr "$PLUGINSDIR\components.ini" "Field 1" Right "-1"
WriteINIStr "$PLUGINSDIR\components.ini" "Field 1" Top "5"
WriteINIStr "$PLUGINSDIR\components.ini" "Field 1" Bottom "25"
WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" Type "checkbox"
WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" Text "$(MAINTENANCE_SERVICE_CHECKBOX_DESC)"
WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" Left "0"
WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" Right "-1"
WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" Top "27"
WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" Bottom "37"
WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" State "1"
WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" Flags "GROUP"
; There must always be a core directory.
${GetSize} "$EXEDIR\core\" "/S=0K" $R5 $R7 $R8
SectionSetSize ${APP_IDX} $R5

View file

@ -10,4 +10,4 @@
# hardcoded milestones in the tree from these two files.
#--------------------------------------------------------
4.1.9
4.1.10

View file

@ -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`

View file

@ -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);

View file

@ -375,6 +375,7 @@ const CurlUtils = {
.replace(/\'/g, "\\\'")
.replace(/\n/g, "\\n")
.replace(/\r/g, "\\r")
.replace(/!/g, "\\041")
.replace(/[^\x20-\x7E]/g, escapeCharacter) + "'";
}

View file

@ -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

View file

@ -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.");
}

View file

@ -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": [

View file

@ -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;

View file

@ -23,15 +23,6 @@ function debug(msg) {
//dump("BrowserElementParent - " + msg + "\n");
}
function getIntPref(prefName, def) {
try {
return Services.prefs.getIntPref(prefName);
}
catch(err) {
return def;
}
}
function handleWindowEvent(e) {
if (this._browserElementParents) {
let beps = ThreadSafeChromeUtils.nondeterministicGetWeakMapKeys(this._browserElementParents);
@ -856,8 +847,8 @@ BrowserElementParent.prototype = {
*/
zoom: defineNoReturnMethod(function(zoom) {
zoom *= 100;
zoom = Math.min(getIntPref("zoom.maxPercent", 300), zoom);
zoom = Math.max(getIntPref("zoom.minPercent", 50), zoom);
zoom = Math.min(Services.prefs.getIntPref("zoom.maxPercent", 300), zoom);
zoom = Math.max(Services.prefs.getIntPref("zoom.minPercent", 50), zoom);
this._sendAsyncMsg('zoom', {zoom: zoom / 100.0});
}),

View file

@ -2051,6 +2051,16 @@ MediaManager::GetUserMedia(nsPIDOMWindowInner* aWindow,
return rv;
}
// Disallow access to null principal pages
nsCOMPtr<nsIPrincipal> principal = aWindow->GetExtantDoc()->NodePrincipal();
if (principal->GetIsNullPrincipal()) {
RefPtr<MediaStreamError> error =
new MediaStreamError(aWindow,
NS_LITERAL_STRING("NotAllowedError"));
onFailure->OnError(error);
return NS_OK;
}
if (!Preferences::GetBool("media.navigator.video.enabled", true)) {
c.mVideo.SetAsBoolean() = false;
}
@ -2198,7 +2208,6 @@ MediaManager::GetUserMedia(nsPIDOMWindowInner* aWindow,
StreamListeners* listeners = AddWindowID(windowID);
// Create a disabled listener to act as a placeholder
nsIPrincipal* principal = aWindow->GetExtantDoc()->NodePrincipal();
RefPtr<GetUserMediaCallbackMediaStreamListener> listener =
new GetUserMediaCallbackMediaStreamListener(mMediaThread, windowID,
MakePrincipalHandle(principal));

View file

@ -61,7 +61,7 @@ void VideoFrameContainer::UpdatePrincipalHandleForFrameIDLocked(const PrincipalH
mFrameIDForPendingPrincipalHandle = aFrameID;
}
static void
static bool
SetImageToBlackPixel(PlanarYCbCrImage* aImage)
{
uint8_t blackPixel[] = { 0x10, 0x80, 0x80 };
@ -72,7 +72,7 @@ SetImageToBlackPixel(PlanarYCbCrImage* aImage)
data.mCrChannel = blackPixel + 2;
data.mYStride = data.mCbCrStride = 1;
data.mPicSize = data.mYSize = data.mCbCrSize = gfx::IntSize(1, 1);
aImage->CopyData(data);
return aImage->CopyData(data);
}
class VideoFrameContainerInvalidateRunnable : public Runnable {
@ -122,11 +122,13 @@ void VideoFrameContainer::SetCurrentFrames(const VideoSegment& aSegment)
if (frame->GetForceBlack()) {
if (!mBlackImage) {
mBlackImage = GetImageContainer()->CreatePlanarYCbCrImage();
if (mBlackImage) {
RefPtr<Image> blackImage = GetImageContainer()->CreatePlanarYCbCrImage();
if (blackImage) {
// Sets the image to a single black pixel, which will be scaled to
// fill the rendered size.
SetImageToBlackPixel(mBlackImage->AsPlanarYCbCrImage());
if (SetImageToBlackPixel(blackImage->AsPlanarYCbCrImage())) {
mBlackImage = blackImage;
}
}
}
if (mBlackImage) {

View file

@ -102,7 +102,6 @@ GetObject(const MDefinition* ins)
case MDefinition::Op_SetDisjointTypedElements:
case MDefinition::Op_ArrayPopShift:
case MDefinition::Op_ArrayPush:
case MDefinition::Op_ArraySlice:
case MDefinition::Op_LoadTypedArrayElementHole:
case MDefinition::Op_StoreTypedArrayElementHole:
case MDefinition::Op_LoadFixedSlot:
@ -126,6 +125,7 @@ GetObject(const MDefinition* ins)
object = ins->getOperand(0);
break;
case MDefinition::Op_GetPropertyCache:
case MDefinition::Op_CallGetProperty:
case MDefinition::Op_LoadTypedArrayElementStatic:
case MDefinition::Op_StoreTypedArrayElementStatic:
case MDefinition::Op_GetDOMProperty:
@ -148,6 +148,7 @@ GetObject(const MDefinition* ins)
case MDefinition::Op_WasmLoadGlobalVar:
case MDefinition::Op_WasmStoreGlobalVar:
case MDefinition::Op_ArrayJoin:
case MDefinition::Op_ArraySlice:
return nullptr;
default:
#ifdef DEBUG

View file

@ -3127,6 +3127,15 @@ ExtractMathSpace(MDefinition* ins)
MOZ_MAKE_COMPILER_ASSUME_IS_UNREACHABLE("Unknown TruncateKind");
}
static bool MonotoneAdd(int32_t lhs, int32_t rhs) {
return (lhs >= 0 && rhs >= 0) || (lhs <= 0 && rhs <= 0);
}
static bool MonotoneSub(int32_t lhs, int32_t rhs) {
return (lhs >= 0 && rhs <= 0) || (lhs <= 0 && rhs >= 0);
}
// Extract a linear sum from ins, if possible (otherwise giving the sum 'ins + 0').
SimpleLinearSum
jit::ExtractLinearSum(MDefinition* ins, MathSpace space)
@ -3168,10 +3177,12 @@ jit::ExtractLinearSum(MDefinition* ins, MathSpace space)
// Check if this is of the form <SUM> + n or n + <SUM>.
if (ins->isAdd()) {
int32_t constant;
if (space == MathSpace::Modulo)
if (space == MathSpace::Modulo) {
constant = lsum.constant + rsum.constant;
else if (!SafeAdd(lsum.constant, rsum.constant, &constant))
} else if (!SafeAdd(lsum.constant, rsum.constant, &constant) ||
!MonotoneAdd(lsum.constant, rsum.constant)) {
return SimpleLinearSum(ins, 0);
}
return SimpleLinearSum(lsum.term ? lsum.term : rsum.term, constant);
}
@ -3179,10 +3190,12 @@ jit::ExtractLinearSum(MDefinition* ins, MathSpace space)
// Check if this is of the form <SUM> - n.
if (lsum.term) {
int32_t constant;
if (space == MathSpace::Modulo)
if (space == MathSpace::Modulo) {
constant = lsum.constant - rsum.constant;
else if (!SafeSub(lsum.constant, rsum.constant, &constant))
} else if (!SafeSub(lsum.constant, rsum.constant, &constant) ||
!MonotoneSub(lsum.constant, rsum.constant)) {
return SimpleLinearSum(ins, 0);
}
return SimpleLinearSum(lsum.term, constant);
}

View file

@ -11833,7 +11833,8 @@ class MCallGetProperty
AliasSet getAliasSet() const override {
if (!idempotent_)
return AliasSet::Store(AliasSet::Any);
return AliasSet::None();
return AliasSet::Load(AliasSet::ObjectFields | AliasSet::FixedSlot |
AliasSet::DynamicSlot);
}
bool possiblyCalls() const override {
return true;

View file

@ -1439,13 +1439,14 @@ public:
/**
* This function increases an initial intrinsic size, 'aCurrent', according
* to the given 'aPercent', such that the size-increase makes up exactly
* 'aPercent' percent of the returned value. If 'aPercent' is less than
* or equal to zero the original 'aCurrent' value is returned. If 'aPercent'
* is greater than or equal to 1.0 the value nscoord_MAX is returned.
* 'aPercent' percent of the returned value. If 'aPercent' or 'aCurrent' are
* less than or equal to zero the original 'aCurrent' value is returned.
* If 'aPercent' is greater than or equal to 1.0 the value nscoord_MAX is
* returned.
*/
static nscoord AddPercents(nscoord aCurrent, float aPercent)
{
if (aPercent > 0.0f) {
if (aPercent > 0.0f && aCurrent > 0) {
return MOZ_UNLIKELY(aPercent >= 1.0f) ? nscoord_MAX
: NSToCoordRound(float(aCurrent) / (1.0f - aPercent));
}

View file

@ -7296,11 +7296,11 @@ PresShell::HandleEvent(nsIFrame* aFrame,
return NS_OK;
}
nsIContent* capturingContent = ((aEvent->mClass == ePointerEventClass ||
aEvent->mClass == eWheelEventClass ||
aEvent->HasMouseEventMessage())
? GetCapturingContent()
: nullptr);
nsCOMPtr<nsIContent> capturingContent = ((aEvent->mClass == ePointerEventClass ||
aEvent->mClass == eWheelEventClass ||
aEvent->HasMouseEventMessage())
? GetCapturingContent()
: nullptr);
nsCOMPtr<nsIDocument> retargetEventDoc;
if (!aDontRetargetEvents) {

View file

@ -23,14 +23,6 @@ XPCOMUtils.defineLazyModuleGetter(this, "Messaging",
XPCOMUtils.defineLazyModuleGetter(this, "OS", "resource://gre/modules/osfile.jsm");
function getPref(func, preference, defaultValue) {
try {
return Services.prefs[func](preference);
}
catch (e) {}
return defaultValue;
}
// -----------------------------------------------------------------------
// Add-on auto-update management service
// -----------------------------------------------------------------------
@ -49,7 +41,7 @@ AddonUpdateService.prototype = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsITimerCallback]),
notify: function aus_notify(aTimer) {
if (aTimer && !getPref("getBoolPref", PREF_ADDON_UPDATE_ENABLED, true))
if (aTimer && !Services.prefs.getBoolPref(PREF_ADDON_UPDATE_ENABLED, true))
return;
// If we already auto-upgraded and installed new versions, ignore this check
@ -61,7 +53,7 @@ AddonUpdateService.prototype = {
let gmp = new GMPInstallManager();
gmp.simpleCheckAndInstall().then(null, () => {});
let interval = 1000 * getPref("getIntPref", PREF_ADDON_UPDATE_INTERVAL, 86400);
let interval = 1000 * Services.prefs.getIntPref(PREF_ADDON_UPDATE_INTERVAL, 86400);
Messaging.sendRequest({
type: "Gecko:ScheduleRun",
action: "update-addons",

View file

@ -57,12 +57,16 @@ interface nsIPrefBranch : nsISupports
* Called to get the state of an individual boolean preference.
*
* @param aPrefName The boolean preference to get the state of.
* @param aDefaultValue The value to return if the preference is not set.
*
* @return boolean The value of the requested boolean preference.
*
* @see setBoolPref
*/
boolean getBoolPref(in string aPrefName);
[optional_argc,binaryname(GetBoolPrefWithDefault)]
boolean getBoolPref(in string aPrefName, [optional] in boolean aDefaultValue);
[noscript,binaryname(GetBoolPref)]
boolean getBoolPrefXPCOM(in string aPrefName);
/**
* Called to set the state of an individual boolean preference.
@ -83,23 +87,31 @@ interface nsIPrefBranch : nsISupports
* are converted to floating point numbers.
*
* @param aPrefName The floating point preference to get the state of.
* @param aDefaultValue The value to return if the preference is not set.
*
* @return float The value of the requested floating point preference.
*
* @see setCharPref
*/
float getFloatPref(in string aPrefName);
[optional_argc,binaryname(GetFloatPrefWithDefault)]
float getFloatPref(in string aPrefName, [optional] in float aDefaultValue);
[noscript,binaryname(GetFloatPref)]
float getFloatPrefXPCOM(in string aPrefName);
/**
* Called to get the state of an individual string preference.
*
* @param aPrefName The string preference to retrieve.
* @param aDefaultValue The string to return if the preference is not set.
*
* @return string The value of the requested string preference.
*
* @see setCharPref
*/
string getCharPref(in string aPrefName);
[optional_argc,binaryname(GetCharPrefWithDefault)]
string getCharPref(in string aPrefName, [optional] in string aDefaultValue);
[noscript,binaryname(GetCharPref)]
string getCharPrefXPCOM(in string aPrefName);
/**
* Called to set the state of an individual string preference.
@ -118,12 +130,16 @@ interface nsIPrefBranch : nsISupports
* Called to get the state of an individual integer preference.
*
* @param aPrefName The integer preference to get the value of.
* @param aDefaultValue The value to return if the preference is not set.
*
* @return long The value of the requested integer preference.
*
* @see setIntPref
*/
long getIntPref(in string aPrefName);
[optional_argc,binaryname(GetIntPrefWithDefault)]
long getIntPref(in string aPrefName, [optional] in long aDefaultValue);
[noscript,binaryname(GetIntPref)]
long getIntPrefXPCOM(in string aPrefName);
/**
* Called to set the state of an individual integer preference.

View file

@ -141,6 +141,20 @@ NS_IMETHODIMP nsPrefBranch::GetPrefType(const char *aPrefName, int32_t *_retval)
return NS_OK;
}
NS_IMETHODIMP nsPrefBranch::GetBoolPrefWithDefault(const char *aPrefName,
bool aDefaultValue,
uint8_t _argc, bool *_retval)
{
nsresult rv = GetBoolPref(aPrefName, _retval);
if (NS_FAILED(rv) && _argc == 1) {
*_retval = aDefaultValue;
return NS_OK;
}
return rv;
}
NS_IMETHODIMP nsPrefBranch::GetBoolPref(const char *aPrefName, bool *_retval)
{
NS_ENSURE_ARG(aPrefName);
@ -156,6 +170,20 @@ NS_IMETHODIMP nsPrefBranch::SetBoolPref(const char *aPrefName, bool aValue)
return PREF_SetBoolPref(pref, aValue, mIsDefault);
}
NS_IMETHODIMP nsPrefBranch::GetFloatPrefWithDefault(const char *aPrefName,
float aDefaultValue,
uint8_t _argc, float *_retval)
{
nsresult rv = GetFloatPref(aPrefName, _retval);
if (NS_FAILED(rv) && _argc == 1) {
*_retval = aDefaultValue;
return NS_OK;
}
return rv;
}
NS_IMETHODIMP nsPrefBranch::GetFloatPref(const char *aPrefName, float *_retval)
{
NS_ENSURE_ARG(aPrefName);
@ -169,6 +197,21 @@ NS_IMETHODIMP nsPrefBranch::GetFloatPref(const char *aPrefName, float *_retval)
return rv;
}
NS_IMETHODIMP nsPrefBranch::GetCharPrefWithDefault(const char *aPrefName,
const char *aDefaultValue,
uint8_t _argc, char **_retval)
{
nsresult rv = GetCharPref(aPrefName, _retval);
if (NS_FAILED(rv) && _argc == 1) {
NS_ENSURE_ARG(aDefaultValue);
*_retval = NS_strdup(aDefaultValue);
return NS_OK;
}
return rv;
}
NS_IMETHODIMP nsPrefBranch::GetCharPref(const char *aPrefName, char **_retval)
{
NS_ENSURE_ARG(aPrefName);
@ -195,6 +238,20 @@ nsresult nsPrefBranch::SetCharPrefInternal(const char *aPrefName, const char *aV
return PREF_SetCharPref(pref, aValue, mIsDefault);
}
NS_IMETHODIMP nsPrefBranch::GetIntPrefWithDefault(const char *aPrefName,
int32_t aDefaultValue,
uint8_t _argc, int32_t *_retval)
{
nsresult rv = GetIntPref(aPrefName, _retval);
if (NS_FAILED(rv) && _argc == 1) {
*_retval = aDefaultValue;
return NS_OK;
}
return rv;
}
NS_IMETHODIMP nsPrefBranch::GetIntPref(const char *aPrefName, int32_t *_retval)
{
NS_ENSURE_ARG(aPrefName);

View file

@ -0,0 +1,48 @@
/* 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/. */
/* Tests for providing a default value to get{Bool,Char,Float,Int}Pref */
function run_test() {
var ps = Cc["@mozilla.org/preferences-service;1"]
.getService(Ci.nsIPrefService)
.QueryInterface(Ci.nsIPrefBranch);
let prefName = "test.default.values.bool";
do_check_throws(function() { ps.getBoolPref(prefName); },
Cr.NS_ERROR_UNEXPECTED);
strictEqual(ps.getBoolPref(prefName, false), false);
strictEqual(ps.getBoolPref(prefName, true), true);
ps.setBoolPref(prefName, true);
strictEqual(ps.getBoolPref(prefName), true);
strictEqual(ps.getBoolPref(prefName, false), true);
strictEqual(ps.getBoolPref(prefName, true), true);
prefName = "test.default.values.char";
do_check_throws(function() { ps.getCharPref(prefName); },
Cr.NS_ERROR_UNEXPECTED);
strictEqual(ps.getCharPref(prefName, ""), "");
strictEqual(ps.getCharPref(prefName, "string"), "string");
ps.setCharPref(prefName, "foo");
strictEqual(ps.getCharPref(prefName), "foo");
strictEqual(ps.getCharPref(prefName, "string"), "foo");
prefName = "test.default.values.float";
do_check_throws(function() { ps.getFloatPref(prefName); },
Cr.NS_ERROR_UNEXPECTED);
strictEqual(ps.getFloatPref(prefName, 3.5), 3.5);
strictEqual(ps.getFloatPref(prefName, 0), 0);
ps.setCharPref(prefName, 1.75);
strictEqual(ps.getFloatPref(prefName), 1.75);
strictEqual(ps.getFloatPref(prefName, 3.5), 1.75);
prefName = "test.default.values.int";
do_check_throws(function() { ps.getIntPref(prefName); },
Cr.NS_ERROR_UNEXPECTED);
strictEqual(ps.getIntPref(prefName, 3), 3);
strictEqual(ps.getIntPref(prefName, 0), 0);
ps.setIntPref(prefName, 42);
strictEqual(ps.getIntPref(prefName), 42);
strictEqual(ps.getIntPref(prefName, 3), 42);
}

View file

@ -13,6 +13,7 @@ support-files =
[test_stickyprefs.js]
support-files = data/testPrefSticky.js data/testPrefStickyUser.js
[test_changeType.js]
[test_defaultValues.js]
[test_dirtyPrefs.js]
[test_extprefs.js]
[test_libPrefs.js]

View file

@ -516,33 +516,6 @@ FTPChannelChild::RecvOnStopRequest(const nsresult& aChannelStatus,
return true;
}
class nsFtpChildAsyncAlert : public Runnable
{
public:
nsFtpChildAsyncAlert(nsIPrompt *aPrompter, nsString aResponseMsg)
: mPrompter(aPrompter)
, mResponseMsg(aResponseMsg)
{
MOZ_COUNT_CTOR(nsFtpChildAsyncAlert);
}
protected:
virtual ~nsFtpChildAsyncAlert()
{
MOZ_COUNT_DTOR(nsFtpChildAsyncAlert);
}
public:
NS_IMETHOD Run() override
{
if (mPrompter) {
mPrompter->Alert(nullptr, mResponseMsg.get());
}
return NS_OK;
}
private:
nsCOMPtr<nsIPrompt> mPrompter;
nsString mResponseMsg;
};
class MaybeDivertOnStopFTPEvent : public ChannelEvent
{
public:
@ -600,19 +573,7 @@ FTPChannelChild::DoOnStopRequest(const nsresult& aChannelStatus,
(void)mListener->OnStopRequest(this, mListenerContext, aChannelStatus);
if (NS_FAILED(aChannelStatus) && !aErrorMsg.IsEmpty()) {
nsCOMPtr<nsIPrompt> prompter;
GetCallback(prompter);
if (prompter) {
nsCOMPtr<nsIRunnable> alertEvent;
if (aUseUTF8) {
alertEvent = new nsFtpChildAsyncAlert(prompter,
NS_ConvertUTF8toUTF16(aErrorMsg));
} else {
alertEvent = new nsFtpChildAsyncAlert(prompter,
NS_ConvertASCIItoUTF16(aErrorMsg));
}
NS_DispatchToMainThread(alertEvent);
}
NS_ERROR("FTP error on stop request.");
}
mListener = nullptr;

View file

@ -29,7 +29,6 @@
#include "nsIStreamListenerTee.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch.h"
#include "nsIStringBundle.h"
#include "nsAuthInformationHolder.h"
#include "nsIProtocolProxyService.h"
#include "nsICancelable.h"
@ -926,38 +925,7 @@ nsFtpState::R_syst() {
mServerType = FTP_VMS_TYPE;
} else {
NS_ERROR("Server type list format unrecognized.");
// Guessing causes crashes.
// (Of course, the parsing code should be more robust...)
nsCOMPtr<nsIStringBundleService> bundleService =
do_GetService(NS_STRINGBUNDLE_CONTRACTID);
if (!bundleService)
return FTP_ERROR;
nsCOMPtr<nsIStringBundle> bundle;
nsresult rv = bundleService->CreateBundle(NECKO_MSGS_URL,
getter_AddRefs(bundle));
if (NS_FAILED(rv))
return FTP_ERROR;
char16_t* ucs2Response = ToNewUnicode(mResponseMsg);
const char16_t *formatStrings[1] = { ucs2Response };
NS_NAMED_LITERAL_STRING(name, "UnsupportedFTPServer");
nsXPIDLString formattedString;
rv = bundle->FormatStringFromName(name.get(), formatStrings, 1,
getter_Copies(formattedString));
free(ucs2Response);
if (NS_FAILED(rv))
return FTP_ERROR;
// TODO(darin): this code should not be dictating UI like this!
nsCOMPtr<nsIPrompt> prompter;
mChannel->GetCallback(prompter);
if (prompter)
prompter->Alert(nullptr, formattedString.get());
// since we just alerted the user, clear mResponseMsg,
// which is displayed to the user.
// clear mResponseMsg, which is displayed to the user.
mResponseMsg = "";
return FTP_ERROR;
}
@ -1779,34 +1747,6 @@ nsFtpState::KillControlConnection()
mControlConnection = nullptr;
}
class nsFtpAsyncAlert : public Runnable
{
public:
nsFtpAsyncAlert(nsIPrompt *aPrompter, nsString aResponseMsg)
: mPrompter(aPrompter)
, mResponseMsg(aResponseMsg)
{
MOZ_COUNT_CTOR(nsFtpAsyncAlert);
}
protected:
virtual ~nsFtpAsyncAlert()
{
MOZ_COUNT_DTOR(nsFtpAsyncAlert);
}
public:
NS_IMETHOD Run() override
{
if (mPrompter) {
mPrompter->Alert(nullptr, mResponseMsg.get());
}
return NS_OK;
}
private:
nsCOMPtr<nsIPrompt> mPrompter;
nsString mResponseMsg;
};
nsresult
nsFtpState::StopProcessing()
{
@ -1818,23 +1758,8 @@ nsFtpState::StopProcessing()
LOG_INFO(("FTP:(%x) nsFtpState stopping", this));
if (NS_FAILED(mInternalError) && !mResponseMsg.IsEmpty()) {
// check to see if the control status is bad.
// web shell wont throw an alert. we better:
// XXX(darin): this code should not be dictating UI like this!
nsCOMPtr<nsIPrompt> prompter;
mChannel->GetCallback(prompter);
if (prompter) {
nsCOMPtr<nsIRunnable> alertEvent;
if (mUseUTF8) {
alertEvent = new nsFtpAsyncAlert(prompter,
NS_ConvertUTF8toUTF16(mResponseMsg));
} else {
alertEvent = new nsFtpAsyncAlert(prompter,
NS_ConvertASCIItoUTF16(mResponseMsg));
}
NS_DispatchToMainThread(alertEvent);
}
NS_ERROR("FTP: bad control status.");
// check to see if the control status is bad; forward the error message.
nsCOMPtr<nsIFTPChannelParentInternal> ftpChanP;
mChannel->GetCallback(ftpChanP);
if (ftpChanP) {

View file

@ -1928,12 +1928,21 @@ DataChannelConnection::ReceiveCallback(struct socket* sock, void *data, size_t d
if (!data) {
usrsctp_close(sock); // SCTP has finished shutting down
} else {
mLock.AssertCurrentThreadOwns();
bool locked = false;
if (!IsSTSThread()) {
mLock.Lock();
locked = true;
} else {
mLock.AssertCurrentThreadOwns();
}
if (flags & MSG_NOTIFICATION) {
HandleNotification(static_cast<union sctp_notification *>(data), datalen);
} else {
HandleMessage(data, datalen, ntohl(rcv.rcv_ppid), rcv.rcv_sid);
}
if (locked) {
mLock.Unlock();
}
}
// sctp allocates 'data' with malloc(), and expects the receiver to free
// it (presumably with free).

View file

@ -173,27 +173,6 @@ function LOG(string) {
}
}
/**
* Gets a preference value, handling the case where there is no default.
* @param func
* The name of the preference function to call, on nsIPrefBranch
* @param preference
* The name of the preference
* @param defaultValue
* The default value to return in the event the preference has
* no setting
* @returns The value of the preference, or undefined if there was no
* user or default value.
*/
function getPref(func, preference, defaultValue) {
try {
return gPref[func](preference);
}
catch (e) {
}
return defaultValue;
}
/**
* Constructs a URI to a spec.
* @param spec
@ -302,9 +281,9 @@ function parseRegExp(aStr) {
function Blocklist() {
Services.obs.addObserver(this, "xpcom-shutdown", false);
Services.obs.addObserver(this, "sessionstore-windows-restored", false);
gLoggingEnabled = getPref("getBoolPref", PREF_EM_LOGGING_ENABLED, false);
gBlocklistEnabled = getPref("getBoolPref", PREF_BLOCKLIST_ENABLED, true);
gBlocklistLevel = Math.min(getPref("getIntPref", PREF_BLOCKLIST_LEVEL, DEFAULT_LEVEL),
gLoggingEnabled = Services.prefs.getBoolPref(PREF_EM_LOGGING_ENABLED, false);
gBlocklistEnabled = Services.prefs.getBoolPref(PREF_BLOCKLIST_ENABLED, true);
gBlocklistLevel = Math.min(Services.prefs.getIntPref(PREF_BLOCKLIST_LEVEL, DEFAULT_LEVEL),
MAX_BLOCK_LEVEL);
gPref.addObserver("extensions.blocklist.", this, false);
gPref.addObserver(PREF_EM_LOGGING_ENABLED, this, false);
@ -350,15 +329,15 @@ Blocklist.prototype = {
case "nsPref:changed":
switch (aData) {
case PREF_EM_LOGGING_ENABLED:
gLoggingEnabled = getPref("getBoolPref", PREF_EM_LOGGING_ENABLED, false);
gLoggingEnabled = Services.prefs.getBoolPref(PREF_EM_LOGGING_ENABLED, false);
break;
case PREF_BLOCKLIST_ENABLED:
gBlocklistEnabled = getPref("getBoolPref", PREF_BLOCKLIST_ENABLED, true);
gBlocklistEnabled = Services.prefs.getBoolPref(PREF_BLOCKLIST_ENABLED, true);
this._loadBlocklist();
this._blocklistUpdated(null, null);
break;
case PREF_BLOCKLIST_LEVEL:
gBlocklistLevel = Math.min(getPref("getIntPref", PREF_BLOCKLIST_LEVEL, DEFAULT_LEVEL),
gBlocklistLevel = Math.min(Services.prefs.getIntPref(PREF_BLOCKLIST_LEVEL, DEFAULT_LEVEL),
MAX_BLOCK_LEVEL);
this._blocklistUpdated(null, null);
break;
@ -530,8 +509,8 @@ Blocklist.prototype = {
return;
}
var pingCountVersion = getPref("getIntPref", PREF_BLOCKLIST_PINGCOUNTVERSION, 0);
var pingCountTotal = getPref("getIntPref", PREF_BLOCKLIST_PINGCOUNTTOTAL, 1);
var pingCountVersion = Services.prefs.getIntPref(PREF_BLOCKLIST_PINGCOUNTVERSION, 0);
var pingCountTotal = Services.prefs.getIntPref(PREF_BLOCKLIST_PINGCOUNTTOTAL, 1);
var daysSinceLastPing = 0;
if (pingCountVersion == 0) {
daysSinceLastPing = "new";
@ -540,7 +519,7 @@ Blocklist.prototype = {
// Seconds in one day is used because nsIUpdateTimerManager stores the
// last update time in seconds.
let secondsInDay = 60 * 60 * 24;
let lastUpdateTime = getPref("getIntPref", PREF_BLOCKLIST_LASTUPDATETIME, 0);
let lastUpdateTime = Services.prefs.getIntPref(PREF_BLOCKLIST_LASTUPDATETIME, 0);
if (lastUpdateTime == 0) {
daysSinceLastPing = "invalid";
}
@ -903,7 +882,7 @@ Blocklist.prototype = {
return;
}
var populateCertBlocklist = getPref("getBoolPref", PREF_ONECRL_VIA_AMO, true);
var populateCertBlocklist = Services.prefs.getBoolPref(PREF_ONECRL_VIA_AMO, true);
var childNodes = doc.documentElement.childNodes;
for (let element of childNodes) {
@ -1475,7 +1454,7 @@ Blocklist.prototype = {
Services.obs.addObserver(applyBlocklistChanges, "addon-blocklist-closed", false);
if (getPref("getBoolPref", PREF_BLOCKLIST_SUPPRESSUI, false)) {
if (Services.prefs.getBoolPref(PREF_BLOCKLIST_SUPPRESSUI, false)) {
applyBlocklistChanges();
return;
}

View file

@ -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

View file

@ -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);
};

View file

@ -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)" \
")" \
)

View file

@ -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" \
)

View file

@ -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);
}
}

View file

@ -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");

View file

@ -234,7 +234,7 @@ var LOG = function() {};
if (AppConstants.DEBUG) {
LOG = function (aText) {
if (getBoolPref(BROWSER_SEARCH_PREF + "log", false)) {
if (Services.prefs.getBoolPref(BROWSER_SEARCH_PREF + "log", false)) {
DO_LOG(aText);
}
};
@ -907,18 +907,6 @@ function getLocalizedPref(aPrefName, aDefault) {
return aDefault;
}
/**
* Wrapper for nsIPrefBranch::getBoolPref.
* @param aPrefName
* The name of the pref to get.
* @returns aDefault if the requested pref doesn't exist.
*/
function getBoolPref(aName, aDefault) {
if (Services.prefs.getPrefType(aName) != Ci.nsIPrefBranch.PREF_BOOL)
return aDefault;
return Services.prefs.getBoolPref(aName);
}
/**
* @return a sanitized name to be used as a filename, or a random name
* if a sanitized name cannot be obtained (if aName contains
@ -1534,7 +1522,7 @@ Engine.prototype = {
stringBundle.formatStringFromName("addEngineConfirmation",
[this._name, this._uri.host], 2);
var checkboxMessage = null;
if (!getBoolPref(BROWSER_SEARCH_PREF + "noCurrentEngine", false))
if (!Services.prefs.getBoolPref(BROWSER_SEARCH_PREF + "noCurrentEngine", false))
checkboxMessage = stringBundle.GetStringFromName("addEngineAsCurrentText");
var addButtonLabel =
@ -2658,7 +2646,7 @@ function checkForSyncCompletion(aPromise) {
// nsIBrowserSearchService
function SearchService() {
// Replace empty LOG function with the useful one if the log pref is set.
if (getBoolPref(BROWSER_SEARCH_PREF + "log", false))
if (Services.prefs.getBoolPref(BROWSER_SEARCH_PREF + "log", false))
LOG = DO_LOG;
this._initObservers = Promise.defer();
@ -3770,7 +3758,7 @@ SearchService.prototype = {
// If the user has specified a custom engine order, read the order
// information from the metadata instead of the default prefs.
if (getBoolPref(BROWSER_SEARCH_PREF + "useDBForOrder", false)) {
if (Services.prefs.getBoolPref(BROWSER_SEARCH_PREF + "useDBForOrder", false)) {
LOG("_buildSortedEngineList: using db for order");
// Flag to keep track of whether or not we need to call _saveSortedEngineList.
@ -4624,7 +4612,7 @@ SearchService.prototype = {
notify: function SRCH_SVC_notify(aTimer) {
LOG("_notify: checking for updates");
if (!getBoolPref(BROWSER_SEARCH_PREF + "update", true))
if (!Services.prefs.getBoolPref(BROWSER_SEARCH_PREF + "update", true))
return;
// Our timer has expired, but unfortunately, we can't get any data from it.
@ -4735,7 +4723,7 @@ const SEARCH_UPDATE_LOG_PREFIX = "*** Search update: ";
* logging pref (browser.search.update.log) is set to true.
*/
function ULOG(aText) {
if (getBoolPref(BROWSER_SEARCH_PREF + "update.log", false)) {
if (Services.prefs.getBoolPref(BROWSER_SEARCH_PREF + "update.log", false)) {
dump(SEARCH_UPDATE_LOG_PREFIX + aText + "\n");
Services.console.logStringMessage(aText);
}
@ -4751,7 +4739,7 @@ var engineUpdateService = {
update: function eus_Update(aEngine) {
let engine = aEngine.wrappedJSObject;
ULOG("update called for " + aEngine._name);
if (!getBoolPref(BROWSER_SEARCH_PREF + "update", true) || !engine._hasUpdates)
if (!Services.prefs.getBoolPref(BROWSER_SEARCH_PREF + "update", true) || !engine._hasUpdates)
return;
let testEngine = null;

View file

@ -248,7 +248,7 @@ function DO_LOG(aText) {
* to allow enabling/disabling without a restart.
*/
function PREF_LOG(aText) {
if (getBoolPref(BROWSER_SEARCH_PREF + "log", false))
if (Services.prefs.getBoolPref(BROWSER_SEARCH_PREF + "log", false))
DO_LOG(aText);
}
var LOG = PREF_LOG;
@ -933,18 +933,6 @@ function setLocalizedPref(aPrefName, aValue) {
} catch (ex) {}
}
/**
* Wrapper for nsIPrefBranch::getBoolPref.
* @param aPrefName
* The name of the pref to get.
* @returns aDefault if the requested pref doesn't exist.
*/
function getBoolPref(aName, aDefault) {
if (Services.prefs.getPrefType(aName) != Ci.nsIPrefBranch.PREF_BOOL)
return aDefault;
return Services.prefs.getBoolPref(aName);
}
/**
* Get a unique nsIFile object with a sanitized name, based on the engine name.
* @param aName
@ -1591,7 +1579,7 @@ Engine.prototype = {
stringBundle.formatStringFromName("addEngineConfirmation",
[this._name, this._uri.host], 2);
var checkboxMessage = null;
if (!getBoolPref(BROWSER_SEARCH_PREF + "noCurrentEngine", false))
if (!Services.prefs.getBoolPref(BROWSER_SEARCH_PREF + "noCurrentEngine", false))
checkboxMessage = stringBundle.GetStringFromName("addEngineAsCurrentText");
var addButtonLabel =
@ -2889,7 +2877,7 @@ function checkForSyncCompletion(aPromise) {
// nsIBrowserSearchService
function SearchService() {
// Replace empty LOG function with the useful one if the log pref is set.
if (getBoolPref(BROWSER_SEARCH_PREF + "log", false))
if (Services.prefs.getBoolPref(BROWSER_SEARCH_PREF + "log", false))
LOG = DO_LOG;
this._initObservers = Promise.defer();
@ -3814,7 +3802,7 @@ SearchService.prototype = {
// If the user has specified a custom engine order, read the order
// information from the engineMetadataService instead of the default
// prefs.
if (getBoolPref(BROWSER_SEARCH_PREF + "useDBForOrder", false)) {
if (Services.prefs.getBoolPref(BROWSER_SEARCH_PREF + "useDBForOrder", false)) {
LOG("_buildSortedEngineList: using db for order");
// Flag to keep track of whether or not we need to call _saveSortedEngineList.
@ -4595,7 +4583,7 @@ SearchService.prototype = {
notify: function SRCH_SVC_notify(aTimer) {
LOG("_notify: checking for updates");
if (!getBoolPref(BROWSER_SEARCH_PREF + "update", true))
if (!Services.prefs.getBoolPref(BROWSER_SEARCH_PREF + "update", true))
return;
// Our timer has expired, but unfortunately, we can't get any data from it.
@ -4938,7 +4926,7 @@ const SEARCH_UPDATE_LOG_PREFIX = "*** Search update: ";
* logging pref (browser.search.update.log) is set to true.
*/
function ULOG(aText) {
if (getBoolPref(BROWSER_SEARCH_PREF + "update.log", false)) {
if (Services.prefs.getBoolPref(BROWSER_SEARCH_PREF + "update.log", false)) {
dump(SEARCH_UPDATE_LOG_PREFIX + aText + "\n");
Services.console.logStringMessage(aText);
}
@ -4955,7 +4943,7 @@ var engineUpdateService = {
update: function eus_Update(aEngine) {
let engine = aEngine.wrappedJSObject;
ULOG("update called for " + aEngine._name);
if (!getBoolPref(BROWSER_SEARCH_PREF + "update", true) || !engine._hasUpdates)
if (!Services.prefs.getBoolPref(BROWSER_SEARCH_PREF + "update", true) || !engine._hasUpdates)
return;
let testEngine = null;

View file

@ -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) {

View file

@ -16,29 +16,9 @@ const PREF_APP_UPDATE_LOG = "app.update.log";
const CATEGORY_UPDATE_TIMER = "update-timer";
XPCOMUtils.defineLazyGetter(this, "gLogEnabled", function tm_gLogEnabled() {
return getPref("getBoolPref", PREF_APP_UPDATE_LOG, false);
return Services.prefs.getBoolPref(PREF_APP_UPDATE_LOG, false);
});
/**
* Gets a preference value, handling the case where there is no default.
* @param func
* The name of the preference function to call, on nsIPrefBranch
* @param preference
* The name of the preference
* @param defaultValue
* The default value to return in the event the preference has
* no setting
* @returns The value of the preference, or undefined if there was no
* user or default value.
*/
function getPref(func, preference, defaultValue) {
try {
return Services.prefs[func](preference);
} catch (e) {
}
return defaultValue;
}
/**
* Logs a string to the error console.
* @param string
@ -93,13 +73,13 @@ TimerManager.prototype = {
minInterval = 500;
minFirstInterval = 500;
case "profile-after-change":
this._timerMinimumDelay = Math.max(1000 * getPref("getIntPref", PREF_APP_UPDATE_TIMERMINIMUMDELAY, 120),
this._timerMinimumDelay = Math.max(1000 * Services.prefs.getIntPref(PREF_APP_UPDATE_TIMERMINIMUMDELAY, 120),
minInterval);
// Prevent the timer delay between notifications to other consumers from
// being greater than 5 minutes which is 300000 milliseconds.
this._timerMinimumDelay = Math.min(this._timerMinimumDelay, 300000);
// Prevent the first interval from being less than the value of minFirstInterval
let firstInterval = Math.max(getPref("getIntPref", PREF_APP_UPDATE_TIMERFIRSTINTERVAL,
let firstInterval = Math.max(Services.prefs.getIntPref(PREF_APP_UPDATE_TIMERFIRSTINTERVAL,
30000), minFirstInterval);
// Prevent the first interval from being greater than 2 minutes which is
// 120000 milliseconds.
@ -189,7 +169,7 @@ TimerManager.prototype = {
continue;
}
let interval = getPref("getIntPref", prefInterval, defaultInterval);
let interval = Services.prefs.getIntPref(prefInterval, defaultInterval);
// Allow the update-timer category to specify a maximum value to prevent
// values larger than desired.
maxInterval = parseInt(maxInterval);
@ -200,7 +180,7 @@ TimerManager.prototype = {
timerID);
// Initialize the last update time to 0 when the preference isn't set so
// the timer will be notified soon after a new profile's first use.
lastUpdateTime = getPref("getIntPref", prefLastUpdate, 0);
lastUpdateTime = Services.prefs.getIntPref(prefLastUpdate, 0);
// If the last update time is greater than the current time then reset
// it to 0 and the timer manager will correct the value when it fires
@ -315,7 +295,7 @@ TimerManager.prototype = {
let prefLastUpdate = PREF_APP_UPDATE_LASTUPDATETIME_FMT.replace(/%ID%/, id);
// Initialize the last update time to 0 when the preference isn't set so
// the timer will be notified soon after a new profile's first use.
let lastUpdateTime = getPref("getIntPref", prefLastUpdate, 0);
let lastUpdateTime = Services.prefs.getIntPref(prefLastUpdate, 0);
let now = Math.round(Date.now() / 1000);
if (lastUpdateTime > now) {
lastUpdateTime = 0;

View file

@ -84,28 +84,6 @@ function openUpdateURL(event) {
openURL(event.target.getAttribute("url"));
}
/**
* Gets a preference value, handling the case where there is no default.
* @param func
* The name of the preference function to call, on nsIPrefBranch
* @param preference
* The name of the preference
* @param defaultValue
* The default value to return in the event the preference has
* no setting
* @returns The value of the preference, or undefined if there was no
* user or default value.
*/
function getPref(func, preference, defaultValue) {
try {
return Services.prefs[func](preference);
}
catch (e) {
LOG("General", "getPref - failed to get preference: " + preference);
}
return defaultValue;
}
/**
* A set of shared data and control functions for the wizard as a whole.
*/
@ -320,7 +298,7 @@ var gUpdates = {
onLoad: function() {
this.wiz = document.documentElement;
gLogEnabled = getPref("getBoolPref", PREF_APP_UPDATE_LOG, false);
gLogEnabled = Services.prefs.getBoolPref(PREF_APP_UPDATE_LOG, false);
this.strings = document.getElementById("updateStrings");
var brandStrings = document.getElementById("brandStrings");
@ -601,7 +579,7 @@ var gNoUpdatesPage = {
LOG("gNoUpdatesPage", "onPageShow - could not select an appropriate " +
"update. Either there were no updates or |selectUpdate| failed");
if (getPref("getBoolPref", PREF_APP_UPDATE_ENABLED, true))
if (Services.prefs.getBoolPref(PREF_APP_UPDATE_ENABLED, true))
document.getElementById("noUpdatesAutoEnabled").hidden = false;
else
document.getElementById("noUpdatesAutoDisabled").hidden = false;
@ -1309,7 +1287,7 @@ var gFinishedPage = {
moreElevatedLinkLabel.setAttribute("hidden", "false");
}
if (getPref("getBoolPref", PREF_APP_UPDATE_TEST_LOOP, false)) {
if (Services.prefs.getBoolPref(PREF_APP_UPDATE_TEST_LOOP, false)) {
setTimeout(function () { gUpdates.wiz.getButton("finish").click(); },
UPDATE_TEST_LOOP_INTERVAL);
}

View file

@ -164,7 +164,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "UpdateUtils",
"resource://gre/modules/UpdateUtils.jsm");
XPCOMUtils.defineLazyGetter(this, "gLogEnabled", function aus_gLogEnabled() {
return getPref("getBoolPref", PREF_APP_UPDATE_LOG, false);
return Services.prefs.getBoolPref(PREF_APP_UPDATE_LOG, false);
});
XPCOMUtils.defineLazyGetter(this, "gUpdateBundle", function aus_gUpdateBundle() {
@ -494,7 +494,7 @@ XPCOMUtils.defineLazyGetter(this, "gCanStageUpdatesSession", function aus_gCSUS(
*/
function getCanStageUpdates() {
// If staging updates are disabled, then just bail out!
if (!getPref("getBoolPref", PREF_APP_UPDATE_STAGING_ENABLED, false)) {
if (!Services.prefs.getBoolPref(PREF_APP_UPDATE_STAGING_ENABLED, false)) {
LOG("getCanStageUpdates - staging updates is disabled by preference " +
PREF_APP_UPDATE_STAGING_ENABLED);
return false;
@ -514,7 +514,7 @@ XPCOMUtils.defineLazyGetter(this, "gCanCheckForUpdates", function aus_gCanCheckF
// If the administrator has disabled app update and locked the preference so
// users can't check for updates. This preference check is ok in this lazy
// getter since locked prefs don't change until the application is restarted.
var enabled = getPref("getBoolPref", PREF_APP_UPDATE_ENABLED, true);
var enabled = Services.prefs.getBoolPref(PREF_APP_UPDATE_ENABLED, true);
if (!enabled && Services.prefs.prefIsLocked(PREF_APP_UPDATE_ENABLED)) {
LOG("gCanCheckForUpdates - unable to automatically check for updates, " +
"the preference is disabled and admistratively locked.");
@ -550,27 +550,6 @@ function LOG(string) {
}
}
/**
* Gets a preference value, handling the case where there is no default.
* @param func
* The name of the preference function to call, on nsIPrefBranch
* @param preference
* The name of the preference
* @param defaultValue
* The default value to return in the event the preference has
* no setting
* @return The value of the preference, or undefined if there was no
* user or default value.
*/
function getPref(func, preference, defaultValue) {
try {
return Services.prefs[func](preference);
}
catch (e) {
}
return defaultValue;
}
/**
* Convert a string containing binary values to hex.
*/
@ -898,16 +877,15 @@ function handleUpdateFailure(update, errorCode) {
}
if (update.errorCode == ELEVATION_CANCELED) {
let cancelations = getPref("getIntPref", PREF_APP_UPDATE_CANCELATIONS, 0);
let cancelations = Services.prefs.getIntPref(PREF_APP_UPDATE_CANCELATIONS, 0);
cancelations++;
Services.prefs.setIntPref(PREF_APP_UPDATE_CANCELATIONS, cancelations);
if (AppConstants.platform == "macosx") {
let osxCancelations = getPref("getIntPref",
PREF_APP_UPDATE_CANCELATIONS_OSX, 0);
let osxCancelations = Services.prefs.getIntPref(PREF_APP_UPDATE_CANCELATIONS_OSX, 0);
osxCancelations++;
Services.prefs.setIntPref(PREF_APP_UPDATE_CANCELATIONS_OSX,
osxCancelations);
let maxCancels = getPref("getIntPref",
let maxCancels = Services.prefs.getIntPref(
PREF_APP_UPDATE_CANCELATIONS_OSX_MAX,
DEFAULT_CANCELATIONS_OSX_MAX);
// Prevent the preference from setting a value greater than 5.
@ -1177,8 +1155,8 @@ function Update(update) {
this.showNeverForVersion = false;
this.unsupported = false;
this.channel = "default";
this.promptWaitTime = getPref("getIntPref", PREF_APP_UPDATE_PROMPTWAITTIME, 43200);
this.backgroundInterval = getPref("getIntPref", PREF_APP_UPDATE_BACKGROUNDINTERVAL,
this.promptWaitTime = Services.prefs.getIntPref(PREF_APP_UPDATE_PROMPTWAITTIME, 43200);
this.backgroundInterval = Services.prefs.getIntPref(PREF_APP_UPDATE_BACKGROUNDINTERVAL,
DOWNLOAD_BACKGROUND_INTERVAL);
// Null <update>, assume this is a message container and do no
@ -1558,7 +1536,7 @@ UpdateService.prototype = {
break;
case "nsPref:changed":
if (data == PREF_APP_UPDATE_LOG) {
gLogEnabled = getPref("getBoolPref", PREF_APP_UPDATE_LOG, false);
gLogEnabled = Services.prefs.getBoolPref(PREF_APP_UPDATE_LOG, false);
}
break;
case "profile-change-net-teardown": // fall thru
@ -1795,11 +1773,11 @@ UpdateService.prototype = {
// Send the error code to telemetry
AUSTLMY.pingCheckExError(this._pingSuffix, update.errorCode);
update.errorCode = BACKGROUNDCHECK_MULTIPLE_FAILURES;
let errCount = getPref("getIntPref", PREF_APP_UPDATE_BACKGROUNDERRORS, 0);
let errCount = Services.prefs.getIntPref(PREF_APP_UPDATE_BACKGROUNDERRORS, 0);
errCount++;
Services.prefs.setIntPref(PREF_APP_UPDATE_BACKGROUNDERRORS, errCount);
// Don't allow the preference to set a value greater than 20 for max errors.
let maxErrors = Math.min(getPref("getIntPref", PREF_APP_UPDATE_BACKGROUNDMAXERRORS, 10), 20);
let maxErrors = Math.min(Services.prefs.getIntPref(PREF_APP_UPDATE_BACKGROUNDMAXERRORS, 10), 20);
if (errCount >= maxErrors) {
let prompter = Cc["@mozilla.org/updates/update-prompt;1"].
@ -1969,7 +1947,7 @@ UpdateService.prototype = {
AUSTLMY.pingCheckCode(this._pingSuffix,
AUSTLMY.CHK_INVALID_DEFAULT_URL);
}
} else if (!getPref("getBoolPref", PREF_APP_UPDATE_ENABLED, true)) {
} else if (!Services.prefs.getBoolPref(PREF_APP_UPDATE_ENABLED, true)) {
AUSTLMY.pingCheckCode(this._pingSuffix, AUSTLMY.CHK_PREF_DISABLED);
} else if (!hasUpdateMutex()) {
AUSTLMY.pingCheckCode(this._pingSuffix, AUSTLMY.CHK_NO_MUTEX);
@ -2027,7 +2005,7 @@ UpdateService.prototype = {
// (see bug 350636).
let neverPrefName = PREFBRANCH_APP_UPDATE_NEVER + aUpdate.appVersion;
if (aUpdate.showNeverForVersion &&
getPref("getBoolPref", neverPrefName, false)) {
Services.prefs.getBoolPref(neverPrefName, false)) {
LOG("UpdateService:selectUpdate - skipping update because the " +
"preference " + neverPrefName + " is true");
lastCheckCode = AUSTLMY.CHK_UPDATE_NEVER_PREF;
@ -2058,9 +2036,9 @@ UpdateService.prototype = {
let update = minorUpdate || majorUpdate;
if (AppConstants.platform == "macosx" && update) {
if (getElevationRequired()) {
let installAttemptVersion = getPref("getCharPref",
let installAttemptVersion = Services.prefs.getCharPref(
PREF_APP_UPDATE_ELEVATE_VERSION,
null);
"");
if (vc.compare(installAttemptVersion, update.appVersion) != 0) {
Services.prefs.setCharPref(PREF_APP_UPDATE_ELEVATE_VERSION,
update.appVersion);
@ -2072,12 +2050,9 @@ UpdateService.prototype = {
Services.prefs.clearUserPref(PREF_APP_UPDATE_ELEVATE_NEVER);
}
} else {
let numCancels = getPref("getIntPref",
PREF_APP_UPDATE_CANCELATIONS_OSX, 0);
let rejectedVersion = getPref("getCharPref",
PREF_APP_UPDATE_ELEVATE_NEVER, "");
let maxCancels = getPref("getIntPref",
PREF_APP_UPDATE_CANCELATIONS_OSX_MAX,
let numCancels = Services.prefs.getIntPref(PREF_APP_UPDATE_CANCELATIONS_OSX, 0);
let rejectedVersion = Services.prefs.getCharPref(PREF_APP_UPDATE_ELEVATE_NEVER, "");
let maxCancels = Services.prefs.getIntPref(PREF_APP_UPDATE_CANCELATIONS_OSX_MAX,
DEFAULT_CANCELATIONS_OSX_MAX);
if (numCancels >= maxCancels) {
LOG("UpdateService:selectUpdate - the user requires elevation to " +
@ -2136,7 +2111,7 @@ UpdateService.prototype = {
return;
}
var updateEnabled = getPref("getBoolPref", PREF_APP_UPDATE_ENABLED, true);
var updateEnabled = Services.prefs.getBoolPref(PREF_APP_UPDATE_ENABLED, true);
if (!updateEnabled) {
AUSTLMY.pingCheckCode(this._pingSuffix, AUSTLMY.CHK_PREF_DISABLED);
LOG("UpdateService:_selectAndInstallUpdate - not prompting because " +
@ -2152,7 +2127,7 @@ UpdateService.prototype = {
if (update.unsupported) {
LOG("UpdateService:_selectAndInstallUpdate - update not supported for " +
"this system");
if (!getPref("getBoolPref", PREF_APP_UPDATE_NOTIFIEDUNSUPPORTED, false)) {
if (!Services.prefs.getBoolPref(PREF_APP_UPDATE_NOTIFIEDUNSUPPORTED, false)) {
LOG("UpdateService:_selectAndInstallUpdate - notifying that the " +
"update is not supported for this system");
this._showPrompt(update);
@ -2193,7 +2168,7 @@ UpdateService.prototype = {
return;
}
if (!getPref("getBoolPref", PREF_APP_UPDATE_AUTO, true)) {
if (!Services.prefs.getBoolPref(PREF_APP_UPDATE_AUTO, true)) {
LOG("UpdateService:_selectAndInstallUpdate - prompting because silent " +
"install is disabled");
AUSTLMY.pingCheckCode(this._pingSuffix, AUSTLMY.CHK_SHOWPROMPT_PREF);
@ -2733,7 +2708,7 @@ UpdateManager.prototype = {
Services.obs.notifyObservers(null, "update-staged", update.state);
// Only prompt when the UI isn't already open.
let windowType = getPref("getCharPref", PREF_APP_UPDATE_ALTWINDOWTYPE, null);
let windowType = Services.prefs.getCharPref(PREF_APP_UPDATE_ALTWINDOWTYPE, "");
if (Services.wm.getMostRecentWindow(UPDATE_WINDOW_NAME) ||
windowType && Services.wm.getMostRecentWindow(windowType)) {
return;
@ -2813,15 +2788,12 @@ Checker.prototype = {
this._forced = force;
// Use the override URL if specified.
let url = getPref("getCharPref", PREF_APP_UPDATE_URL_OVERRIDE, null);
let url = Services.prefs.getCharPref(PREF_APP_UPDATE_URL_OVERRIDE, "");
// Otherwise, construct the update URL from component parts.
if (!url) {
try {
url = Services.prefs.getDefaultBranch(null).
getCharPref(PREF_APP_UPDATE_URL);
} catch (e) {
}
url = Services.prefs.getDefaultBranch(null).
getCharPref(PREF_APP_UPDATE_URL, "");
}
if (!url || url == "") {
@ -3016,7 +2988,7 @@ Checker.prototype = {
*/
_enabled: true,
get enabled() {
return getPref("getBoolPref", PREF_APP_UPDATE_ENABLED, true) &&
return Services.prefs.getBoolPref(PREF_APP_UPDATE_ENABLED, true) &&
gCanCheckForUpdates && hasUpdateMutex() && this._enabled;
},
@ -3502,11 +3474,11 @@ Downloader.prototype = {
var shouldRegisterOnlineObserver = false;
var shouldRetrySoon = false;
var deleteActiveUpdate = false;
var retryTimeout = getPref("getIntPref", PREF_APP_UPDATE_SOCKET_RETRYTIMEOUT,
var retryTimeout = Services.prefs.getIntPref(PREF_APP_UPDATE_SOCKET_RETRYTIMEOUT,
DEFAULT_SOCKET_RETRYTIMEOUT);
// Prevent the preference from setting a value greater than 10000.
retryTimeout = Math.min(retryTimeout, 10000);
var maxFail = getPref("getIntPref", PREF_APP_UPDATE_SOCKET_MAXERRORS,
var maxFail = Services.prefs.getIntPref(PREF_APP_UPDATE_SOCKET_MAXERRORS,
DEFAULT_SOCKET_MAX_ERRORS);
// Prevent the preference from setting a value greater than 20.
maxFail = Math.min(maxFail, 20);
@ -3762,7 +3734,7 @@ UpdatePrompt.prototype = {
* See nsIUpdateService.idl
*/
showUpdateAvailable: function UP_showUpdateAvailable(update) {
if (getPref("getBoolPref", PREF_APP_UPDATE_SILENT, false) ||
if (Services.prefs.getBoolPref(PREF_APP_UPDATE_SILENT, false) ||
this._getUpdateWindow() || this._getAltUpdateWindow()) {
return;
}
@ -3775,7 +3747,7 @@ UpdatePrompt.prototype = {
* See nsIUpdateService.idl
*/
showUpdateDownloaded: function UP_showUpdateDownloaded(update, background) {
if (background && getPref("getBoolPref", PREF_APP_UPDATE_SILENT, false)) {
if (background && Services.prefs.getBoolPref(PREF_APP_UPDATE_SILENT, false)) {
return;
}
// Trigger the display of the hamburger menu badge.
@ -3797,7 +3769,7 @@ UpdatePrompt.prototype = {
* See nsIUpdateService.idl
*/
showUpdateError: function UP_showUpdateError(update) {
if (getPref("getBoolPref", PREF_APP_UPDATE_SILENT, false) ||
if (Services.prefs.getBoolPref(PREF_APP_UPDATE_SILENT, false) ||
this._getAltUpdateWindow())
return;
@ -3840,7 +3812,7 @@ UpdatePrompt.prototype = {
* See nsIUpdateService.idl
*/
showUpdateElevationRequired: function UP_showUpdateElevationRequired() {
if (getPref("getBoolPref", PREF_APP_UPDATE_SILENT, false) ||
if (Services.prefs.getBoolPref(PREF_APP_UPDATE_SILENT, false) ||
this._getAltUpdateWindow()) {
return;
}
@ -3864,7 +3836,7 @@ UpdatePrompt.prototype = {
* application update user interface window.
*/
_getAltUpdateWindow: function UP__getAltUpdateWindow() {
let windowType = getPref("getCharPref", PREF_APP_UPDATE_ALTWINDOWTYPE, null);
let windowType = Services.prefs.getCharPref(PREF_APP_UPDATE_ALTWINDOWTYPE, "");
if (!windowType)
return null;
return Services.wm.getMostRecentWindow(windowType);
@ -3916,7 +3888,7 @@ UpdatePrompt.prototype = {
var idleService = Cc["@mozilla.org/widget/idleservice;1"].
getService(Ci.nsIIdleService);
// Don't allow the preference to set a value greater than 600 seconds for the idle time.
const IDLE_TIME = Math.min(getPref("getIntPref", PREF_APP_UPDATE_IDLETIME, 60), 600);
const IDLE_TIME = Math.min(Services.prefs.getIntPref(PREF_APP_UPDATE_IDLETIME, 60), 600);
if (idleService.idleTime / 1000 >= IDLE_TIME) {
this._showUI(parent, uri, features, name, page, update);
return;
@ -3961,7 +3933,7 @@ UpdatePrompt.prototype = {
getService(Ci.nsIIdleService);
// Don't allow the preference to set a value greater than 600 seconds for the idle time.
const IDLE_TIME = Math.min(getPref("getIntPref", PREF_APP_UPDATE_IDLETIME, 60), 600);
const IDLE_TIME = Math.min(Services.prefs.getIntPref(PREF_APP_UPDATE_IDLETIME, 60), 600);
if (idleService.idleTime / 1000 >= IDLE_TIME) {
this._showUI(parent, uri, features, name, page, update);
} else {

View file

@ -4134,9 +4134,12 @@ XRE_InitCommandLine(int aArgc, char* aArgv[])
#endif
const char *path = nullptr;
ArgResult ar = CheckArg("greomni", false, &path);
ArgResult ar = CheckArg("greomni", true, &path);
if (ar == ARG_BAD) {
PR_fprintf(PR_STDERR, "Error: argument --greomni requires a path argument\n");
PR_fprintf(PR_STDERR,
"Error: argument --greomni requires a path argument or the "
"--osint argument was specified with the --greomni argument "
"which is invalid.\n");
return NS_ERROR_FAILURE;
}
@ -4150,9 +4153,12 @@ XRE_InitCommandLine(int aArgc, char* aArgv[])
return rv;
}
ar = CheckArg("appomni", false, &path);
ar = CheckArg("appomni", true, &path);
if (ar == ARG_BAD) {
PR_fprintf(PR_STDERR, "Error: argument --appomni requires a path argument\n");
PR_fprintf(PR_STDERR,
"Error: argument --appomni requires a path argument or the "
"--osint argument was specified with the --appomni argument "
"which is invalid.\n");
return NS_ERROR_FAILURE;
}