Bug 718255 - Merge nsIPrefBranch2 with nsIPrefBranch - Part C, remove uses of nsIPrefBranch2 in toolkit/ ; r=bsmedberg
authorGeoff Lankow <geoff@darktrojan.net>
Tue, 17 Jan 2012 14:18:29 +1300
changeset 86765 860513cc7d5adeec8b3ab7c9b8581de485484d34
parent 86764 910cc1ad28039d8970ac40ab2bf402b26c5af9e4
child 86766 102dd9765964d899bc60393de5c7e2b2b5d992d9
push id22053
push usermak77@bonardo.net
push dateTue, 14 Feb 2012 10:17:02 +0000
treeherdermozilla-central@62695656d7bd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbsmedberg
bugs718255
milestone13.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 718255 - Merge nsIPrefBranch2 with nsIPrefBranch - Part C, remove uses of nsIPrefBranch2 in toolkit/ ; r=bsmedberg
toolkit/components/contentprefs/nsContentPrefService.js
toolkit/components/downloads/nsDownloadScanner.cpp
toolkit/components/exthelper/extApplication.js
toolkit/components/intl/nsCharsetMenu.cpp
toolkit/components/passwordmgr/crypto-SDR.js
toolkit/components/passwordmgr/nsLoginManager.js
toolkit/components/passwordmgr/storage-Legacy.js
toolkit/components/places/nsPlacesAutoComplete.js
toolkit/components/places/nsPlacesExpiration.js
toolkit/components/satchel/nsFormAutoComplete.js
toolkit/components/search/nsSearchSuggestions.js
toolkit/components/typeaheadfind/nsTypeAheadFind.cpp
toolkit/components/url-classifier/nsUrlClassifierDBService.cpp
toolkit/components/viewconfig/content/config.js
toolkit/content/Services.jsm
toolkit/content/aboutSupport.js
toolkit/content/tests/browser/browser_Services.js
toolkit/content/tests/chrome/findbar_window.xul
toolkit/content/tests/chrome/test_cursorsnap.xul
toolkit/content/widgets/findbar.xml
toolkit/content/widgets/scrollbox.xml
toolkit/mozapps/extensions/LightweightThemeManager.jsm
toolkit/mozapps/extensions/content/extensions.js
toolkit/mozapps/extensions/nsBlocklistService.js
toolkit/mozapps/extensions/test/xpcshell/test_bug514327_3.js
toolkit/mozapps/extensions/test/xpcshell/test_gfxBlacklist_prefs.js
toolkit/mozapps/update/test_timermanager/unit/test_0010_timermanager.js
--- a/toolkit/components/contentprefs/nsContentPrefService.js
+++ b/toolkit/components/contentprefs/nsContentPrefService.js
@@ -224,17 +224,17 @@ ContentPrefService.prototype = {
     return this.__consoleSvc;
   },
 
   // Preferences Service
   __prefSvc: null,
   get _prefSvc() {
     if (!this.__prefSvc)
       this.__prefSvc = Cc["@mozilla.org/preferences-service;1"].
-                       getService(Ci.nsIPrefBranch2);
+                       getService(Ci.nsIPrefBranch);
     return this.__prefSvc;
   },
 
 
   //**************************************************************************//
   // Destruction
 
   _destroy: function ContentPrefService__destroy() {
--- a/toolkit/components/downloads/nsDownloadScanner.cpp
+++ b/toolkit/components/downloads/nsDownloadScanner.cpp
@@ -44,17 +44,17 @@
 #include <process.h>
 #include "nsDownloadManager.h"
 #include "nsIXULAppInfo.h"
 #include "nsXULAppAPI.h"
 #include "nsIPrefService.h"
 #include "nsNetUtil.h"
 #include "nsDeque.h"
 #include "nsIFileURL.h"
-#include "nsIPrefBranch2.h"
+#include "nsIPrefBranch.h"
 #include "nsXPCOMCIDInternal.h"
 
 /**
  * Code overview
  *
  * Download scanner attempts to make use of one of two different virus
  * scanning interfaces available on Windows - IOfficeAntiVirus (Windows
  * 95/NT 4 and IE 5) and IAttachmentExecute (XPSP2 and up).  The latter
--- a/toolkit/components/exthelper/extApplication.js
+++ b/toolkit/components/exthelper/extApplication.js
@@ -167,17 +167,16 @@ function PreferenceBranch(aBranch) {
   this._root = aBranch;
   this._prefs = Components.classes["@mozilla.org/preferences-service;1"]
                           .getService(Ci.nsIPrefService);
 
   if (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);
   this._events = new Events();
 
   var self = this;
   gShutdown.push(function() { self._shutdown(); });
 }
@@ -235,23 +234,23 @@ PreferenceBranch.prototype = {
   get : function prefs_get(aName) {
     return this.has(aName) ? new Preference(aName, this) : null;
   },
 
   getValue : function prefs_gv(aName, aValue) {
     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;
     }
 
     return aValue;
   },
 
   setValue : function prefs_sv(aName, aValue) {
@@ -305,23 +304,23 @@ Preference.prototype = {
     return this._name;
   },
 
   get type() {
     var value = "";
     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;
     }
 
     return value;
   },
 
   get value() {
--- a/toolkit/components/intl/nsCharsetMenu.cpp
+++ b/toolkit/components/intl/nsCharsetMenu.cpp
@@ -47,17 +47,16 @@
 #include "nsCharsetMenu.h"
 #include "nsICharsetConverterManager.h"
 #include "nsICollation.h"
 #include "nsCollationCID.h"
 #include "nsLocaleCID.h"
 #include "nsILocaleService.h"
 #include "nsIPrefService.h"
 #include "nsIPrefBranch.h"
-#include "nsIPrefBranch2.h"
 #include "nsIPrefLocalizedString.h"
 #include "nsICurrentCharsetListener.h"
 #include "nsQuickSort.h"
 #include "nsIObserver.h"
 #include "nsStringEnumerator.h"
 #include "nsTArray.h"
 #include "nsIObserverService.h"
 #include "nsIRequestObserver.h"
@@ -824,21 +823,18 @@ nsresult nsCharsetMenu::Done()
 /**
  * Free the resources no longer needed by the component.
  */
 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 */
   }
 
   mRDFService = NULL;
   mCCManager  = NULL;
   mPrefs      = NULL;
 
   return res;
