Bug 718255 - Merge nsIPrefBranch2 with nsIPrefBranch - Part C, remove uses of nsIPrefBranch2 in toolkit/ ; r=bsmedberg

This commit is contained in:
Geoff Lankow 2012-01-17 14:18:29 +13:00
Родитель f443f47138
Коммит a825a1156c
27 изменённых файлов: 40 добавлений и 59 удалений

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

@ -229,7 +229,7 @@ ContentPrefService.prototype = {
get _prefSvc() {
if (!this.__prefSvc)
this.__prefSvc = Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefBranch2);
getService(Ci.nsIPrefBranch);
return this.__prefSvc;
},

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

@ -49,7 +49,7 @@
#include "nsNetUtil.h"
#include "nsDeque.h"
#include "nsIFileURL.h"
#include "nsIPrefBranch2.h"
#include "nsIPrefBranch.h"
#include "nsXPCOMCIDInternal.h"
/**

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

@ -172,7 +172,6 @@ function PreferenceBranch(aBranch) {
this._prefs = this._prefs.getBranch(aBranch);
this._prefs.QueryInterface(Ci.nsIPrefBranch);
this._prefs.QueryInterface(Ci.nsIPrefBranch2);
// we want to listen to "all" changes for this branch, so pass in a blank domain
this._prefs.addObserver("", this, true);
@ -240,13 +239,13 @@ PreferenceBranch.prototype = {
var type = this._prefs.getPrefType(aName);
switch (type) {
case Ci.nsIPrefBranch2.PREF_STRING:
case Ci.nsIPrefBranch.PREF_STRING:
aValue = this._prefs.getComplexValue(aName, Ci.nsISupportsString).data;
break;
case Ci.nsIPrefBranch2.PREF_BOOL:
case Ci.nsIPrefBranch.PREF_BOOL:
aValue = this._prefs.getBoolPref(aName);
break;
case Ci.nsIPrefBranch2.PREF_INT:
case Ci.nsIPrefBranch.PREF_INT:
aValue = this._prefs.getIntPref(aName);
break;
}
@ -310,13 +309,13 @@ Preference.prototype = {
var type = this.branch._prefs.getPrefType(this._name);
switch (type) {
case Ci.nsIPrefBranch2.PREF_STRING:
case Ci.nsIPrefBranch.PREF_STRING:
value = "String";
break;
case Ci.nsIPrefBranch2.PREF_BOOL:
case Ci.nsIPrefBranch.PREF_BOOL:
value = "Boolean";
break;
case Ci.nsIPrefBranch2.PREF_INT:
case Ci.nsIPrefBranch.PREF_INT:
value = "Number";
break;
}

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

@ -52,7 +52,6 @@
#include "nsILocaleService.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch.h"
#include "nsIPrefBranch2.h"
#include "nsIPrefLocalizedString.h"
#include "nsICurrentCharsetListener.h"
#include "nsQuickSort.h"
@ -829,11 +828,8 @@ nsresult nsCharsetMenu::FreeResources()
nsresult res = NS_OK;
if (mCharsetMenuObserver) {
nsCOMPtr<nsIPrefBranch2> pbi = do_QueryInterface(mPrefs);
if (pbi) {
pbi->RemoveObserver(kBrowserStaticPrefKey, mCharsetMenuObserver);
pbi->RemoveObserver(kMaileditPrefKey, mCharsetMenuObserver);
}
mPrefs->RemoveObserver(kBrowserStaticPrefKey, mCharsetMenuObserver);
mPrefs->RemoveObserver(kMaileditPrefKey, mCharsetMenuObserver);
/* nsIObserverService has to have released nsCharsetMenu already */
}
@ -881,9 +877,7 @@ nsresult nsCharsetMenu::InitBrowserMenu()
NS_ASSERTION(NS_SUCCEEDED(res), "error initializing browser cache charset menu");
// register prefs callback
nsCOMPtr<nsIPrefBranch2> pbi = do_QueryInterface(mPrefs);
if (pbi)
res = pbi->AddObserver(kBrowserStaticPrefKey, mCharsetMenuObserver, false);
mPrefs->AddObserver(kBrowserStaticPrefKey, mCharsetMenuObserver, false);
}
mBrowserMenuInitialized = NS_SUCCEEDED(res);
@ -916,9 +910,7 @@ nsresult nsCharsetMenu::InitMaileditMenu()
NS_ASSERTION(NS_SUCCEEDED(res), "error initializing mailedit charset menu from prefs");
// register prefs callback
nsCOMPtr<nsIPrefBranch2> pbi = do_QueryInterface(mPrefs);
if (pbi)
res = pbi->AddObserver(kMaileditPrefKey, mCharsetMenuObserver, false);
mPrefs->AddObserver(kMaileditPrefKey, mCharsetMenuObserver, false);
}
mMaileditMenuInitialized = NS_SUCCEEDED(res);

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

