Bug 718255 - Merge nsIPrefBranch2 with nsIPrefBranch - Part D, remove uses of nsIPrefBranch2 in browser/ and mobile/ ; r=bsmedberg

This commit is contained in:
Geoff Lankow 2012-01-17 14:34:51 +13:00
parent a825a1156c
commit 8c5fdd1d03
16 changed files with 26 additions and 36 deletions

View File

@ -407,7 +407,7 @@ function clearAllPrefsForStudy(studyId) {
dump("Looking for prefs to delete...\n");
let prefService = Cc["@mozilla.org/preferences-service;1"]
.getService(Ci.nsIPrefService)
.QueryInterface(Ci.nsIPrefBranch2);
.QueryInterface(Ci.nsIPrefBranch);
let prefStem = "extensions.testpilot";
let prefNames = prefService.getChildList(prefStem);
for each (let prefName in prefNames) {
@ -783,4 +783,4 @@ function testSameGUIDs() {
}
// TODO test for continuity of GUID with recurring study (longitudinal) - i don't think this
// has actually been working so far because a new GUID is generted every time the study starts up...
// has actually been working so far because a new GUID is generted every time the study starts up...

View File

@ -794,7 +794,7 @@ function selectSaveFolder()
fp.init(window, titleText, nsIFilePicker.modeGetFolder);
try {
var prefs = Components.classes[PREFERENCES_CONTRACTID]
.getService(Components.interfaces.nsIPrefBranch2);
.getService(Components.interfaces.nsIPrefBranch);
var initialDir = prefs.getComplexValue("browser.download.dir", nsILocalFile);
if (initialDir)
@ -1104,7 +1104,7 @@ function makeBlockImage(url)
var permissionManager = Components.classes[PERMISSION_CONTRACTID]
.getService(nsIPermissionManager);
var prefs = Components.classes[PREFERENCES_CONTRACTID]
.getService(Components.interfaces.nsIPrefBranch2);
.getService(Components.interfaces.nsIPrefBranch);
var checkbox = document.getElementById("blockImage");
var imagePref = prefs.getIntPref("permissions.default.image");

View File

@ -99,7 +99,7 @@ var permissionObserver = {
function onLoadPermission()
{
gPrefs = Components.classes[PREFERENCES_CONTRACTID]
.getService(Components.interfaces.nsIPrefBranch2);
.getService(Components.interfaces.nsIPrefBranch);
var uri = gDocument.documentURIObject;
var permTab = document.getElementById("permTab");

View File

@ -233,7 +233,7 @@ Sanitizer.prototype = {
// Clear last URL of the Open Web Location dialog
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch2);
.getService(Components.interfaces.nsIPrefBranch);
try {
prefs.clearUserPref("general.open_location.last_url");
}

View File

@ -82,8 +82,7 @@
<constructor><![CDATA[
this._prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefService)
.getBranch("browser.urlbar.")
.QueryInterface(Components.interfaces.nsIPrefBranch2);
.getBranch("browser.urlbar.");
this._prefs.addObserver("", this, false);
this.clickSelectsAll = this._prefs.getBoolPref("clickSelectsAll");

View File

@ -1164,7 +1164,7 @@ FeedWriter.prototype = {
// Set up the subscription UI
this._initSubscriptionUI();
var prefs = Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefBranch2);
getService(Ci.nsIPrefBranch);
prefs.addObserver(PREF_SELECTED_ACTION, this, false);
prefs.addObserver(PREF_SELECTED_READER, this, false);
prefs.addObserver(PREF_SELECTED_WEB, this, false);
@ -1207,7 +1207,7 @@ FeedWriter.prototype = {
this._document = null;
this._window = null;
var prefs = Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefBranch2);
getService(Ci.nsIPrefBranch);
prefs.removeObserver(PREF_SELECTED_ACTION, this);
prefs.removeObserver(PREF_SELECTED_READER, this);
prefs.removeObserver(PREF_SELECTED_WEB, this);

View File

@ -221,11 +221,8 @@ HandlerInfoWrapper.prototype = {
_handlerSvc: Cc["@mozilla.org/uriloader/handler-service;1"].
getService(Ci.nsIHandlerService),
// Retrieve this as nsIPrefBranch and then immediately QI to nsIPrefBranch2
// so both interfaces are available to callers.
_prefSvc: Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefBranch).
QueryInterface(Ci.nsIPrefBranch2),
getService(Ci.nsIPrefBranch),
_categoryMgr: Cc["@mozilla.org/categorymanager;1"].
getService(Ci.nsICategoryManager),
@ -885,11 +882,8 @@ var gApplicationsPane = {
_list : null,
_filter : null,
// Retrieve this as nsIPrefBranch and then immediately QI to nsIPrefBranch2
// so both interfaces are available to callers.
_prefSvc : Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefBranch).
QueryInterface(Ci.nsIPrefBranch2),
getService(Ci.nsIPrefBranch),
_mimeSvc : Cc["@mozilla.org/mime;1"].
getService(Ci.nsIMIMEService),

View File

@ -236,7 +236,7 @@ var gPrivacyPane = {
{
let prefService = document.getElementById("privacyPreferences")
.service
.QueryInterface(Components.interfaces.nsIPrefBranch2);
.QueryInterface(Components.interfaces.nsIPrefBranch);
prefService.addObserver("browser.privatebrowsing.autostart",
this.autoStartPrivateBrowsingObserver,
false);
@ -249,7 +249,7 @@ var gPrivacyPane = {
{
let prefService = document.getElementById("privacyPreferences")
.service
.QueryInterface(Components.interfaces.nsIPrefBranch2);
.QueryInterface(Components.interfaces.nsIPrefBranch);
prefService.removeObserver("browser.privatebrowsing.autostart",
this.autoStartPrivateBrowsingObserver);
},

View File

@ -41,7 +41,7 @@
const accessToken = '{"location":{"latitude":51.5090332,"longitude":-0.1212726,"accuracy":150.0},"access_token":"2:jVhRZJ-j6PiRchH_:RGMrR0W1BiwdZs12"}'
function run_test_on_service() {
var prefBranch = Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefBranch2);
getService(Ci.nsIPrefBranch);
var pb = Cc[PRIVATEBROWSING_CONTRACT_ID].
getService(Ci.nsIPrivateBrowsingService);
prefBranch.setCharPref("geo.wifi.access_token.test", accessToken);

View File

@ -539,9 +539,9 @@
]]></constructor>
<destructor><![CDATA[
var ps2 = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch2);
ps2.removeObserver("browser.search.suggest.enabled", this);
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
prefs.removeObserver("browser.search.suggest.enabled", this);
// Because XBL and the customize toolbar code interacts poorly,
// there may not be anything to remove here
@ -635,9 +635,9 @@
this.controllers.appendController(this.searchbarController);
// Add observer for suggest preference
var ps2 = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch2);
ps2.addObserver("browser.search.suggest.enabled", this, false);
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
prefs.addObserver("browser.search.suggest.enabled", this, false);
]]></body>
</method>

View File

@ -163,8 +163,7 @@ function debug(aMsg) {
function SessionStoreService() {
XPCOMUtils.defineLazyGetter(this, "_prefBranch", function () {
return Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefService).getBranch("browser.").
QueryInterface(Ci.nsIPrefBranch2);
getService(Ci.nsIPrefService).getBranch("browser.");
});
// minimal interval between two save operations (in milliseconds)

View File

@ -79,8 +79,7 @@ let EXPORTED_SYMBOLS = [
*/
XPCOMUtils.defineLazyGetter(this, "_prefs", function() {
return Services.prefs.getBranch(PREF_TASKBAR_BRANCH)
.QueryInterface(Ci.nsIPrefBranch2);
return Services.prefs.getBranch(PREF_TASKBAR_BRANCH);
});
XPCOMUtils.defineLazyGetter(this, "_stringBundle", function() {

View File

@ -724,6 +724,6 @@ XPCOMUtils.defineLazyGetter(AeroPeek, "cacheTimer", function ()
XPCOMUtils.defineLazyServiceGetter(AeroPeek, "prefs",
"@mozilla.org/preferences-service;1",
"nsIPrefBranch2");
"nsIPrefBranch");
AeroPeek.initialize();

View File

@ -168,7 +168,7 @@
initAddons();
initSetupSync();
let prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefService).QueryInterface(Ci.nsIPrefBranch2);
let prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);
if (prefs.getBoolPref("browser.firstrun.show.uidiscovery")) {
startDiscovery();
prefs.setBoolPref("browser.firstrun.show.uidiscovery", false);

View File

@ -565,8 +565,7 @@
this._contentViewManager = this._frameLoader.QueryInterface(Components.interfaces.nsIContentViewManager);
let prefService = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefService)
.QueryInterface(Components.interfaces.nsIPrefBranch2);
.getService(Components.interfaces.nsIPrefBranch);
this._cacheRatioWidth = Math.max(1, prefService.getIntPref("toolkit.browser.cacheRatioWidth") / 1000);
this._cacheRatioHeight = Math.max(1, prefService.getIntPref("toolkit.browser.cacheRatioHeight") / 1000);

View File

@ -291,7 +291,7 @@ var Utils = {
get _branch() {
delete this._branch;
this._branch = Services.prefs.getBranch(null).QueryInterface(Ci.nsIPrefBranch2);
this._branch = Services.prefs.getBranch(null);
this._branch.addObserver("", this, true);
return this._branch;
},