@@ -876,19 +872,17 @@ nsresult nsCharsetMenu::InitBrowserMenu(
     res = RemoveFlaggedCharsets(browserDecoderList, NS_LITERAL_STRING(".notForBrowser"));
     NS_ASSERTION(NS_SUCCEEDED(res), "error initializing static charset menu from prefs");
 
     res = InitCacheMenu(browserDecoderList, kNC_BrowserCharsetMenuRoot, kBrowserCachePrefKey, 
       &mBrowserMenu);
     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);
 
   return res;
 }
 
 nsresult nsCharsetMenu::InitMaileditMenu() 
@@ -911,19 +905,17 @@ nsresult nsCharsetMenu::InitMaileditMenu
 
     nsTArray<nsCString> maileditEncoderList;
     SetArrayFromEnumerator(encoders, maileditEncoderList);
   
     res = AddFromPrefsToMenu(NULL, container, kMaileditPrefKey, maileditEncoderList, NULL);
     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);
 
   return res;
 }
 
 nsresult nsCharsetMenu::InitMailviewMenu() 
--- a/toolkit/components/passwordmgr/crypto-SDR.js
+++ b/toolkit/components/passwordmgr/crypto-SDR.js
@@ -98,17 +98,16 @@ LoginManagerCrypto_SDR.prototype = {
         dump("PwMgr cryptoSDR: " + message + "\n");
         Services.console.logStringMessage("PwMgr cryptoSDR: " + message);
     },
 
 
     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");
 
         // Check to see if the internal PKCS#11 token has been initialized.
         // If not, set a blank password.
         let tokenDB = Cc["@mozilla.org/security/pk11tokendb;1"].
                       getService(Ci.nsIPK11TokenDB);
 
