Bug 592653 - script-generated patch to replace gPrefService with Services.prefs, r=Standard8.

This commit is contained in:
Florian Quèze 2017-12-19 23:45:10 +01:00
Родитель 10d90b6bb5
Коммит 1158645bdd
43 изменённых файлов: 209 добавлений и 209 удалений

Просмотреть файл

@ -244,7 +244,7 @@ var gXPInstallObserver = {
notificationID = "xpinstall-disabled";
let secondaryActions = null;
if (gPrefService.prefIsLocked("xpinstall.enabled")) {
if (Services.prefs.prefIsLocked("xpinstall.enabled")) {
messageString = gNavigatorBundle.getString("xpinstallDisabledMessageLocked");
} else {
messageString = gNavigatorBundle.getString("xpinstallDisabledMessage");
@ -253,7 +253,7 @@ var gXPInstallObserver = {
label: gNavigatorBundle.getString("xpinstallDisabledButton"),
accessKey: gNavigatorBundle.getString("xpinstallDisabledButton.accesskey"),
callback: function editPrefs() {
gPrefService.setBoolPref("xpinstall.enabled", true);
Services.prefs.setBoolPref("xpinstall.enabled", true);
}
};

Просмотреть файл

@ -216,8 +216,8 @@ var ctrlTab = {
prefName: "browser.ctrlTab.previews",
readPref: function ctrlTab_readPref() {
var enable =
gPrefService.getBoolPref(this.prefName) &&
!gPrefService.getBoolPref("browser.ctrlTab.disallowForScreenReaders", false);
Services.prefs.getBoolPref(this.prefName) &&
!Services.prefs.getBoolPref("browser.ctrlTab.disallowForScreenReaders", false);
if (enable)
this.init();

Просмотреть файл

@ -43,14 +43,14 @@ var PointerlockFsWarning = {
showPointerLock(aOrigin) {
if (!document.fullscreen) {
let timeout = gPrefService.getIntPref("pointer-lock-api.warning.timeout");
let timeout = Services.prefs.getIntPref("pointer-lock-api.warning.timeout");
this.show(aOrigin, "pointerlock-warning", timeout, 0);
}
},
showFullScreen(aOrigin) {
let timeout = gPrefService.getIntPref("full-screen-api.warning.timeout");
let delay = gPrefService.getIntPref("full-screen-api.warning.delay");
let timeout = Services.prefs.getIntPref("full-screen-api.warning.timeout");
let delay = Services.prefs.getIntPref("full-screen-api.warning.delay");
this.show(aOrigin, "fullscreen-warning", timeout, delay);
},
@ -529,7 +529,7 @@ var FullScreen = {
_isPopupOpen: false,
_isChromeCollapsed: false,
_safeToCollapse() {
if (!gPrefService.getBoolPref("browser.fullscreen.autohide"))
if (!Services.prefs.getBoolPref("browser.fullscreen.autohide"))
return false;
// a popup menu is open in chrome: don't collapse chrome
@ -573,10 +573,10 @@ var FullScreen = {
// Autohide helpers for the context menu item
getAutohide(aItem) {
aItem.setAttribute("checked", gPrefService.getBoolPref("browser.fullscreen.autohide"));
aItem.setAttribute("checked", Services.prefs.getBoolPref("browser.fullscreen.autohide"));
},
setAutohide() {
gPrefService.setBoolPref("browser.fullscreen.autohide", !gPrefService.getBoolPref("browser.fullscreen.autohide"));
Services.prefs.setBoolPref("browser.fullscreen.autohide", !Services.prefs.getBoolPref("browser.fullscreen.autohide"));
// Try again to hide toolbar when we change the pref.
FullScreen.hideNavToolbox(true);
},
@ -612,7 +612,7 @@ var FullScreen = {
this._fullScrToggler.hidden = false;
if (aAnimate && gPrefService.getBoolPref("toolkit.cosmeticAnimations.enabled")) {
if (aAnimate && Services.prefs.getBoolPref("toolkit.cosmeticAnimations.enabled")) {
gNavToolbox.setAttribute("fullscreenShouldAnimate", true);
// Hide the fullscreen toggler until the transition ends.
let listener = () => {

Просмотреть файл

@ -31,8 +31,8 @@ var FullZoom = {
get siteSpecific() {
if (this._siteSpecificPref === undefined) {
this._siteSpecificPref =
!gPrefService.getBoolPref("privacy.resistFingerprinting") &&
gPrefService.getBoolPref("browser.zoom.siteSpecific");
!Services.prefs.getBoolPref("privacy.resistFingerprinting") &&
Services.prefs.getBoolPref("browser.zoom.siteSpecific");
}
return this._siteSpecificPref;
},
@ -56,15 +56,15 @@ var FullZoom = {
this._cps2.addObserverForName(this.name, this);
this.updateBackgroundTabs =
gPrefService.getBoolPref("browser.zoom.updateBackgroundTabs");
Services.prefs.getBoolPref("browser.zoom.updateBackgroundTabs");
// Listen for changes to the browser.zoom branch so we can enable/disable
// updating background tabs and per-site saving and restoring of zoom levels.
gPrefService.addObserver("browser.zoom.", this, true);
Services.prefs.addObserver("browser.zoom.", this, true);
// Also need to listen to privacy.resistFingerprinting in order to update
// this._siteSpecificPref.
gPrefService.addObserver("privacy.resistFingerprinting", this, true);
Services.prefs.addObserver("privacy.resistFingerprinting", this, true);
// If we received onLocationChange events for any of the current browsers
// before we were initialized we want to replay those upon initialization.
@ -79,7 +79,7 @@ var FullZoom = {
},
destroy: function FullZoom_destroy() {
gPrefService.removeObserver("browser.zoom.", this);
Services.prefs.removeObserver("browser.zoom.", this);
this._cps2.removeObserverForName(this.name, this);
gBrowser.removeEventListener("ZoomChangeUsingMouseWheel", this);
},
@ -113,7 +113,7 @@ var FullZoom = {
break;
case "browser.zoom.updateBackgroundTabs":
this.updateBackgroundTabs =
gPrefService.getBoolPref("browser.zoom.updateBackgroundTabs");
Services.prefs.getBoolPref("browser.zoom.updateBackgroundTabs");
break;
}
break;

Просмотреть файл

@ -433,7 +433,7 @@ var gGestureSupport = {
getFunc = "Bool";
else if (type == "number")
getFunc = "Int";
return gPrefService["get" + getFunc + "Pref"](branch + aPref);
return Services.prefs["get" + getFunc + "Pref"](branch + aPref);
} catch (e) {
return aDef;
}
@ -1014,7 +1014,7 @@ var gHistorySwipeAnimation = {
* This limit is a global limit and is valid across all open tabs.
*/
_getMaxSnapshots: function HSA__getMaxSnapshots() {
return gPrefService.getIntPref("browser.snapshots.limit");
return Services.prefs.getIntPref("browser.snapshots.limit");
},
/**

Просмотреть файл

@ -108,10 +108,10 @@ var TrackingProtection = {
// Open the tracking protection introduction panel, if applicable.
if (this.enabledGlobally) {
let introCount = gPrefService.getIntPref("privacy.trackingprotection.introCount");
let introCount = Services.prefs.getIntPref("privacy.trackingprotection.introCount");
if (introCount < TrackingProtection.MAX_INTROS) {
gPrefService.setIntPref("privacy.trackingprotection.introCount", ++introCount);
gPrefService.savePrefFile(null);
Services.prefs.setIntPref("privacy.trackingprotection.introCount", ++introCount);
Services.prefs.savePrefFile(null);
this.showIntroPanel();
}
}
@ -188,9 +188,9 @@ var TrackingProtection = {
// This function may be called in private windows, but it does not change
// any preference unless Tracking Protection is enabled globally.
if (this.enabledGlobally) {
gPrefService.setIntPref("privacy.trackingprotection.introCount",
this.MAX_INTROS);
gPrefService.savePrefFile(null);
Services.prefs.setIntPref("privacy.trackingprotection.introCount",
this.MAX_INTROS);
Services.prefs.savePrefFile(null);
}
},

Просмотреть файл

@ -606,7 +606,7 @@ var gPopupBlockerObserver = {
// notifications are per-browser, we don't need to worry about re-adding
// it.
if (!gBrowser.selectedBrowser.blockedPopups.reported) {
if (gPrefService.getBoolPref("privacy.popups.showBrowserMessage")) {
if (Services.prefs.getBoolPref("privacy.popups.showBrowserMessage")) {
var brandBundle = document.getElementById("bundle_brand");
var brandShortName = brandBundle.getString("brandShortName");
var popupCount = gBrowser.selectedBrowser.blockedPopups.length;
@ -699,7 +699,7 @@ var gPopupBlockerObserver = {
blockedPopupAllowSite.removeAttribute("disabled");
let blockedPopupDontShowMessage = document.getElementById("blockedPopupDontShowMessage");
let showMessage = gPrefService.getBoolPref("privacy.popups.showBrowserMessage");
let showMessage = Services.prefs.getBoolPref("privacy.popups.showBrowserMessage");
blockedPopupDontShowMessage.setAttribute("checked", !showMessage);
blockedPopupDontShowMessage.setAttribute("label", gNavigatorBundle.getString("popupWarningDontShowFromMessage"));
@ -817,8 +817,8 @@ var gPopupBlockerObserver = {
},
dontShowMessage() {
var showMessage = gPrefService.getBoolPref("privacy.popups.showBrowserMessage");
gPrefService.setBoolPref("privacy.popups.showBrowserMessage", !showMessage);
var showMessage = Services.prefs.getBoolPref("privacy.popups.showBrowserMessage");
Services.prefs.setBoolPref("privacy.popups.showBrowserMessage", !showMessage);
gBrowser.getNotificationBox().removeCurrentNotification();
}
};
@ -1279,7 +1279,7 @@ var gBrowserInit = {
gDragSpaceObserver.init();
}
let isResistFingerprintingEnabled = gPrefService.getBoolPref("privacy.resistFingerprinting");
let isResistFingerprintingEnabled = Services.prefs.getBoolPref("privacy.resistFingerprinting");
// Set a sane starting width/height for all resolutions on new profiles.
if (isResistFingerprintingEnabled) {
@ -1445,7 +1445,7 @@ var gBrowserInit = {
BookmarkingUI.init();
AutoShowBookmarksToolbar.init();
gPrefService.addObserver(gHomeButton.prefDomain, gHomeButton);
Services.prefs.addObserver(gHomeButton.prefDomain, gHomeButton);
var homeButton = document.getElementById("home-button");
gHomeButton.updateTooltip(homeButton);
@ -1476,7 +1476,7 @@ var gBrowserInit = {
PlacesToolbarHelper.init();
ctrlTab.readPref();
gPrefService.addObserver(ctrlTab.prefName, ctrlTab);
Services.prefs.addObserver(ctrlTab.prefName, ctrlTab);
// The object handling the downloads indicator is initialized here in the
// delayed startup function, but the actual indicator element is not loaded
@ -1832,7 +1832,7 @@ var gBrowserInit = {
if (Win7Features)
Win7Features.onCloseWindow();
gPrefService.removeObserver(ctrlTab.prefName, ctrlTab);
Services.prefs.removeObserver(ctrlTab.prefName, ctrlTab);
ctrlTab.uninit();
gBrowserThumbnails.uninit();
FullZoom.destroy();
@ -1852,7 +1852,7 @@ var gBrowserInit = {
window.messageManager.removeMessageListener("Browser:LoadURI", RedirectLoad);
try {
gPrefService.removeObserver(gHomeButton.prefDomain, gHomeButton);
Services.prefs.removeObserver(gHomeButton.prefDomain, gHomeButton);
} catch (ex) {
Cu.reportError(ex);
}
@ -2085,7 +2085,7 @@ function BrowserBack(aEvent) {
}
function BrowserHandleBackspace() {
switch (gPrefService.getIntPref("browser.backspace_action")) {
switch (Services.prefs.getIntPref("browser.backspace_action")) {
case 0:
BrowserBack();
break;
@ -2096,7 +2096,7 @@ function BrowserHandleBackspace() {
}
function BrowserHandleShiftBackspace() {
switch (gPrefService.getIntPref("browser.backspace_action")) {
switch (Services.prefs.getIntPref("browser.backspace_action")) {
case 0:
BrowserForward();
break;
@ -2292,8 +2292,8 @@ var gLastOpenDirectory = {
get path() {
if (!this._lastDir || !this._lastDir.exists()) {
try {
this._lastDir = gPrefService.getComplexValue("browser.open.lastDir",
Ci.nsIFile);
this._lastDir = Services.prefs.getComplexValue("browser.open.lastDir",
Ci.nsIFile);
if (!this._lastDir.exists())
this._lastDir = null;
} catch (e) {}
@ -2311,8 +2311,8 @@ var gLastOpenDirectory = {
// Don't save the last open directory pref inside the Private Browsing mode
if (!PrivateBrowsingUtils.isWindowPrivate(window))
gPrefService.setComplexValue("browser.open.lastDir", Ci.nsIFile,
this._lastDir);
Services.prefs.setComplexValue("browser.open.lastDir", Ci.nsIFile,
this._lastDir);
},
reset() {
this._lastDir = null;
@ -2878,7 +2878,7 @@ function UpdatePopupNotificationsVisibility() {
}
function PageProxyClickHandler(aEvent) {
if (aEvent.button == 1 && gPrefService.getBoolPref("middlemouse.paste"))
if (aEvent.button == 1 && Services.prefs.getBoolPref("middlemouse.paste"))
middleMousePaste(aEvent);
}
@ -3085,7 +3085,7 @@ var BrowserOnClick = {
getMeOutOfHere();
break;
case "ignore_warning_link":
if (gPrefService.getBoolPref("browser.safebrowsing.allowOverride")) {
if (Services.prefs.getBoolPref("browser.safebrowsing.allowOverride")) {
if (sendTelemetry) {
secHistogram.add(nsISecTel[bucketName + "IGNORE_WARNING"]);
}
@ -3517,7 +3517,7 @@ var homeButtonObserver = {
},
onDragOver(aEvent) {
if (gPrefService.prefIsLocked("browser.startup.homepage")) {
if (Services.prefs.prefIsLocked("browser.startup.homepage")) {
return;
}
browserDragAndDrop.dragOver(aEvent);
@ -3542,7 +3542,7 @@ function openHomeDialog(aURL) {
if (pressedVal == 0) {
try {
gPrefService.setStringPref("browser.startup.homepage", aURL);
Services.prefs.setStringPref("browser.startup.homepage", aURL);
} catch (ex) {
dump("Failed to set the home page.\n" + ex + "\n");
}
@ -3846,7 +3846,7 @@ const BrowserSearch = {
},
loadAddEngines: function BrowserSearch_loadAddEngines() {
var newWindowPref = gPrefService.getIntPref("browser.link.open_newwindow");
var newWindowPref = Services.prefs.getIntPref("browser.link.open_newwindow");
var where = newWindowPref == 3 ? "tab" : "window";
openUILinkIn(this.searchEnginesURL, where);
},
@ -5146,7 +5146,7 @@ nsBrowserAccess.prototype = {
return win.gBrowser.selectedBrowser;
}
let loadInBackground = gPrefService.getBoolPref("browser.tabs.loadDivertedInBackground");
let loadInBackground = Services.prefs.getBoolPref("browser.tabs.loadDivertedInBackground");
let tab = win.gBrowser.loadOneTab(aURI ? aURI.spec : "about:blank", {
triggeringPrincipal: aTriggeringPrincipal,
@ -5208,10 +5208,10 @@ nsBrowserAccess.prototype = {
if (aWhere == Ci.nsIBrowserDOMWindow.OPEN_DEFAULTWINDOW) {
if (isExternal &&
gPrefService.prefHasUserValue("browser.link.open_newwindow.override.external"))
aWhere = gPrefService.getIntPref("browser.link.open_newwindow.override.external");
Services.prefs.prefHasUserValue("browser.link.open_newwindow.override.external"))
aWhere = Services.prefs.getIntPref("browser.link.open_newwindow.override.external");
else
aWhere = gPrefService.getIntPref("browser.link.open_newwindow");
aWhere = Services.prefs.getIntPref("browser.link.open_newwindow");
}
let referrer = aOpener ? makeURI(aOpener.location.href) : null;
@ -5268,7 +5268,7 @@ nsBrowserAccess.prototype = {
referrerPolicy,
});
}
if (!gPrefService.getBoolPref("browser.tabs.loadDivertedInBackground"))
if (!Services.prefs.getBoolPref("browser.tabs.loadDivertedInBackground"))
window.focus();
}
return newWindow;
@ -5552,11 +5552,11 @@ var gDragSpaceObserver = {
init() {
this.update();
gPrefService.addObserver(this.pref, this);
Services.prefs.addObserver(this.pref, this);
},
uninit() {
gPrefService.removeObserver(this.pref, this);
Services.prefs.removeObserver(this.pref, this);
},
observe(aSubject, aTopic, aPrefName) {
@ -5568,7 +5568,7 @@ var gDragSpaceObserver = {
},
update() {
if (gPrefService.getBoolPref(this.pref)) {
if (Services.prefs.getBoolPref(this.pref)) {
document.documentElement.setAttribute("extradragspace", "true");
} else {
document.documentElement.removeAttribute("extradragspace");
@ -5587,13 +5587,13 @@ var gUIDensity = {
init() {
this.update();
gPrefService.addObserver(this.uiDensityPref, this);
gPrefService.addObserver(this.autoTouchModePref, this);
Services.prefs.addObserver(this.uiDensityPref, this);
Services.prefs.addObserver(this.autoTouchModePref, this);
},
uninit() {
gPrefService.removeObserver(this.uiDensityPref, this);
gPrefService.removeObserver(this.autoTouchModePref, this);
Services.prefs.removeObserver(this.uiDensityPref, this);
Services.prefs.removeObserver(this.autoTouchModePref, this);
},
observe(aSubject, aTopic, aPrefName) {
@ -5610,14 +5610,14 @@ var gUIDensity = {
// Automatically override the uidensity to touch in Windows tablet mode.
if (AppConstants.isPlatformAndVersionAtLeast("win", "10") &&
WindowsUIUtils.inTabletMode &&
gPrefService.getBoolPref(this.autoTouchModePref)) {
Services.prefs.getBoolPref(this.autoTouchModePref)) {
return { mode: this.MODE_TOUCH, overridden: true };
}
return { mode: gPrefService.getIntPref(this.uiDensityPref), overridden: false };
return { mode: Services.prefs.getIntPref(this.uiDensityPref), overridden: false };
},
setCurrentMode(mode) {
gPrefService.setIntPref(this.uiDensityPref, mode);
Services.prefs.setIntPref(this.uiDensityPref, mode);
},
update(mode) {
@ -5680,8 +5680,8 @@ var gHomeButton = {
getHomePage() {
var url;
try {
url = gPrefService.getComplexValue(this.prefDomain,
Components.interfaces.nsIPrefLocalizedString).data;
url = Services.prefs.getComplexValue(this.prefDomain,
Components.interfaces.nsIPrefLocalizedString).data;
} catch (e) {
}
@ -5867,8 +5867,8 @@ function contentAreaClick(event, isPanelClick) {
if (!href) {
// Not a link, handle middle mouse navigation.
if (event.button == 1 &&
gPrefService.getBoolPref("middlemouse.contentLoadURL") &&
!gPrefService.getBoolPref("general.autoScroll")) {
Services.prefs.getBoolPref("middlemouse.contentLoadURL") &&
!Services.prefs.getBoolPref("general.autoScroll")) {
middleMousePaste(event);
event.preventDefault();
}
@ -6341,7 +6341,7 @@ var BrowserOffline = {
_uiElement: null,
_updateOfflineUI(aOffline) {
var offlineLocked = gPrefService.prefIsLocked("network.online");
var offlineLocked = Services.prefs.prefIsLocked("network.online");
if (offlineLocked)
this._uiElement.setAttribute("disabled", "true");
@ -8167,7 +8167,7 @@ function getBrowser() {
const gAccessibilityServiceIndicator = {
init() {
// Pref to enable accessibility service indicator.
gPrefService.addObserver("accessibility.indicator.enabled", this);
Services.prefs.addObserver("accessibility.indicator.enabled", this);
// Accessibility service init/shutdown event.
Services.obs.addObserver(this, "a11y-init-or-shutdown");
this.update(Services.appinfo.accessibilityEnabled);
@ -8202,7 +8202,7 @@ const gAccessibilityServiceIndicator = {
},
get enabled() {
return gPrefService.getBoolPref("accessibility.indicator.enabled");
return Services.prefs.getBoolPref("accessibility.indicator.enabled");
},
handleEvent({ key, type }) {
@ -8216,7 +8216,7 @@ const gAccessibilityServiceIndicator = {
},
uninit() {
gPrefService.removeObserver("accessibility.indicator.enabled", this);
Services.prefs.removeObserver("accessibility.indicator.enabled", this);
Services.obs.removeObserver(this, "a11y-init-or-shutdown");
this.update();
}

Просмотреть файл

@ -133,8 +133,8 @@ nsContextMenu.prototype = {
this.isFrameImage = document.getElementById("isFrameImage");
this.ellipsis = "\u2026";
try {
this.ellipsis = gPrefService.getComplexValue("intl.ellipsis",
Ci.nsIPrefLocalizedString).data;
this.ellipsis = Services.prefs.getComplexValue("intl.ellipsis",
Ci.nsIPrefLocalizedString).data;
} catch (e) { }
// Reset after "on-build-contextmenu" notification in case selection was
@ -433,7 +433,7 @@ nsContextMenu.prototype = {
this.onLink || this.onTextInput);
var showInspect = this.inTabBrowser &&
gPrefService.getBoolPref("devtools.inspector.enabled", true);
Services.prefs.getBoolPref("devtools.inspector.enabled", true);
this.showItem("context-viewsource", shouldShow);
this.showItem("context-viewinfo", shouldShow);
@ -1179,7 +1179,7 @@ nsContextMenu.prototype = {
// fallback to the old way if we don't see the headers quickly
var timeToWait =
gPrefService.getIntPref("browser.download.saveLinkAsFilenameTimeout");
Services.prefs.getIntPref("browser.download.saveLinkAsFilenameTimeout");
var timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
timer.initWithCallback(new timerCallback(), timeToWait,
timer.TYPE_ONE_SHOT);
@ -1383,8 +1383,8 @@ nsContextMenu.prototype = {
var locale = "-";
try {
locale = gPrefService.getComplexValue("intl.accept_languages",
Ci.nsIPrefLocalizedString).data;
locale = Services.prefs.getComplexValue("intl.accept_languages",
Ci.nsIPrefLocalizedString).data;
} catch (e) { }
var version = "-";
@ -1394,7 +1394,7 @@ nsContextMenu.prototype = {
uri = uri.replace(/%LOCALE%/, escape(locale)).replace(/%VERSION%/, version);
var newWindowPref = gPrefService.getIntPref("browser.link.open_newwindow");
var newWindowPref = Services.prefs.getIntPref("browser.link.open_newwindow");
var where = newWindowPref == 3 ? "tab" : "window";
openUILinkIn(uri, where);

Просмотреть файл

@ -17,15 +17,15 @@ function test() {
let tab2Zoom = ZoomManager.getZoomForBrowser(tab2.linkedBrowser);
is(tab2Zoom, tab1Zoom, "Zoom should affect background tabs");
gPrefService.setBoolPref("browser.zoom.updateBackgroundTabs", false);
Services.prefs.setBoolPref("browser.zoom.updateBackgroundTabs", false);
await FullZoom.reset();
gBrowser.selectedTab = tab1;
tab1Zoom = ZoomManager.getZoomForBrowser(tab1.linkedBrowser);
tab2Zoom = ZoomManager.getZoomForBrowser(tab2.linkedBrowser);
isnot(tab1Zoom, tab2Zoom, "Zoom should not affect background tabs");
if (gPrefService.prefHasUserValue("browser.zoom.updateBackgroundTabs"))
gPrefService.clearUserPref("browser.zoom.updateBackgroundTabs");
if (Services.prefs.prefHasUserValue("browser.zoom.updateBackgroundTabs"))
Services.prefs.clearUserPref("browser.zoom.updateBackgroundTabs");
await FullZoomHelper.removeTabAndWaitForLocationChange(tab1);
await FullZoomHelper.removeTabAndWaitForLocationChange(tab2);
})().then(finish, FullZoomHelper.failAndContinue(finish));

Просмотреть файл

@ -24,7 +24,7 @@ add_task(async function() {
});
// Tweak the expert mode pref
gPrefService.setBoolPref("browser.xul.error_pages.expert_bad_cert", true);
Services.prefs.setBoolPref("browser.xul.error_pages.expert_bad_cert", true);
promise = BrowserTestUtils.waitForErrorPage(gBrowser.selectedBrowser);
gBrowser.reload();
@ -39,6 +39,6 @@ add_task(async function() {
// Clean up
gBrowser.removeCurrentTab();
if (gPrefService.prefHasUserValue("browser.xul.error_pages.expert_bad_cert"))
gPrefService.clearUserPref("browser.xul.error_pages.expert_bad_cert");
if (Services.prefs.prefHasUserValue("browser.xul.error_pages.expert_bad_cert"))
Services.prefs.clearUserPref("browser.xul.error_pages.expert_bad_cert");
});

Просмотреть файл

@ -5,7 +5,7 @@ add_task(async function() {
isnot(document.activeElement, gURLBar.inputField, "location bar is not focused");
var tab = gBrowser.selectedTab;
gPrefService.setBoolPref("browser.tabs.closeWindowWithLastTab", false);
Services.prefs.setBoolPref("browser.tabs.closeWindowWithLastTab", false);
let tabClosedPromise = BrowserTestUtils.tabRemoved(tab);
EventUtils.synthesizeKey("w", { accelKey: true });
@ -15,6 +15,6 @@ add_task(async function() {
is(gBrowser.tabs.length, 1, "a new tab has been opened");
is(document.activeElement, gURLBar.inputField, "location bar is focused for the new tab");
if (gPrefService.prefHasUserValue("browser.tabs.closeWindowWithLastTab"))
gPrefService.clearUserPref("browser.tabs.closeWindowWithLastTab");
if (Services.prefs.prefHasUserValue("browser.tabs.closeWindowWithLastTab"))
Services.prefs.clearUserPref("browser.tabs.closeWindowWithLastTab");
});

Просмотреть файл

@ -5,15 +5,15 @@ function test() {
while (enumerator.hasMoreElements()) {
let win = enumerator.getNext();
if (win.content == contentWin) {
gPrefService.setBoolPref("browser.tabs.closeWindowWithLastTab", false);
Services.prefs.setBoolPref("browser.tabs.closeWindowWithLastTab", false);
win.gBrowser.removeCurrentTab();
ok(win.closed, "popup is closed");
// clean up
if (!win.closed)
win.close();
if (gPrefService.prefHasUserValue("browser.tabs.closeWindowWithLastTab"))
gPrefService.clearUserPref("browser.tabs.closeWindowWithLastTab");
if (Services.prefs.prefHasUserValue("browser.tabs.closeWindowWithLastTab"))
Services.prefs.clearUserPref("browser.tabs.closeWindowWithLastTab");
return;
}

Просмотреть файл

@ -7,8 +7,8 @@ function test() {
waitForExplicitFinish();
gPrefService.setBoolPref("browser.zoom.updateBackgroundTabs", true);
gPrefService.setBoolPref("browser.zoom.siteSpecific", true);
Services.prefs.setBoolPref("browser.zoom.updateBackgroundTabs", true);
Services.prefs.setBoolPref("browser.zoom.siteSpecific", true);
let uri = "http://example.org/browser/browser/base/content/test/general/dummy_page.html";
@ -31,11 +31,11 @@ function endTest() {
tab = null;
if (gPrefService.prefHasUserValue("browser.zoom.updateBackgroundTabs"))
gPrefService.clearUserPref("browser.zoom.updateBackgroundTabs");
if (Services.prefs.prefHasUserValue("browser.zoom.updateBackgroundTabs"))
Services.prefs.clearUserPref("browser.zoom.updateBackgroundTabs");
if (gPrefService.prefHasUserValue("browser.zoom.siteSpecific"))
gPrefService.clearUserPref("browser.zoom.siteSpecific");
if (Services.prefs.prefHasUserValue("browser.zoom.siteSpecific"))
Services.prefs.clearUserPref("browser.zoom.siteSpecific");
finish();
})();

Просмотреть файл

@ -10,8 +10,8 @@ function isUndoCloseEnabled() {
function test() {
waitForExplicitFinish();
gPrefService.setIntPref("browser.sessionstore.max_tabs_undo", 0);
gPrefService.clearUserPref("browser.sessionstore.max_tabs_undo");
Services.prefs.setIntPref("browser.sessionstore.max_tabs_undo", 0);
Services.prefs.clearUserPref("browser.sessionstore.max_tabs_undo");
is(numClosedTabs(), 0, "There should be 0 closed tabs.");
ok(!isUndoCloseEnabled(), "Undo Close Tab should be disabled.");

Просмотреть файл

@ -18,7 +18,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "PlacesTestUtils",
"resource://testing-common/PlacesTestUtils.jsm");
function setup() {
gPrefService.setBoolPref("browser.altClickSave", true);
Services.prefs.setBoolPref("browser.altClickSave", true);
let testPage =
"data:text/html," +
@ -40,7 +40,7 @@ async function clean_up() {
// Remove download history.
await PlacesTestUtils.clearHistory();
gPrefService.clearUserPref("browser.altClickSave");
Services.prefs.clearUserPref("browser.altClickSave");
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
}

Просмотреть файл

@ -42,10 +42,10 @@ var gTests = [
{
desc: "Shift+Alt left click",
setup() {
gPrefService.setBoolPref("browser.altClickSave", true);
Services.prefs.setBoolPref("browser.altClickSave", true);
},
clean() {
gPrefService.clearUserPref("browser.altClickSave");
Services.prefs.clearUserPref("browser.altClickSave");
},
event: { shiftKey: true,
altKey: true },
@ -57,10 +57,10 @@ var gTests = [
{
desc: "Shift+Alt left click on XLinks",
setup() {
gPrefService.setBoolPref("browser.altClickSave", true);
Services.prefs.setBoolPref("browser.altClickSave", true);
},
clean() {
gPrefService.clearUserPref("browser.altClickSave");
Services.prefs.clearUserPref("browser.altClickSave");
},
event: { shiftKey: true,
altKey: true },
@ -82,10 +82,10 @@ var gTests = [
{
desc: "Alt click",
setup() {
gPrefService.setBoolPref("browser.altClickSave", true);
Services.prefs.setBoolPref("browser.altClickSave", true);
},
clean() {
gPrefService.clearUserPref("browser.altClickSave");
Services.prefs.clearUserPref("browser.altClickSave");
},
event: { altKey: true },
targets: [ "commonlink", "maplink" ],
@ -96,10 +96,10 @@ var gTests = [
{
desc: "Alt click on XLinks",
setup() {
gPrefService.setBoolPref("browser.altClickSave", true);
Services.prefs.setBoolPref("browser.altClickSave", true);
},
clean() {
gPrefService.clearUserPref("browser.altClickSave");
Services.prefs.clearUserPref("browser.altClickSave");
},
event: { altKey: true },
targets: [ "mathxlink", "svgxlink" ],
@ -130,10 +130,10 @@ var gTests = [
{
desc: "Simple middle click openwin",
setup() {
gPrefService.setBoolPref("browser.tabs.opentabfor.middleclick", false);
Services.prefs.setBoolPref("browser.tabs.opentabfor.middleclick", false);
},
clean() {
gPrefService.clearUserPref("browser.tabs.opentabfor.middleclick");
Services.prefs.clearUserPref("browser.tabs.opentabfor.middleclick");
},
event: { button: 1 },
targets: [ "commonlink", "mathxlink", "svgxlink", "maplink" ],
@ -144,12 +144,12 @@ var gTests = [
{
desc: "Middle mouse paste",
setup() {
gPrefService.setBoolPref("middlemouse.contentLoadURL", true);
gPrefService.setBoolPref("general.autoScroll", false);
Services.prefs.setBoolPref("middlemouse.contentLoadURL", true);
Services.prefs.setBoolPref("general.autoScroll", false);
},
clean() {
gPrefService.clearUserPref("middlemouse.contentLoadURL");
gPrefService.clearUserPref("general.autoScroll");
Services.prefs.clearUserPref("middlemouse.contentLoadURL");
Services.prefs.clearUserPref("general.autoScroll");
},
event: { button: 1 },
targets: [ "emptylink" ],

Просмотреть файл

@ -1,5 +1,5 @@
add_task(async function() {
gPrefService.setBoolPref("browser.ctrlTab.previews", true);
Services.prefs.setBoolPref("browser.ctrlTab.previews", true);
BrowserTestUtils.addTab(gBrowser);
BrowserTestUtils.addTab(gBrowser);
@ -112,8 +112,8 @@ add_task(async function() {
}
// cleanup
if (gPrefService.prefHasUserValue("browser.ctrlTab.previews"))
gPrefService.clearUserPref("browser.ctrlTab.previews");
if (Services.prefs.prefHasUserValue("browser.ctrlTab.previews"))
Services.prefs.clearUserPref("browser.ctrlTab.previews");
/* private utility functions */
@ -150,7 +150,7 @@ add_task(async function() {
}
function canOpen() {
return gPrefService.getBoolPref("browser.ctrlTab.previews") && gBrowser.tabs.length > 2;
return Services.prefs.getBoolPref("browser.ctrlTab.previews") && gBrowser.tabs.length > 2;
}
function checkTabs(aTabs) {

Просмотреть файл

@ -342,14 +342,14 @@ function test_addCommand(prefName, id) {
cmd.setAttribute("oncommand", "this.callCount++;");
cmd.origPrefName = prefName;
cmd.origPrefValue = gPrefService.getCharPref(prefName);
gPrefService.setCharPref(prefName, id);
cmd.origPrefValue = Services.prefs.getCharPref(prefName);
Services.prefs.setCharPref(prefName, id);
return cmd;
}
function test_removeCommand(cmd) {
gPrefService.setCharPref(cmd.origPrefName, cmd.origPrefValue);
Services.prefs.setCharPref(cmd.origPrefName, cmd.origPrefValue);
test_commandset.removeChild(cmd);
}
@ -358,8 +358,8 @@ function test_latchedGesture(gesture, inc, dec, eventPrefix) {
let branch = test_prefBranch + gesture + ".";
// Put the gesture into latched mode.
let oldLatchedValue = gPrefService.getBoolPref(branch + "latched");
gPrefService.setBoolPref(branch + "latched", true);
let oldLatchedValue = Services.prefs.getBoolPref(branch + "latched");
Services.prefs.setBoolPref(branch + "latched", true);
// Install the test commands for increasing and decreasing motion.
let cmd = {
@ -372,7 +372,7 @@ function test_latchedGesture(gesture, inc, dec, eventPrefix) {
test_emitLatchedEvents(eventPrefix, -500, cmd);
// Restore the gesture to its original configuration.
gPrefService.setBoolPref(branch + "latched", oldLatchedValue);
Services.prefs.setBoolPref(branch + "latched", oldLatchedValue);
for (let dir in cmd)
test_removeCommand(cmd[dir]);
}
@ -382,12 +382,12 @@ function test_thresholdGesture(gesture, inc, dec, eventPrefix) {
let branch = test_prefBranch + gesture + ".";
// Disable latched mode for this gesture.
let oldLatchedValue = gPrefService.getBoolPref(branch + "latched");
gPrefService.setBoolPref(branch + "latched", false);
let oldLatchedValue = Services.prefs.getBoolPref(branch + "latched");
Services.prefs.setBoolPref(branch + "latched", false);
// Set the triggering threshold value to 50.
let oldThresholdValue = gPrefService.getIntPref(branch + "threshold");
gPrefService.setIntPref(branch + "threshold", 50);
let oldThresholdValue = Services.prefs.getIntPref(branch + "threshold");
Services.prefs.setIntPref(branch + "threshold", 50);
// Install the test commands for increasing and decreasing motion.
let cmdInc = test_addCommand(branch + inc, "test:incMotion");
@ -425,8 +425,8 @@ function test_thresholdGesture(gesture, inc, dec, eventPrefix) {
ok(cmdDec.callCount == 0, "Decreasing command was triggered");
// Restore the gesture to its original configuration.
gPrefService.setBoolPref(branch + "latched", oldLatchedValue);
gPrefService.setIntPref(branch + "threshold", oldThresholdValue);
Services.prefs.setBoolPref(branch + "latched", oldLatchedValue);
Services.prefs.setIntPref(branch + "threshold", oldThresholdValue);
test_removeCommand(cmdInc);
test_removeCommand(cmdDec);
}

Просмотреть файл

@ -19,7 +19,7 @@ add_task(async function() {
let s = new Sanitizer();
s.ignoreTimespan = false;
s.prefDomain = "privacy.cpd.";
var itemPrefs = gPrefService.getBranch(s.prefDomain);
var itemPrefs = Services.prefs.getBranch(s.prefDomain);
itemPrefs.setBoolPref("history", false);
itemPrefs.setBoolPref("downloads", false);
itemPrefs.setBoolPref("cache", false);

Просмотреть файл

@ -20,7 +20,7 @@ add_task(async function test() {
let s = new Sanitizer();
s.ignoreTimespan = false;
s.prefDomain = "privacy.cpd.";
var itemPrefs = gPrefService.getBranch(s.prefDomain);
var itemPrefs = Services.prefs.getBranch(s.prefDomain);
itemPrefs.setBoolPref("history", false);
itemPrefs.setBoolPref("downloads", false);
itemPrefs.setBoolPref("cache", false);

Просмотреть файл

@ -82,7 +82,7 @@ async function onHistoryReady() {
let s = new Sanitizer();
s.ignoreTimespan = false;
s.prefDomain = "privacy.cpd.";
var itemPrefs = gPrefService.getBranch(s.prefDomain);
var itemPrefs = Services.prefs.getBranch(s.prefDomain);
itemPrefs.setBoolPref("history", true);
itemPrefs.setBoolPref("downloads", true);
itemPrefs.setBoolPref("cache", false);

Просмотреть файл

@ -965,7 +965,7 @@ async function blankSlate() {
* Passed to is()
*/
function boolPrefIs(aPrefName, aExpectedVal, aMsg) {
is(gPrefService.getBoolPref("privacy." + aPrefName), aExpectedVal, aMsg);
is(Services.prefs.getBoolPref("privacy." + aPrefName), aExpectedVal, aMsg);
}
/**
@ -1008,7 +1008,7 @@ async function ensureDownloadsClearedState(aDownloadIDs, aShouldBeCleared) {
* Passed to is()
*/
function intPrefIs(aPrefName, aExpectedVal, aMsg) {
is(gPrefService.getIntPref("privacy." + aPrefName), aExpectedVal, aMsg);
is(Services.prefs.getIntPref("privacy." + aPrefName), aExpectedVal, aMsg);
}
/**

Просмотреть файл

@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
add_task(async function test() {
gPrefService.setBoolPref("browser.ctrlTab.previews", true);
Services.prefs.setBoolPref("browser.ctrlTab.previews", true);
let [origTab] = gBrowser.visibleTabs;
let tabOne = BrowserTestUtils.addTab(gBrowser);
@ -28,8 +28,8 @@ add_task(async function test() {
gBrowser.removeTab(tabOne);
gBrowser.removeTab(tabTwo);
if (gPrefService.prefHasUserValue("browser.ctrlTab.previews"))
gPrefService.clearUserPref("browser.ctrlTab.previews");
if (Services.prefs.prefHasUserValue("browser.ctrlTab.previews"))
Services.prefs.clearUserPref("browser.ctrlTab.previews");
});
function pressCtrlTab(aShiftKey) {

Просмотреть файл

@ -56,7 +56,7 @@ function promiseSanitizeHistory() {
let s = new Sanitizer();
s.prefDomain = "privacy.cpd.";
let prefs = gPrefService.getBranch(s.prefDomain);
let prefs = Services.prefs.getBranch(s.prefDomain);
prefs.setBoolPref("history", true);
prefs.setBoolPref("downloads", false);
prefs.setBoolPref("cache", false);

Просмотреть файл

@ -56,7 +56,7 @@ function setPrefs(cookies, pluginData) {
sanitizer = new Sanitizer();
sanitizer.ignoreTimespan = false;
sanitizer.prefDomain = "privacy.cpd.";
let itemPrefs = gPrefService.getBranch(sanitizer.prefDomain);
let itemPrefs = Services.prefs.getBranch(sanitizer.prefDomain);
itemPrefs.setBoolPref("history", false);
itemPrefs.setBoolPref("downloads", false);
itemPrefs.setBoolPref("cache", false);

Просмотреть файл

@ -60,12 +60,12 @@ add_task(async function() {
is(gURLBar.textValue, testURL, "gURLBar.textValue should be testURL after initial switch to deletedURLTab");
// simulate the user removing the whole url from the location bar
gPrefService.setBoolPref("browser.urlbar.clickSelectsAll", true);
Services.prefs.setBoolPref("browser.urlbar.clickSelectsAll", true);
await urlbarBackspace();
is(gURLBar.textValue, "", 'gURLBar.textValue should be "" (just set)');
if (gPrefService.prefHasUserValue("browser.urlbar.clickSelectsAll")) {
gPrefService.clearUserPref("browser.urlbar.clickSelectsAll");
if (Services.prefs.prefHasUserValue("browser.urlbar.clickSelectsAll")) {
Services.prefs.clearUserPref("browser.urlbar.clickSelectsAll");
}
}
@ -79,7 +79,7 @@ add_task(async function() {
is(gURLBar.textValue, testURL, "gURLBar.textValue should be testURL after initial switch to partialURLTab");
// simulate the user removing part of the url from the location bar
gPrefService.setBoolPref("browser.urlbar.clickSelectsAll", false);
Services.prefs.setBoolPref("browser.urlbar.clickSelectsAll", false);
let deleted = 0;
while (deleted < charsToDelete) {
@ -88,8 +88,8 @@ add_task(async function() {
}
is(gURLBar.textValue, testPartialURL, "gURLBar.textValue should be testPartialURL (just set)");
if (gPrefService.prefHasUserValue("browser.urlbar.clickSelectsAll")) {
gPrefService.clearUserPref("browser.urlbar.clickSelectsAll");
if (Services.prefs.prefHasUserValue("browser.urlbar.clickSelectsAll")) {
Services.prefs.clearUserPref("browser.urlbar.clickSelectsAll");
}
}

Просмотреть файл

@ -837,7 +837,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
break;
case (accel):
try {
suffix = gPrefService.getCharPref("browser.fixup.alternate.suffix");
suffix = Services.prefs.getCharPref("browser.fixup.alternate.suffix");
if (suffix.charAt(suffix.length - 1) != "/")
suffix += "/";
} catch (e) {

Просмотреть файл

@ -312,7 +312,7 @@ var gEditItemOverlay = {
let elt;
if (focusedElement === "preferred") {
/* eslint-disable no-undef */
elt = this._element(gPrefService.getCharPref("browser.bookmarks.editDialog.firstEditField"));
elt = this._element(Services.prefs.getCharPref("browser.bookmarks.editDialog.firstEditField"));
/* eslint-enable no-undef */
} else if (focusedElement === "first") {
elt = document.querySelector("textbox:not([collapsed=true])");

Просмотреть файл

@ -47,7 +47,7 @@ function sanitizeCache() {
s.ignoreTimespan = false;
s.prefDomain = "privacy.cpd.";
let prefs = gPrefService.getBranch(s.prefDomain);
let prefs = Services.prefs.getBranch(s.prefDomain);
prefs.setBoolPref("history", false);
prefs.setBoolPref("downloads", false);
prefs.setBoolPref("cache", true);

Просмотреть файл

@ -33,7 +33,7 @@ function test() {
function setupCleanSlate(win) {
win.gLastOpenDirectory.reset();
gPrefService.clearUserPref(kPrefName);
Services.prefs.clearUserPref(kPrefName);
}
setupCleanSlate(window);
@ -91,7 +91,7 @@ function test() {
// Test 3: the last open directory is set from a previous session, it should be used
// in normal mode
gPrefService.setComplexValue(kPrefName, Ci.nsIFile, dir1);
Services.prefs.setComplexValue(kPrefName, Ci.nsIFile, dir1);
is(nonPrivateWindow.gLastOpenDirectory.path.path, dir1.path,
"The pref set from last session should take effect outside the private browsing mode");
@ -101,7 +101,7 @@ function test() {
// Test 4: the last open directory is set from a previous session, it should be used
// in private browsing mode mode
gPrefService.setComplexValue(kPrefName, Ci.nsIFile, dir1);
Services.prefs.setComplexValue(kPrefName, Ci.nsIFile, dir1);
// test the private window
is(privateWindow.gLastOpenDirectory.path.path, dir1.path,
"The pref set from last session should take effect inside the private browsing mode");

Просмотреть файл

@ -6,11 +6,11 @@
// for the popup blocker menu.
add_task(async function test() {
let testURI = "http://mochi.test:8888/browser/browser/components/privatebrowsing/test/browser/popup.html";
let oldPopupPolicy = gPrefService.getBoolPref("dom.disable_open_during_load");
gPrefService.setBoolPref("dom.disable_open_during_load", true);
let oldPopupPolicy = Services.prefs.getBoolPref("dom.disable_open_during_load");
Services.prefs.setBoolPref("dom.disable_open_during_load", true);
registerCleanupFunction(() => {
gPrefService.setBoolPref("dom.disable_open_during_load", oldPopupPolicy);
Services.prefs.setBoolPref("dom.disable_open_during_load", oldPopupPolicy);
});
function testPopupBlockerMenuItem(aExpectedDisabled, aWindow, aCallback) {

Просмотреть файл

@ -69,7 +69,7 @@ add_task(async function() {
// get closed tab count
let count = ss.getClosedTabCount(window);
let max_tabs_undo = gPrefService.getIntPref("browser.sessionstore.max_tabs_undo");
let max_tabs_undo = Services.prefs.getIntPref("browser.sessionstore.max_tabs_undo");
ok(0 <= count && count <= max_tabs_undo,
"getClosedTabCount returns zero or at most max_tabs_undo");
@ -79,8 +79,8 @@ add_task(async function() {
await promiseBrowserLoaded(tab.linkedBrowser);
// make sure that the next closed tab will increase getClosedTabCount
gPrefService.setIntPref("browser.sessionstore.max_tabs_undo", max_tabs_undo + 1);
registerCleanupFunction(() => gPrefService.clearUserPref("browser.sessionstore.max_tabs_undo"));
Services.prefs.setIntPref("browser.sessionstore.max_tabs_undo", max_tabs_undo + 1);
registerCleanupFunction(() => Services.prefs.clearUserPref("browser.sessionstore.max_tabs_undo"));
// remove tab
await promiseRemoveTab(tab);

Просмотреть файл

@ -6,9 +6,9 @@
add_task(async function() {
// make sure that the next closed tab will increase getClosedTabCount
let max_tabs_undo = gPrefService.getIntPref("browser.sessionstore.max_tabs_undo");
gPrefService.setIntPref("browser.sessionstore.max_tabs_undo", max_tabs_undo + 1);
registerCleanupFunction(() => gPrefService.clearUserPref("browser.sessionstore.max_tabs_undo"));
let max_tabs_undo = Services.prefs.getIntPref("browser.sessionstore.max_tabs_undo");
Services.prefs.setIntPref("browser.sessionstore.max_tabs_undo", max_tabs_undo + 1);
registerCleanupFunction(() => Services.prefs.clearUserPref("browser.sessionstore.max_tabs_undo"));
// Empty the list of closed tabs.
while (ss.getClosedTabCount(window)) {

Просмотреть файл

@ -10,17 +10,17 @@ function test() {
"browser/components/sessionstore/test/browser_447951_sample.html#";
// Make sure the functionality added in bug 943339 doesn't affect the results
gPrefService.setIntPref("browser.sessionstore.max_serialize_back", -1);
gPrefService.setIntPref("browser.sessionstore.max_serialize_forward", -1);
Services.prefs.setIntPref("browser.sessionstore.max_serialize_back", -1);
Services.prefs.setIntPref("browser.sessionstore.max_serialize_forward", -1);
registerCleanupFunction(function() {
gPrefService.clearUserPref("browser.sessionstore.max_serialize_back");
gPrefService.clearUserPref("browser.sessionstore.max_serialize_forward");
Services.prefs.clearUserPref("browser.sessionstore.max_serialize_back");
Services.prefs.clearUserPref("browser.sessionstore.max_serialize_forward");
});
let tab = BrowserTestUtils.addTab(gBrowser);
promiseBrowserLoaded(tab.linkedBrowser).then(() => {
let tabState = { entries: [] };
let max_entries = gPrefService.getIntPref("browser.sessionhistory.max_entries");
let max_entries = Services.prefs.getIntPref("browser.sessionhistory.max_entries");
for (let i = 0; i < max_entries; i++)
tabState.entries.push({ url: baseURL + i, triggeringPrincipal_base64});

Просмотреть файл

@ -34,8 +34,8 @@ function test() {
// Open a window and add the above closed tab list.
let newWin = openDialog(location, "", "chrome,all,dialog=no");
promiseWindowLoaded(newWin).then(() => {
gPrefService.setIntPref("browser.sessionstore.max_tabs_undo",
test_state.windows[0]._closedTabs.length);
Services.prefs.setIntPref("browser.sessionstore.max_tabs_undo",
test_state.windows[0]._closedTabs.length);
ss.setWindowState(newWin, JSON.stringify(test_state), true);
let closedTabs = SessionStore.getClosedTabData(newWin, false);
@ -78,7 +78,7 @@ function test() {
"... and tabs not specifically forgetten weren't");
// Clean up.
gPrefService.clearUserPref("browser.sessionstore.max_tabs_undo");
Services.prefs.clearUserPref("browser.sessionstore.max_tabs_undo");
BrowserTestUtils.closeWindow(newWin).then(finish);
});
}

Просмотреть файл

@ -54,8 +54,8 @@ add_task(async function() {
// open a window and add the above closed tab list
let newWin = openDialog(location, "", "chrome,all,dialog=no");
await promiseWindowLoaded(newWin);
gPrefService.setIntPref("browser.sessionstore.max_tabs_undo",
test_state.windows[0]._closedTabs.length);
Services.prefs.setIntPref("browser.sessionstore.max_tabs_undo",
test_state.windows[0]._closedTabs.length);
ss.setWindowState(newWin, JSON.stringify(test_state), true);
let closedTabs = JSON.parse(ss.getClosedTabData(newWin));
@ -77,6 +77,6 @@ add_task(async function() {
is(countByTitle(closedTabs, REMEMBER), remember_count,
"... and tabs to be remembered weren't.");
// clean up
gPrefService.clearUserPref("browser.sessionstore.max_tabs_undo");
Services.prefs.clearUserPref("browser.sessionstore.max_tabs_undo");
await BrowserTestUtils.closeWindow(newWin);
});

Просмотреть файл

@ -81,8 +81,8 @@ function test() {
// open a window and add the above closed window list
let newWin = openDialog(location, "_blank", "chrome,all,dialog=no");
promiseWindowLoaded(newWin).then(() => {
gPrefService.setIntPref("browser.sessionstore.max_windows_undo",
test_state._closedWindows.length);
Services.prefs.setIntPref("browser.sessionstore.max_windows_undo",
test_state._closedWindows.length);
ss.setWindowState(newWin, JSON.stringify(test_state), true);
let closedWindows = JSON.parse(ss.getClosedWindowData());
@ -113,7 +113,7 @@ function test() {
"... and windows not specifically forgetten weren't.");
// clean up
gPrefService.clearUserPref("browser.sessionstore.max_windows_undo");
Services.prefs.clearUserPref("browser.sessionstore.max_windows_undo");
BrowserTestUtils.closeWindow(newWin).then(finish);
});
}

Просмотреть файл

@ -38,7 +38,7 @@ function test() {
const PREF_INTERVAL = "browser.sessionstore.interval";
// make sure sessionstore.js is saved ASAP on all events
gPrefService.setIntPref(PREF_INTERVAL, 0);
Services.prefs.setIntPref(PREF_INTERVAL, 0);
// get the initial sessionstore.js mtime (-1 if it doesn't exist yet)
let mtime0 = getSessionstorejsModificationTime();
@ -62,8 +62,8 @@ function test() {
"tab selection and scrolling: sessionstore.js not updated");
// ok, done, cleanup and finish
if (gPrefService.prefHasUserValue(PREF_INTERVAL))
gPrefService.clearUserPref(PREF_INTERVAL);
if (Services.prefs.prefHasUserValue(PREF_INTERVAL))
Services.prefs.clearUserPref(PREF_INTERVAL);
gBrowser.removeTab(tab);
finish();
}, 3500); // end of sleep after tab selection and scrolling

Просмотреть файл

@ -7,8 +7,8 @@ const WINDOW_ATTRIBUTES = ["width", "height", "screenX", "screenY", "sizemode"];
var stateBackup = ss.getBrowserState();
var originalWarnOnClose = gPrefService.getBoolPref("browser.tabs.warnOnClose");
var originalStartupPage = gPrefService.getIntPref("browser.startup.page");
var originalWarnOnClose = Services.prefs.getBoolPref("browser.tabs.warnOnClose");
var originalStartupPage = Services.prefs.getIntPref("browser.startup.page");
var originalWindowType = document.documentElement.getAttribute("windowtype");
var gotLastWindowClosedTopic = false;
@ -108,9 +108,9 @@ function test() {
requestLongerTimeout(2);
// We don't want the quit dialog pref
gPrefService.setBoolPref("browser.tabs.warnOnClose", false);
Services.prefs.setBoolPref("browser.tabs.warnOnClose", false);
// Ensure that we would restore the session (important for Windows)
gPrefService.setIntPref("browser.startup.page", 3);
Services.prefs.setIntPref("browser.startup.page", 3);
runNextTestOrFinish();
}
@ -121,8 +121,8 @@ function runNextTestOrFinish() {
} else {
// some state is cleaned up at the end of each test, but not all
["browser.tabs.warnOnClose", "browser.startup.page"].forEach(function(p) {
if (gPrefService.prefHasUserValue(p))
gPrefService.clearUserPref(p);
if (Services.prefs.prefHasUserValue(p))
Services.prefs.clearUserPref(p);
});
ss.setBrowserState(stateBackup);

Просмотреть файл

@ -32,7 +32,7 @@ add_task(async function() {
};
const maxTabsUndo = 4;
gPrefService.setIntPref("browser.sessionstore.max_tabs_undo", maxTabsUndo);
Services.prefs.setIntPref("browser.sessionstore.max_tabs_undo", maxTabsUndo);
// Open a new window and restore it to an initial state.
let win = await promiseNewWindowLoaded({private: false});
@ -64,7 +64,7 @@ add_task(async function() {
}
// Clean up.
gPrefService.clearUserPref("browser.sessionstore.max_tabs_undo");
Services.prefs.clearUserPref("browser.sessionstore.max_tabs_undo");
await BrowserTestUtils.closeWindow(win);
});

Просмотреть файл

@ -117,12 +117,12 @@ function test() {
// and we will assume it is default.
Services.prefs.clearUserPref("browser.startup.page");
if (gPrefService.prefHasUserValue(PREF_MSTONE)) {
gOriginalMStone = gPrefService.getCharPref(PREF_MSTONE);
if (Services.prefs.prefHasUserValue(PREF_MSTONE)) {
gOriginalMStone = Services.prefs.getCharPref(PREF_MSTONE);
}
if (gPrefService.prefHasUserValue(PREF_OVERRIDE_URL)) {
gOriginalOverrideURL = gPrefService.getCharPref(PREF_OVERRIDE_URL);
if (Services.prefs.prefHasUserValue(PREF_OVERRIDE_URL)) {
gOriginalOverrideURL = Services.prefs.getCharPref(PREF_OVERRIDE_URL);
}
testDefaultArgs();
@ -174,17 +174,17 @@ function finish_test() {
// Reset browser.startup.homepage_override.mstone to the original value or
// clear it if it didn't exist.
if (gOriginalMStone) {
gPrefService.setCharPref(PREF_MSTONE, gOriginalMStone);
} else if (gPrefService.prefHasUserValue(PREF_MSTONE)) {
gPrefService.clearUserPref(PREF_MSTONE);
Services.prefs.setCharPref(PREF_MSTONE, gOriginalMStone);
} else if (Services.prefs.prefHasUserValue(PREF_MSTONE)) {
Services.prefs.clearUserPref(PREF_MSTONE);
}
// Reset startup.homepage_override_url to the original value or clear it if
// it didn't exist.
if (gOriginalOverrideURL) {
gPrefService.setCharPref(PREF_OVERRIDE_URL, gOriginalOverrideURL);
} else if (gPrefService.prefHasUserValue(PREF_OVERRIDE_URL)) {
gPrefService.clearUserPref(PREF_OVERRIDE_URL);
Services.prefs.setCharPref(PREF_OVERRIDE_URL, gOriginalOverrideURL);
} else if (Services.prefs.prefHasUserValue(PREF_OVERRIDE_URL)) {
Services.prefs.clearUserPref(PREF_OVERRIDE_URL);
}
writeUpdatesToXMLFile(XML_EMPTY);
@ -200,9 +200,9 @@ function testDefaultArgs() {
// if it isn't already set.
Cc["@mozilla.org/browser/clh;1"].getService(Ci.nsIBrowserHandler).defaultArgs;
let originalMstone = gPrefService.getCharPref(PREF_MSTONE);
let originalMstone = Services.prefs.getCharPref(PREF_MSTONE);
gPrefService.setCharPref(PREF_OVERRIDE_URL, DEFAULT_PREF_URL);
Services.prefs.setCharPref(PREF_OVERRIDE_URL, DEFAULT_PREF_URL);
writeUpdatesToXMLFile(XML_EMPTY);
reloadUpdateManagerData();
@ -240,11 +240,11 @@ function testDefaultArgs() {
}
if (testCase.noMstoneChange === undefined) {
gPrefService.setCharPref(PREF_MSTONE, "PreviousMilestone");
Services.prefs.setCharPref(PREF_MSTONE, "PreviousMilestone");
}
if (testCase.noPostUpdatePref == undefined) {
gPrefService.setBoolPref(PREF_POSTUPDATE, true);
Services.prefs.setBoolPref(PREF_POSTUPDATE, true);
}
let defaultArgs = Cc["@mozilla.org/browser/clh;1"].
@ -252,13 +252,13 @@ function testDefaultArgs() {
is(defaultArgs, overrideArgs, "correct value returned by defaultArgs");
if (testCase.noMstoneChange === undefined || testCase.noMstoneChange != true) {
let newMstone = gPrefService.getCharPref(PREF_MSTONE);
let newMstone = Services.prefs.getCharPref(PREF_MSTONE);
is(originalMstone, newMstone, "preference " + PREF_MSTONE +
" should have been updated");
}
if (gPrefService.prefHasUserValue(PREF_POSTUPDATE)) {
gPrefService.clearUserPref(PREF_POSTUPDATE);
if (Services.prefs.prefHasUserValue(PREF_POSTUPDATE)) {
Services.prefs.clearUserPref(PREF_POSTUPDATE);
}
}
@ -324,7 +324,7 @@ function testShowNotification() {
}
reloadUpdateManagerData();
gPrefService.setBoolPref(PREF_POSTUPDATE, true);
Services.prefs.setBoolPref(PREF_POSTUPDATE, true);
gBG.observe(null, "browser-glue-test", "post-update-notification");
@ -367,7 +367,7 @@ function testShowNotification() {
ok(!updateBox, "Update notification box should not have been displayed");
}
let prefHasUserValue = gPrefService.prefHasUserValue(PREF_POSTUPDATE);
let prefHasUserValue = Services.prefs.prefHasUserValue(PREF_POSTUPDATE);
is(prefHasUserValue, false, "preference " + PREF_POSTUPDATE +
" shouldn't have a user value");
}

Просмотреть файл

@ -19,7 +19,7 @@ function test() {
waitForExplicitFinish();
gPrefService.setBoolPref(ENABLE_PREF_NAME, true);
Services.prefs.setBoolPref(ENABLE_PREF_NAME, true);
is(1, AeroPeek.windows.length, "Got the expected number of windows");
@ -34,10 +34,10 @@ function test() {
for (let preview of AeroPeek.previews)
ok(preview.visible, "Preview is shown as expected");
gPrefService.setBoolPref(ENABLE_PREF_NAME, false);
Services.prefs.setBoolPref(ENABLE_PREF_NAME, false);
is(0, AeroPeek.previews.length, "Should have 0 previews when disabled");
gPrefService.setBoolPref(ENABLE_PREF_NAME, true);
Services.prefs.setBoolPref(ENABLE_PREF_NAME, true);
checkPreviews(4, "Previews are back when re-enabling");
for (let preview of AeroPeek.previews)
ok(preview.visible, "Preview is shown as expected after re-enabling");
@ -78,8 +78,8 @@ function test() {
getPreviewForTab(gBrowser.tabs[1]).controller.onClose();
checkPreviews(1);
if (gPrefService.prefHasUserValue(ENABLE_PREF_NAME))
gPrefService.setBoolPref(ENABLE_PREF_NAME, !gPrefService.getBoolPref(ENABLE_PREF_NAME));
if (Services.prefs.prefHasUserValue(ENABLE_PREF_NAME))
Services.prefs.setBoolPref(ENABLE_PREF_NAME, !Services.prefs.getBoolPref(ENABLE_PREF_NAME));
finish();

Просмотреть файл

@ -75,7 +75,7 @@ function promiseClearHistory(aUseRange) {
let s = new Sanitizer();
s.prefDomain = "privacy.cpd.";
let prefs = gPrefService.getBranch(s.prefDomain);
let prefs = Services.prefs.getBranch(s.prefDomain);
prefs.setBoolPref("history", true);
prefs.setBoolPref("downloads", false);
prefs.setBoolPref("cache", false);