@ -103,7 +103,6 @@ LoginManagerCrypto_SDR.prototype = {
init : function () {
// Connect to the correct preferences branch.
this._prefBranch = Services.prefs.getBranch("signon.");
this._prefBranch.QueryInterface(Ci.nsIPrefBranch2);
this._debug = this._prefBranch.getBoolPref("debug");

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

@ -155,7 +155,6 @@ LoginManager.prototype = {
// Preferences. Add observer so we get notified of changes.
this._prefBranch = Services.prefs.getBranch("signon.");
this._prefBranch.QueryInterface(Ci.nsIPrefBranch2);
this._prefBranch.addObserver("", this._observer, false);
// Get current preference values.

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

@ -170,7 +170,6 @@ LoginManagerStorage_legacy.prototype = {
this._prefBranch = Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefService);
this._prefBranch = this._prefBranch.getBranch("signon.");
this._prefBranch.QueryInterface(Ci.nsIPrefBranch2);
this._debug = this._prefBranch.getBoolPref("debug");
@ -1472,7 +1471,6 @@ LoginManagerStorage_legacy.prototype = {
this._prefBranch = Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefService);
this._prefBranch = this._prefBranch.getBranch("signon.");
this._prefBranch.QueryInterface(Ci.nsIPrefBranch2);
this._debug = this._prefBranch.getBoolPref("debug");

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

@ -694,7 +694,7 @@ nsPlacesAutoComplete.prototype = {
this._os.removeObserver(this, kTopicShutdown);
// Remove our preference observer.
this._prefs.QueryInterface(Ci.nsIPrefBranch2).removeObserver("", this);
this._prefs.removeObserver("", this);
delete this._prefs;
// Finalize the statements that we have used.

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

@ -477,8 +477,7 @@ function nsPlacesExpiration()
this._prefBranch = Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefService).
getBranch(PREF_BRANCH).
QueryInterface(Ci.nsIPrefBranch2);
getBranch(PREF_BRANCH);
this._loadPrefs();
// Observe our preferences branch for changes.

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

@ -72,7 +72,6 @@ FormAutoComplete.prototype = {
init : function() {
// Preferences. Add observer so we get notified of changes.
this._prefBranch = Services.prefs.getBranch("browser.formfill.");
this._prefBranch.QueryInterface(Ci.nsIPrefBranch2);
this._prefBranch.addObserver("", this.observer, true);
this.observer._self = this;

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

@ -526,7 +526,7 @@ SuggestAutoComplete.prototype = {
_addObservers: function SAC_addObservers() {
var prefService2 = Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefBranch2);
getService(Ci.nsIPrefBranch);
prefService2.addObserver(BROWSER_SUGGEST_PREF, this, false);
var os = Cc["@mozilla.org/observer-service;1"].
@ -536,7 +536,7 @@ SuggestAutoComplete.prototype = {
_removeObservers: function SAC_removeObservers() {
var prefService2 = Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefBranch2);
getService(Ci.nsIPrefBranch);
prefService2.removeObserver(BROWSER_SUGGEST_PREF, this);
var os = Cc["@mozilla.org/observer-service;1"].

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

@ -55,7 +55,6 @@
#include "nsPIDOMWindow.h"
#include "nsIDOMNSEvent.h"
#include "nsIPrefBranch.h"
#include "nsIPrefBranch2.h"
#include "nsIPrefService.h"
#include "nsString.h"
#include "nsCRT.h"
@ -116,7 +115,7 @@ nsTypeAheadFind::nsTypeAheadFind():
nsTypeAheadFind::~nsTypeAheadFind()
{
nsCOMPtr<nsIPrefBranch2> prefInternal(do_GetService(NS_PREFSERVICE_CONTRACTID));
nsCOMPtr<nsIPrefBranch> prefInternal(do_GetService(NS_PREFSERVICE_CONTRACTID));
if (prefInternal) {
prefInternal->RemoveObserver("accessibility.typeaheadfind", this);
prefInternal->RemoveObserver("accessibility.browsewithcaret", this);
@ -126,7 +125,7 @@ nsTypeAheadFind::~nsTypeAheadFind()
nsresult
nsTypeAheadFind::Init(nsIDocShell* aDocShell)
{
nsCOMPtr<nsIPrefBranch2> prefInternal(do_GetService(NS_PREFSERVICE_CONTRACTID));
nsCOMPtr<nsIPrefBranch> prefInternal(do_GetService(NS_PREFSERVICE_CONTRACTID));
mSearchRange = new nsRange();
mStartPointRange = new nsRange();
mEndPointRange = new nsRange();

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

@ -51,7 +51,6 @@
#include "nsIObserverService.h"
#include "nsIPermissionManager.h"
#include "nsIPrefBranch.h"
#include "nsIPrefBranch2.h"
#include "nsIPrefService.h"
#include "nsIProperties.h"
#include "nsToolkitCompsCID.h"
@ -1148,7 +1147,7 @@ nsUrlClassifierDBService::Init()
nsresult rv;
// Should we check document loads for malware URIs?
nsCOMPtr<nsIPrefBranch2> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
PRInt32 gethashNoise = 0;
if (prefs) {
@ -1510,7 +1509,7 @@ nsUrlClassifierDBService::Shutdown()
mCompleters.Clear();
nsCOMPtr<nsIPrefBranch2> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
if (prefs) {
prefs->RemoveObserver(CHECK_MALWARE_PREF, this);
prefs->RemoveObserver(CHECK_PHISHING_PREF, this);

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

@ -54,7 +54,7 @@ const nsAtomService_CONTRACTID = "@mozilla.org/atom-service;1";
const gPromptService = Components.classes[nsPrompt_CONTRACTID].getService(nsIPromptService);
const gPrefService = Components.classes[nsPrefService_CONTRACTID].getService(nsIPrefService);
const gPrefBranch = gPrefService.getBranch(null).QueryInterface(Components.interfaces.nsIPrefBranch2);
const gPrefBranch = gPrefService.getBranch(null);
const gClipboardHelper = Components.classes[nsClipboardHelper_CONTRACTID].getService(nsIClipboardHelper);
const gAtomService = Components.classes[nsAtomService_CONTRACTID].getService(nsIAtomService);

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

@ -47,7 +47,7 @@ let Services = {};
XPCOMUtils.defineLazyGetter(Services, "prefs", function () {
return Cc["@mozilla.org/preferences-service;1"]
.getService(Ci.nsIPrefService)
.QueryInterface(Ci.nsIPrefBranch2);
.QueryInterface(Ci.nsIPrefBranch);
});
XPCOMUtils.defineLazyGetter(Services, "appinfo", function () {

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

@ -386,13 +386,13 @@ function getPrefValue(aName) {
let value = "";
let type = Services.prefs.getPrefType(aName);
switch (type) {
case Ci.nsIPrefBranch2.PREF_STRING:
case Ci.nsIPrefBranch.PREF_STRING:
value = Services.prefs.getComplexValue(aName, Ci.nsISupportsString).data;
break;
case Ci.nsIPrefBranch2.PREF_BOOL:
case Ci.nsIPrefBranch.PREF_BOOL:
value = Services.prefs.getBoolPref(aName);
break;
case Ci.nsIPrefBranch2.PREF_INT:
case Ci.nsIPrefBranch.PREF_INT:
value = Services.prefs.getIntPref(aName);
break;
}

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

@ -46,7 +46,7 @@ function checkService(service, interface) {
}
function checkServices() {
checkService("prefs", Ci.nsIPrefBranch2);
checkService("prefs", Ci.nsIPrefBranch);
checkService("prefs", Ci.nsIPrefService);
checkService("contentPrefs", Ci.nsIContentPrefService);
checkService("wm", Ci.nsIWindowMediator);

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

@ -291,7 +291,7 @@
ok(matchCaseLabel.hidden, "match case label is visible in manual mode");
var prefsvc = Cc["@mozilla.org/preferences-service;1"].
getService(Components.interfaces.nsIPrefBranch2);
getService(Components.interfaces.nsIPrefBranch);
prefsvc.setIntPref("accessibility.typeaheadfind.casesensitive", 2);
ok(matchCaseCheckbox.hidden,

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

@ -111,7 +111,7 @@ function SetPrefs(aSet)
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var prefSvc = Components.classes["@mozilla.org/preferences-service;1"].
getService(Components.interfaces.nsIPrefBranch2);
getService(Components.interfaces.nsIPrefBranch);
const kPrefName = "ui.cursor_snapping.always_enabled";
if (aSet) {
prefSvc.setBoolPref(kPrefName, true);

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

@ -353,7 +353,7 @@
return;
var prefsvc =
aSubject.QueryInterface(Components.interfaces.nsIPrefBranch2);
aSubject.QueryInterface(Components.interfaces.nsIPrefBranch);
switch (aPrefName) {
case "accessibility.typeaheadfind":
@ -382,7 +382,7 @@
var prefsvc =
Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch2);
.getService(Components.interfaces.nsIPrefBranch);
this._quickFindTimeoutLength =
prefsvc.getIntPref("accessibility.typeaheadfind.timeout");
@ -442,7 +442,7 @@
var prefsvc =
Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch2);
.getService(Components.interfaces.nsIPrefBranch);
prefsvc.removeObserver("accessibility.typeaheadfind",
this._observer);
prefsvc.removeObserver("accessibility.typeaheadfind.linksonly",
@ -1100,7 +1100,7 @@
<body><![CDATA[
var prefsvc =
Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch2);
.getService(Components.interfaces.nsIPrefBranch);
// Just set the pref; our observer will change the find bar behavior
prefsvc.setIntPref("accessibility.typeaheadfind.casesensitive",
@ -1703,7 +1703,7 @@
<body><![CDATA[
var prefsvc =
Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch2);
.getService(Components.interfaces.nsIPrefBranch);
var userWantsPrefill = true;
this.open(aMode);

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

@ -59,7 +59,7 @@
<getter><![CDATA[
if (this.__prefBranch === null) {
this.__prefBranch = Components.classes['@mozilla.org/preferences-service;1']
.getService(Components.interfaces.nsIPrefBranch2);
.getService(Components.interfaces.nsIPrefBranch);
}
return this.__prefBranch;
]]></getter>

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

@ -73,8 +73,7 @@ const PERSIST_FILES = {
__defineGetter__("_prefs", function () {
delete this._prefs;
return this._prefs = Services.prefs.getBranch("lightweightThemes.")
.QueryInterface(Ci.nsIPrefBranch2);
return this._prefs = Services.prefs.getBranch("lightweightThemes.");
});
__defineGetter__("_maxUsedThemes", function() {

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

@ -2567,7 +2567,6 @@ var gDetailView = {
}, true);
this._updatePrefs = Services.prefs.getBranch("extensions.update.");
this._updatePrefs.QueryInterface(Ci.nsIPrefBranch2);
},
shutdown: function() {

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

@ -93,7 +93,7 @@ XPCOMUtils.defineLazyServiceGetter(this, "gVersionChecker",
XPCOMUtils.defineLazyGetter(this, "gPref", function bls_gPref() {
return Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefService).
QueryInterface(Ci.nsIPrefBranch2);
QueryInterface(Ci.nsIPrefBranch);
});
XPCOMUtils.defineLazyGetter(this, "gApp", function bls_gApp() {

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

@ -159,7 +159,7 @@ function run_test() {
var source = do_get_file("data/test_bug514327_3_empty.xml");
source.copyTo(gProfD, "blocklist.xml");
gPrefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch2);
gPrefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);
gBlocklist = Cc["@mozilla.org/extensions/blocklist;1"].getService(nsIBLS);
// should NOT be marked as outdated by the blocklist

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

@ -90,7 +90,7 @@ function run_test() {
do_check_eq(status, Ci.nsIGfxInfo.FEATURE_NO_INFO);
var prefs = Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefBranch2);
getService(Ci.nsIPrefBranch);
do_check_eq(prefs.getIntPref("gfx.blacklist.direct2d"),
Ci.nsIGfxInfo.FEATURE_BLOCKED_DRIVER_VERSION);
@ -115,7 +115,7 @@ function run_test() {
do_check_eq(status, Ci.nsIGfxInfo.FEATURE_NO_INFO);
var prefs = Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefBranch2);
getService(Ci.nsIPrefBranch);
var exists = false;
try {
prefs.getIntPref("gfx.blacklist.direct2d");

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

@ -132,7 +132,7 @@ var gNextFunc;
XPCOMUtils.defineLazyServiceGetter(this, "gPref",
"@mozilla.org/preferences-service;1",
"nsIPrefBranch2");
"nsIPrefBranch");
XPCOMUtils.defineLazyServiceGetter(this, "gCatMan",
"@mozilla.org/categorymanager;1",