--- a/toolkit/components/passwordmgr/nsLoginManager.js
+++ b/toolkit/components/passwordmgr/nsLoginManager.js
@@ -150,17 +150,16 @@ LoginManager.prototype = {
         // Cache references to current |this| in utility objects
         this._webProgressListener._domEventListener = this._domEventListener;
         this._webProgressListener._pwmgr = this;
         this._domEventListener._pwmgr    = this;
         this._observer._pwmgr            = this;
 
         // 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.
         this._debug = this._prefBranch.getBoolPref("debug");
 
         this._remember = this._prefBranch.getBoolPref("rememberSignons");
 
 
--- a/toolkit/components/passwordmgr/storage-Legacy.js
+++ b/toolkit/components/passwordmgr/storage-Legacy.js
@@ -165,17 +165,16 @@ LoginManagerStorage_legacy.prototype = {
     init : function () {
         this._logins  = {};
         this._disabledHosts = {};
 
         // Connect to the correct preferences branch.
         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");
 
         // Check to see if the internal PKCS#11 token has been initialized.
         // If not, set a blank password.
         var tokenDB = Cc["@mozilla.org/security/pk11tokendb;1"].
                       getService(Ci.nsIPK11TokenDB);
 
@@ -1467,17 +1466,16 @@ LoginManagerStorage_legacy.prototype = {
      */
     migrateAndAddLogin : function (aLogin) {
         // Initialize outself on the first call
         if (!this._migrationLoginManager) {
             // Connect to the correct preferences branch.
             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");
 
             this._migrationLoginManager = Cc["@mozilla.org/login-manager;1"].
                                           getService(Ci.nsILoginManager);
         }
 
         this.log("Migrating login for " + aLogin.hostname);
--- a/toolkit/components/places/nsPlacesAutoComplete.js
+++ b/toolkit/components/places/nsPlacesAutoComplete.js
@@ -689,17 +689,17 @@ nsPlacesAutoComplete.prototype = {
   //// nsIObserver
 
   observe: function PAC_observe(aSubject, aTopic, aData)
   {
     if (aTopic == kTopicShutdown) {
       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.
       let stmts = [
         "_defaultQuery",
         "_historyQuery",
         "_bookmarkQuery",
         "_tagsQuery",
--- a/toolkit/components/places/nsPlacesExpiration.js
+++ b/toolkit/components/places/nsPlacesExpiration.js
@@ -472,18 +472,17 @@ function nsPlacesExpiration()
                                      "@mozilla.org/system-info;1",
                                      "nsIPropertyBag2");
   XPCOMUtils.defineLazyServiceGetter(this, "_idle",
                                      "@mozilla.org/widget/idleservice;1",
                                      "nsIIdleService");
 
   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.
   this._prefBranch.addObserver("", this, false);
 
   // Register topic observers.
   Services.obs.addObserver(this, TOPIC_SHUTDOWN, false);
   Services.obs.addObserver(this, TOPIC_DEBUG_START_EXPIRATION, false);
--- a/toolkit/components/satchel/nsFormAutoComplete.js
+++ b/toolkit/components/satchel/nsFormAutoComplete.js
@@ -67,17 +67,16 @@ FormAutoComplete.prototype = {
     _timeGroupingSize   : 7 * 24 * 60 * 60 * 1000 * 1000,
     _expireDays         : null,
     _boundaryWeight     : 25,
     _prefixWeight       : 5,
 
     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;
 
         this._debug            = this._prefBranch.getBoolPref("debug");
         this._enabled          = this._prefBranch.getBoolPref("enable");
         this._agedWeight       = this._prefBranch.getIntPref("agedWeight");
         this._bucketSize       = this._prefBranch.getIntPref("bucketSize");
         this._maxTimeGroupings = this._prefBranch.getIntPref("maxTimeGroupings");
--- a/toolkit/components/search/nsSearchSuggestions.js
+++ b/toolkit/components/search/nsSearchSuggestions.js
@@ -521,27 +521,27 @@ SuggestAutoComplete.prototype = {
       case XPCOM_SHUTDOWN_TOPIC:
         this._removeObservers();
         break;
     }
   },
 
   _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"].
              getService(Ci.nsIObserverService);
     os.addObserver(this, XPCOM_SHUTDOWN_TOPIC, false);
   },
 
   _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"].
              getService(Ci.nsIObserverService);
     os.removeObserver(this, XPCOM_SHUTDOWN_TOPIC);
   },
 
   // nsISupports
--- a/toolkit/components/typeaheadfind/nsTypeAheadFind.cpp
+++ b/toolkit/components/typeaheadfind/nsTypeAheadFind.cpp
@@ -50,17 +50,16 @@
 #include "nsIURI.h"
 #include "nsIDocShell.h"
 #include "nsIDocShellTreeOwner.h"
 #include "nsIEditorDocShell.h"
 #include "nsISimpleEnumerator.h"
 #include "nsPIDOMWindow.h"
 #include "nsIDOMNSEvent.h"
 #include "nsIPrefBranch.h"
-#include "nsIPrefBranch2.h"
 #include "nsIPrefService.h"
 #include "nsString.h"
 #include "nsCRT.h"
 
 #include "nsIDOMNode.h"
 #include "mozilla/dom/Element.h"
 #include "nsIFrame.h"
 #include "nsFrameTraversal.h"
@@ -111,27 +110,27 @@ nsTypeAheadFind::nsTypeAheadFind():
   mCaretBrowsingOn(false),
   mLastFindLength(0),
   mIsSoundInitialized(false)
 {
 }
 
 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);
   }
 }
 
 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();
   mFind = do_CreateInstance(NS_FIND_CONTRACTID);
   if (!prefInternal || !mFind)
     return NS_ERROR_FAILURE;
 
   SetDocShell(aDocShell);
--- a/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp
+++ b/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp
@@ -46,17 +46,16 @@
 #include "nsCRT.h"
 #include "nsICryptoHash.h"
 #include "nsICryptoHMAC.h"
 #include "nsIDirectoryService.h"
 #include "nsIKeyModule.h"
 #include "nsIObserverService.h"
 #include "nsIPermissionManager.h"
 #include "nsIPrefBranch.h"
-#include "nsIPrefBranch2.h"
 #include "nsIPrefService.h"
 #include "nsIProperties.h"
 #include "nsToolkitCompsCID.h"
 #include "nsIUrlClassifierUtils.h"
 #include "nsUrlClassifierDBService.h"
 #include "nsUrlClassifierUtils.h"
 #include "nsUrlClassifierProxies.h"
 #include "nsURILoader.h"
@@ -1143,17 +1142,17 @@ nsUrlClassifierDBService::Init()
 #if defined(PR_LOGGING)
   if (!gUrlClassifierDbServiceLog)
     gUrlClassifierDbServiceLog = PR_NewLogModule("UrlClassifierDbService");
 #endif
 
   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) {
     bool tmpbool;
     rv = prefs->GetBoolPref(CHECK_MALWARE_PREF, &tmpbool);
     mCheckMalware = NS_SUCCEEDED(rv) ? tmpbool : CHECK_MALWARE_DEFAULT;
 
     prefs->AddObserver(CHECK_MALWARE_PREF, this, false);
@@ -1505,17 +1504,17 @@ nsUrlClassifierDBService::Shutdown()
 {
   LOG(("shutting down db service\n"));
 
   if (!gDbBackgroundThread)
     return NS_OK;
 
   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);
     prefs->RemoveObserver(GETHASH_TABLES_PREF, this);
     prefs->RemoveObserver(CONFIRM_AGE_PREF, this);
   }
 
   nsresult rv;
--- a/toolkit/components/viewconfig/content/config.js
+++ b/toolkit/components/viewconfig/content/config.js
@@ -49,17 +49,17 @@ const nsIAtomService = Components.interf
 const nsSupportsString_CONTRACTID = "@mozilla.org/supports-string;1";
 const nsPrompt_CONTRACTID = "@mozilla.org/embedcomp/prompt-service;1";
 const nsPrefService_CONTRACTID = "@mozilla.org/preferences-service;1";
 const nsClipboardHelper_CONTRACTID = "@mozilla.org/widget/clipboardhelper;1";
 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);
 
 var gLockAtoms = [gAtomService.getAtom("default"), gAtomService.getAtom("user"), gAtomService.getAtom("locked")];
 // we get these from a string bundle
 var gLockStrs = [];
 var gTypeStrs = [];
 
--- a/toolkit/content/Services.jsm
+++ b/toolkit/content/Services.jsm
@@ -42,17 +42,17 @@ const Cc = Components.classes;
 
 Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
 
 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 () {
   return Cc["@mozilla.org/xre/app-info;1"]
            .getService(Ci.nsIXULAppInfo)
            .QueryInterface(Ci.nsIXULRuntime);
 });
 
--- a/toolkit/content/aboutSupport.js
+++ b/toolkit/content/aboutSupport.js
@@ -381,23 +381,23 @@ function populateGraphicsSection() {
     ])
   ]);
 }
 
 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;
   }
 
   return { name: aName, value: value };
 }
 
 function formatPrefValue(prefValue) {
--- a/toolkit/content/tests/browser/browser_Services.js
+++ b/toolkit/content/tests/browser/browser_Services.js
@@ -41,17 +41,17 @@ function test() {
 }
 
 function checkService(service, interface) {
   ok(service in Services, "Services." + service + " exists");
   ok(Services[service] instanceof interface, "Services." + service + " is an " + interface);
 }
 
 function checkServices() {
-  checkService("prefs", Ci.nsIPrefBranch2);
+  checkService("prefs", Ci.nsIPrefBranch);
   checkService("prefs", Ci.nsIPrefService);
   checkService("contentPrefs", Ci.nsIContentPrefService);
   checkService("wm", Ci.nsIWindowMediator);
   checkService("obs", Ci.nsIObserverService);
   checkService("perms", Ci.nsIPermissionManager);
   checkService("io", Ci.nsIIOService);
   checkService("io", Ci.nsIIOService2);
   checkService("appinfo", Ci.nsIXULAppInfo);
--- a/toolkit/content/tests/chrome/findbar_window.xul
+++ b/toolkit/content/tests/chrome/findbar_window.xul
@@ -286,17 +286,17 @@
     function testAutoCaseSensitivityUI() {
       var matchCaseCheckbox = gFindBar.getElement("find-case-sensitive");
       var matchCaseLabel = gFindBar.getElement("match-case-status");
       document.getElementById("cmd_find").doCommand();
       ok(!matchCaseCheckbox.hidden, "match case box is hidden in manual mode");
       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,
          "match case box is visible in automatic mode");
       ok(!matchCaseLabel.hidden,
          "match case label is hidden in automatic mode");
 
       enterStringIntoFindField("a");
--- a/toolkit/content/tests/chrome/test_cursorsnap.xul
+++ b/toolkit/content/tests/chrome/test_cursorsnap.xul
@@ -106,17 +106,17 @@ function runCurrentTest()
       return;
   }
 }
 
 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);
   } else if (prefSvc.prefHasUserValue(kPrefName)) {
     prefSvc.clearUserPref(kPrefName);
   }
 }
 
--- a/toolkit/content/widgets/findbar.xml
+++ b/toolkit/content/widgets/findbar.xml
@@ -348,17 +348,17 @@
           throw Components.results.NS_ERROR_NO_INTERFACE;
         },
 
         observe: function(aSubject, aTopic, aPrefName) {
           if (aTopic != "nsPref:changed")
             return;
 
           var prefsvc =
-            aSubject.QueryInterface(Components.interfaces.nsIPrefBranch2);
+            aSubject.QueryInterface(Components.interfaces.nsIPrefBranch);
 
           switch (aPrefName) {
             case "accessibility.typeaheadfind":
               this._self._useTypeAheadFind = prefsvc.getBoolPref(aPrefName);
               break;
             case "accessibility.typeaheadfind.linksonly":
               this._self._typeAheadLinksOnly = prefsvc.getBoolPref(aPrefName);
               break;
@@ -377,17 +377,17 @@
       <constructor><![CDATA[
         // These elements are accessed frequently and are therefore cached
         this._findField = this.getElement("findbar-textbox");
         this._findStatusIcon = this.getElement("find-status-icon");
         this._findStatusDesc = this.getElement("find-status");
 
         var prefsvc =
           Components.classes["@mozilla.org/preferences-service;1"]
-                    .getService(Components.interfaces.nsIPrefBranch2);
+                    .getService(Components.interfaces.nsIPrefBranch);
 
         this._quickFindTimeoutLength =
           prefsvc.getIntPref("accessibility.typeaheadfind.timeout");
         this._flashFindBar =
           prefsvc.getIntPref("accessibility.typeaheadfind.flashBar");
 
         prefsvc.addObserver("accessibility.typeaheadfind",
                             this._observer, false);
@@ -437,17 +437,17 @@
             for (var x = this._editors.length - 1; x >= 0; --x)
               this._unhookListenersAtIndex(x);
           }
 
           this.browser = null;
 
           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",
                                  this._observer);
           prefsvc.removeObserver("accessibility.typeaheadfind.casesensitive",
                                  this._observer);
         ]]></body>
       </method>
@@ -1095,17 +1095,17 @@
         - @param aCaseSensitive (boolean)
         -        Whether or not case-sensitivity should be turned on.
         -->
       <method name="_setCaseSensitivity">
         <parameter name="aCaseSensitive"/>
         <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",
                              aCaseSensitive ? 1 : 0);
         ]]></body>
       </method>
 
       <!--
@@ -1698,17 +1698,17 @@
         -        FIND_TYPEAHEAD or FIND_LINKS. If not passed, the last
         -        find mode if any or FIND_NORMAL.
         -->
       <method name="startFind">
         <parameter name="aMode"/>
         <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);
 
           if (this._flashFindBar) {
             this._flashFindBarTimeout =
               setInterval(function(aSelf) { aSelf._flash(); }, 500, this);
             prefsvc.setIntPref("accessibility.typeaheadfind.flashBar",
                                --this._flashFindBar);
--- a/toolkit/content/widgets/scrollbox.xml
+++ b/toolkit/content/widgets/scrollbox.xml
@@ -54,17 +54,17 @@
         document.getAnonymousElementByAttribute(this, "anonid", "scrollbutton-down");
       </field>
 
       <field name="__prefBranch">null</field>
       <property name="_prefBranch" readonly="true">
         <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>
       </property>
 
       <field name="_scrollIncrement">null</field>
       <property name="scrollIncrement" readonly="true">
         <getter><![CDATA[
--- a/toolkit/mozapps/extensions/LightweightThemeManager.jsm
+++ b/toolkit/mozapps/extensions/LightweightThemeManager.jsm
@@ -68,18 +68,17 @@ const PERSIST_ENABLED = true;
 const PERSIST_BYPASS_CACHE = false;
 const PERSIST_FILES = {
   headerURL: "lightweighttheme-header",
   footerURL: "lightweighttheme-footer"
 };
 
 __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() {
   delete this._maxUsedThemes;
   try {
     this._maxUsedThemes = _prefs.getIntPref("maxUsedThemes");
   }
   catch (e) {
--- a/toolkit/mozapps/extensions/content/extensions.js
+++ b/toolkit/mozapps/extensions/content/extensions.js
@@ -2562,17 +2562,16 @@ var gDetailView = {
     this._autoUpdate = document.getElementById("detail-autoUpdate");
 
     var self = this;
     this._autoUpdate.addEventListener("command", function() {
       self._addon.applyBackgroundUpdates = self._autoUpdate.value;
     }, true);
     
     this._updatePrefs = Services.prefs.getBranch("extensions.update.");
-    this._updatePrefs.QueryInterface(Ci.nsIPrefBranch2);
   },
   
   shutdown: function() {
     this._updatePrefs.removeObserver("", this);
     delete this._updatePrefs;
   },
 
   observe: function(aSubject, aTopic, aData) {
--- a/toolkit/mozapps/extensions/nsBlocklistService.js
+++ b/toolkit/mozapps/extensions/nsBlocklistService.js
@@ -88,17 +88,17 @@ XPCOMUtils.defineLazyServiceGetter(this,
                                    "nsIConsoleService");
 
 XPCOMUtils.defineLazyServiceGetter(this, "gVersionChecker",
                                    "@mozilla.org/xpcom/version-comparator;1",
                                    "nsIVersionComparator");
 
 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() {
   return Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULAppInfo).
          QueryInterface(Ci.nsIXULRuntime);
 });
 
 XPCOMUtils.defineLazyGetter(this, "gABI", function bls_gABI() {
--- a/toolkit/mozapps/extensions/test/xpcshell/test_bug514327_3.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_bug514327_3.js
@@ -154,17 +154,17 @@ function run_test() {
   // initialize the blocklist with no entries
   var blocklistFile = gProfD.clone();
   blocklistFile.append("blocklist.xml");
   if (blocklistFile.exists())
     blocklistFile.remove(false);
   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
   do_check_true(gBlocklist.getPluginBlocklistState(PLUGINS[0], "1", "1.9") == nsIBLS.STATE_NOT_BLOCKED);
   
   do_test_pending();
 
   // update blocklist with data that marks the plugin as outdated
--- a/toolkit/mozapps/extensions/test/xpcshell/test_gfxBlacklist_prefs.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_gfxBlacklist_prefs.js
@@ -85,17 +85,17 @@ function run_test() {
     var status = gfxInfo.getFeatureStatus(Ci.nsIGfxInfo.FEATURE_DIRECT2D);
     do_check_eq(status, Ci.nsIGfxInfo.FEATURE_BLOCKED_DRIVER_VERSION);
 
     // Make sure unrelated features aren't affected
     status = gfxInfo.getFeatureStatus(Ci.nsIGfxInfo.FEATURE_DIRECT3D_9_LAYERS);
     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);
 
     Services.obs.removeObserver(blacklistAdded, "blocklist-data-gfxItems");
     Services.obs.addObserver(blacklistRemoved, "blocklist-data-gfxItems", false);
     load_blocklist("test_gfxBlacklist2.xml");
   }
 
@@ -110,17 +110,17 @@ function run_test() {
     var status = gfxInfo.getFeatureStatus(Ci.nsIGfxInfo.FEATURE_DIRECT2D);
     do_check_eq(status, Ci.nsIGfxInfo.FEATURE_NO_INFO);
 
     // Make sure unrelated features aren't affected
     status = gfxInfo.getFeatureStatus(Ci.nsIGfxInfo.FEATURE_DIRECT3D_9_LAYERS);
     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");
       exists = true;
     } catch(e) {}
 
     do_check_false(exists);
 
--- a/toolkit/mozapps/update/test_timermanager/unit/test_0010_timermanager.js
+++ b/toolkit/mozapps/update/test_timermanager/unit/test_0010_timermanager.js
@@ -127,17 +127,17 @@ const TESTS = [ {
   lastUpdateTime  : 0
 } ];
 
 var gUTM;
 var gNextFunc;
 
 XPCOMUtils.defineLazyServiceGetter(this, "gPref",
                                    "@mozilla.org/preferences-service;1",
-                                   "nsIPrefBranch2");
+                                   "nsIPrefBranch");
 
 XPCOMUtils.defineLazyServiceGetter(this, "gCatMan",
                                    "@mozilla.org/categorymanager;1",
                                    "nsICategoryManager");
 
 XPCOMUtils.defineLazyGetter(this, "gCompReg", function() {
   return Cm.QueryInterface(Ci.nsIComponentRegistrar);
 });