Bug 718255 - Merge nsIPrefBranch2 with nsIPrefBranch - Part G, remove remaining uses of nsIPrefBranch2; r=bsmedberg
authorGeoff Lankow <geoff@darktrojan.net>
Wed, 18 Jan 2012 23:23:28 +1300
changeset 86762 04ac18d14436ffa2769ae560fb82203cf0d0861f
parent 86761 fc98d884f0f09c7e15849a7ad975b4c86610ec55
child 86763 3f6d5d9bac6187cbc85481f1438b75d986b619ca
push id6022
push usergeoff@darktrojan.net
push dateMon, 13 Feb 2012 23:44:11 +0000
treeherdermozilla-inbound@04ac18d14436 [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 G, remove remaining uses of nsIPrefBranch2; r=bsmedberg
chrome/src/nsChromeRegistryChrome.cpp
content/base/src/CSPUtils.jsm
content/events/test/test_bug350471.xul
content/events/test/test_bug607464.html
content/events/test/test_clickevent_on_input.html
dom/ipc/ContentParent.cpp
dom/plugins/base/nsPluginHost.cpp
dom/src/geolocation/nsGeolocation.cpp
extensions/cookie/nsCookiePermission.cpp
extensions/cookie/nsPopupWindowManager.cpp
extensions/gio/nsGIOProtocolHandler.cpp
extensions/gnomevfs/nsGnomeVFSProtocolHandler.cpp
extensions/permissions/nsContentBlocker.h
extensions/spellcheck/src/mozPersonalDictionary.cpp
security/manager/ssl/src/nsNSSComponent.cpp
security/manager/ssl/tests/mochitest/stricttransportsecurity/test_sts_privatebrowsing.html
services/crypto/modules/WeaveCrypto.js
services/sync/modules/engines/prefs.js
services/sync/modules/ext/Preferences.js
services/sync/tests/unit/test_Preferences.js
widget/tests/window_bug478536.xul
widget/tests/window_wheeltransaction.xul
--- a/chrome/src/nsChromeRegistryChrome.cpp
+++ b/chrome/src/nsChromeRegistryChrome.cpp
@@ -62,17 +62,17 @@
 #include "nsZipArchive.h"
 
 #include "mozilla/LookAndFeel.h"
 
 #include "nsICommandLine.h"
 #include "nsILocaleService.h"
 #include "nsILocalFile.h"
 #include "nsIObserverService.h"
-#include "nsIPrefBranch2.h"
+#include "nsIPrefBranch.h"
 #include "nsIPrefService.h"
 #include "nsIResProtocolHandler.h"
 #include "nsIScriptError.h"
 #include "nsIVersionComparator.h"
 #include "nsIXPConnect.h"
 #include "nsIXULAppInfo.h"
 #include "nsIXULRuntime.h"
 
@@ -185,22 +185,19 @@ nsChromeRegistryChrome::Init()
   else {
     nsXPIDLCString provider;
     rv = prefs->GetCharPref(SELECTED_SKIN_PREF, getter_Copies(provider));
     if (NS_SUCCEEDED(rv))
       mSelectedSkin = provider;
 
     SelectLocaleFromPref(prefs);
 
-    nsCOMPtr<nsIPrefBranch2> prefs2 (do_QueryInterface(prefs));
-    if (prefs2) {
-      rv = prefs2->AddObserver(MATCH_OS_LOCALE_PREF, this, true);
-      rv = prefs2->AddObserver(SELECTED_LOCALE_PREF, this, true);
-      rv = prefs2->AddObserver(SELECTED_SKIN_PREF, this, true);
-    }
+    rv = prefs->AddObserver(MATCH_OS_LOCALE_PREF, this, true);
+    rv = prefs->AddObserver(SELECTED_LOCALE_PREF, this, true);
+    rv = prefs->AddObserver(SELECTED_SKIN_PREF, this, true);
   }
 
   nsCOMPtr<nsIObserverService> obsService = mozilla::services::GetObserverService();
   if (obsService) {
     obsService->AddObserver(this, "command-line-startup", true);
     obsService->AddObserver(this, "profile-initial-state", true);
   }
 
@@ -215,17 +212,17 @@ nsChromeRegistryChrome::CheckForOSAccess
 
   if (useAccessibilityTheme) {
     /* Set the skin to classic and remove pref observers */
     if (!mSelectedSkin.EqualsLiteral("classic/1.0")) {
       mSelectedSkin.AssignLiteral("classic/1.0");
       RefreshSkins();
     }
 
-    nsCOMPtr<nsIPrefBranch2> prefs (do_GetService(NS_PREFSERVICE_CONTRACTID));
+    nsCOMPtr<nsIPrefBranch> prefs (do_GetService(NS_PREFSERVICE_CONTRACTID));
     if (prefs) {
       prefs->RemoveObserver(SELECTED_SKIN_PREF, this);
     }
   }
 
   return NS_OK;
 }
 
@@ -382,17 +379,17 @@ nsChromeRegistryChrome::Observe(nsISuppo
   else if (!strcmp("command-line-startup", aTopic)) {
     nsCOMPtr<nsICommandLine> cmdLine (do_QueryInterface(aSubject));
     if (cmdLine) {
       nsAutoString uiLocale;
       rv = cmdLine->HandleFlagWithParam(NS_LITERAL_STRING(UILOCALE_CMD_LINE_ARG),
                                         false, uiLocale);
       if (NS_SUCCEEDED(rv) && !uiLocale.IsEmpty()) {
         CopyUTF16toUTF8(uiLocale, mSelectedLocale);
-        nsCOMPtr<nsIPrefBranch2> prefs (do_GetService(NS_PREFSERVICE_CONTRACTID));
+        nsCOMPtr<nsIPrefBranch> prefs (do_GetService(NS_PREFSERVICE_CONTRACTID));
         if (prefs) {
           prefs->RemoveObserver(SELECTED_LOCALE_PREF, this);
         }
       }
     }
   }
   else if (!strcmp("profile-initial-state", aTopic)) {
     mProfileLoaded = true;
--- a/content/base/src/CSPUtils.jsm
+++ b/content/base/src/CSPUtils.jsm
@@ -59,17 +59,16 @@ var gPrefObserver = {
       this._initialize();
     return this._debugEnabled;
   },
 
   _initialize: function() {
     var prefSvc = Components.classes["@mozilla.org/preferences-service;1"]
                     .getService(Components.interfaces.nsIPrefService);
     this._branch = prefSvc.getBranch("security.csp.");
-    this._branch.QueryInterface(Components.interfaces.nsIPrefBranch2);
     this._branch.addObserver("", this, false);
     this._debugEnabled = this._branch.getBoolPref("debug");
   },
 
   unregister: function() {
     if(!this._branch) return;
     this._branch.removeObserver("", this);
   },
--- a/content/events/test/test_bug350471.xul
+++ b/content/events/test/test_bug350471.xul
@@ -217,28 +217,28 @@ function testDefaultHandling(aWin, andTh
   
   exec();
 }
 
 function initPrefs()
 {
   netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
   var prefSvc = Components.classes["@mozilla.org/preferences-service;1"].
-                  getService(Components.interfaces.nsIPrefBranch2);
+                  getService(Components.interfaces.nsIPrefBranch);
   // Disables the app level scroll acceleration
   prefSvc.setIntPref("mousewheel.acceleration.start", -1);
   prefSvc.setBoolPref("mousewheel.system_scroll_override_on_root_content.enabled", false);
   prefSvc.setBoolPref("general.smoothScroll", false);
 }
 
 function clearPrefs()
 {
   netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
   var prefSvc = Components.classes["@mozilla.org/preferences-service;1"].
-                  getService(Components.interfaces.nsIPrefBranch2);
+                  getService(Components.interfaces.nsIPrefBranch);
 
   prefSvc.clearUserPref("mousewheel.acceleration.start");
   prefSvc.clearUserPref("mousewheel.system_scroll_override_on_root_content.enabled");
   prefSvc.clearUserPref("general.smoothScroll");
 }
 
 window.onload = function () {
   netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
--- a/content/events/test/test_bug607464.html
+++ b/content/events/test/test_bug607464.html
@@ -65,30 +65,30 @@ function runTest() {
     }, 0);
   }, win);
 }
 
 function initPrefs()
 {
   netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
   var prefSvc = Components.classes["@mozilla.org/preferences-service;1"].
-                  getService(Components.interfaces.nsIPrefBranch2);
+                  getService(Components.interfaces.nsIPrefBranch);
   // Disables the app level scroll acceleration
   prefSvc.setIntPref("mousewheel.acceleration.start", -1);
   prefSvc.setBoolPref("mousewheel.system_scroll_override_on_root_content.enabled", false);
 
   // Enables smooth scrolling
   prefSvc.setBoolPref("general.smoothScroll", true);
 }
 
 function clearPrefs()
 {
   netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
   var prefSvc = Components.classes["@mozilla.org/preferences-service;1"].
-                  getService(Components.interfaces.nsIPrefBranch2);
+                  getService(Components.interfaces.nsIPrefBranch);
 
   if (prefSvc.prefHasUserValue("mousewheel.acceleration.start"))
     prefSvc.clearUserPref("mousewheel.acceleration.start");
   if (prefSvc.prefHasUserValue("mousewheel.system_scroll_override_on_root_content.enabled"))
     prefSvc.clearUserPref("mousewheel.system_scroll_override_on_root_content.enabled");
   if (prefSvc.prefHasUserValue("general.smoothScroll"))
     prefSvc.clearUserPref("general.smoothScroll");
 }
--- a/content/events/test/test_clickevent_on_input.html
+++ b/content/events/test/test_clickevent_on_input.html
@@ -40,17 +40,17 @@ function runTests()
   SimpleTest.finish();
 }
 
 function isEnabledMiddleClickPaste()
 {
   netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
 
   var prefs = Components.classes["@mozilla.org/preferences-service;1"].
-                         getService(Components.interfaces.nsIPrefBranch2);
+                         getService(Components.interfaces.nsIPrefBranch);
   try {
     return prefs.getBoolPref("middlemouse.paste");
   } catch (e) {
     return false;
   }
 }
 
 function doTest(aButton)
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -45,17 +45,16 @@
 #include "mozilla/ipc/TestShellParent.h"
 #include "mozilla/net/NeckoParent.h"
 #include "mozilla/Preferences.h"
 #include "nsHashPropertyBag.h"
 #include "nsIFilePicker.h"
 #include "nsIWindowWatcher.h"
 #include "nsIDOMWindow.h"
 #include "nsIPrefBranch.h"
-#include "nsIPrefBranch2.h"
 #include "nsIPrefLocalizedString.h"
 #include "nsIObserverService.h"
 #include "nsContentUtils.h"
 #include "nsAutoPtr.h"
 #include "nsCOMPtr.h"
 #include "nsServiceManagerUtils.h"
 #include "nsThreadUtils.h"
 #include "nsChromeRegistryChrome.h"
@@ -213,17 +212,17 @@ ContentParent::Init()
         obs->AddObserver(this, "child-memory-reporter-request", false);
         obs->AddObserver(this, "memory-pressure", false);
         obs->AddObserver(this, "child-gc-request", false);
         obs->AddObserver(this, "child-cc-request", false);
 #ifdef ACCESSIBILITY
         obs->AddObserver(this, "a11y-init-or-shutdown", false);
 #endif
     }
-    nsCOMPtr<nsIPrefBranch2> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID));
+    nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID));
     if (prefs) {
         prefs->AddObserver("", this, false);
     }
     nsCOMPtr<nsIThreadInternal>
             threadInt(do_QueryInterface(NS_GetCurrentThread()));
     if (threadInt) {
         threadInt->AddObserver(this);
     }
@@ -326,17 +325,17 @@ ContentParent::ActorDestroy(ActorDestroy
 
     mMessageManager->Disconnect();
 
     // clear the child memory reporters
     InfallibleTArray<MemoryReport> empty;
     SetChildMemoryReporters(empty);
 
     // remove the global remote preferences observers
-    nsCOMPtr<nsIPrefBranch2> prefs 
+    nsCOMPtr<nsIPrefBranch> prefs 
             (do_GetService(NS_PREFSERVICE_CONTRACTID));
     if (prefs) { 
         prefs->RemoveObserver("", this);
     }
 
     RecvRemoveGeolocationListener();
     RecvRemoveDeviceMotionListener();
 
@@ -1112,17 +1111,17 @@ ContentParent::RecvLoadURIExternal(const
     nsCOMPtr<nsIURI> ourURI(uri);
     extProtService->LoadURI(ourURI, nsnull);
     return true;
 }
 
 /* void onDispatchedEvent (in nsIThreadInternal thread); */
 NS_IMETHODIMP
 ContentParent::OnDispatchedEvent(nsIThreadInternal *thread)
-{
+{
    NS_NOTREACHED("OnDispatchedEvent unimplemented");
    return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 /* void onProcessNextEvent (in nsIThreadInternal thread, in boolean mayWait, in unsigned long recursionDepth); */
 NS_IMETHODIMP
 ContentParent::OnProcessNextEvent(nsIThreadInternal *thread,
                                   bool mayWait,
--- a/dom/plugins/base/nsPluginHost.cpp
+++ b/dom/plugins/base/nsPluginHost.cpp
@@ -75,17 +75,17 @@
 #include "nsISeekableStream.h"
 #include "nsNetUtil.h"
 #include "nsIProgressEventSink.h"
 #include "nsIDocument.h"
 #include "nsICachingChannel.h"
 #include "nsHashtable.h"
 #include "nsIProxyInfo.h"
 #include "nsPluginLogging.h"
-#include "nsIPrefBranch2.h"
+#include "nsIPrefBranch.h"
 #include "nsIScriptChannel.h"
 #include "nsIBlocklistService.h"
 #include "nsVersionComparator.h"
 #include "nsIPrivateBrowsingService.h"
 #include "nsIObjectLoadingContent.h"
 #include "nsIWritablePropertyBag2.h"
 #include "nsPluginStreamListenerPeer.h"
 
--- a/dom/src/geolocation/nsGeolocation.cpp
+++ b/dom/src/geolocation/nsGeolocation.cpp
@@ -62,17 +62,17 @@
 #include "nsICategoryManager.h"
 #include "nsISupportsPrimitives.h"
 #include "nsServiceManagerUtils.h"
 #include "nsContentUtils.h"
 #include "nsIURI.h"
 #include "nsIPermissionManager.h"
 #include "nsIObserverService.h"
 #include "nsIPrefService.h"
-#include "nsIPrefBranch2.h"
+#include "nsIPrefBranch.h"
 #include "nsIJSContextStack.h"
 #include "nsThreadUtils.h"
 #include "mozilla/Services.h"
 #include "mozilla/unused.h"
 #include "mozilla/Preferences.h"
 
 #include <math.h>
 
--- a/extensions/cookie/nsCookiePermission.cpp
+++ b/extensions/cookie/nsCookiePermission.cpp
@@ -46,17 +46,16 @@
 #include "nsICookie2.h"
 #include "nsIServiceManager.h"
 #include "nsICookiePromptService.h"
 #include "nsICookieManager2.h"
 #include "nsNetUtil.h"
 #include "nsIURI.h"
 #include "nsIPrefService.h"
 #include "nsIPrefBranch.h"
-#include "nsIPrefBranch2.h"
 #include "nsIChannel.h"
 #include "nsIHttpChannelInternal.h"
 #include "nsIDOMWindow.h"
 #include "nsIDOMDocument.h"
 #include "nsIPrincipal.h"
 #include "nsString.h"
 #include "nsCRT.h"
 #include "nsILoadContext.h"
@@ -100,17 +99,17 @@ nsCookiePermission::Init()
   // Initialize nsIPermissionManager and fetch relevant prefs. This is only
   // required for some methods on nsICookiePermission, so it should be done
   // lazily.
   nsresult rv;
   mPermMgr = do_GetService(NS_PERMISSIONMANAGER_CONTRACTID, &rv);
   if (NS_FAILED(rv)) return false;
 
   // failure to access the pref service is non-fatal...
-  nsCOMPtr<nsIPrefBranch2> prefBranch =
+  nsCOMPtr<nsIPrefBranch> prefBranch =
       do_GetService(NS_PREFSERVICE_CONTRACTID);
   if (prefBranch) {
     prefBranch->AddObserver(kCookiesLifetimePolicy, this, false);
     prefBranch->AddObserver(kCookiesLifetimeDays, this, false);
     prefBranch->AddObserver(kCookiesAlwaysAcceptSession, this, false);
     PrefChanged(prefBranch, nsnull);
 
     // migration code for original cookie prefs
--- a/extensions/cookie/nsPopupWindowManager.cpp
+++ b/extensions/cookie/nsPopupWindowManager.cpp
@@ -36,17 +36,16 @@
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsPopupWindowManager.h"
 
 #include "nsCRT.h"
 #include "nsIServiceManager.h"
 #include "nsIPrefService.h"
 #include "nsIPrefBranch.h"
-#include "nsIPrefBranch2.h"
 
 /**
  * The Popup Window Manager maintains popup window permissions by website.
  */
 
 static const char kPopupDisablePref[] = "dom.disable_open_during_load";
 
 //*****************************************************************************
@@ -68,17 +67,17 @@ NS_IMPL_ISUPPORTS3(nsPopupWindowManager,
                    nsSupportsWeakReference)
 
 nsresult
 nsPopupWindowManager::Init()
 {
   nsresult rv;
   mPermissionManager = do_GetService(NS_PERMISSIONMANAGER_CONTRACTID);
 
-  nsCOMPtr<nsIPrefBranch2> prefBranch =
+  nsCOMPtr<nsIPrefBranch> prefBranch =
     do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
   if (NS_SUCCEEDED(rv)) {
     bool permission;
     rv = prefBranch->GetBoolPref(kPopupDisablePref, &permission);
     if (NS_FAILED(rv)) {
       permission = true;
     }
     mPolicy = permission ? (PRUint32) DENY_POPUP : (PRUint32) ALLOW_POPUP;
--- a/extensions/gio/nsGIOProtocolHandler.cpp
+++ b/extensions/gio/nsGIOProtocolHandler.cpp
@@ -38,17 +38,17 @@
  * ***** END LICENSE BLOCK ***** */
 
 /*
  * This code is based on original Mozilla gnome-vfs extension. It implements
  * input stream provided by GVFS/GIO.
 */
 #include "mozilla/ModuleUtils.h"
 #include "nsIPrefService.h"
-#include "nsIPrefBranch2.h"
+#include "nsIPrefBranch.h"
 #include "nsIObserver.h"
 #include "nsThreadUtils.h"
 #include "nsProxyRelease.h"
 #include "nsIStringBundle.h"
 #include "nsIStandardURL.h"
 #include "nsMimeTypes.h"
 #include "nsNetUtil.h"
 #include "mozilla/Monitor.h"
@@ -939,17 +939,17 @@ NS_IMPL_ISUPPORTS2(nsGIOProtocolHandler,
 
 nsresult
 nsGIOProtocolHandler::Init()
 {
 #ifdef PR_LOGGING
   sGIOLog = PR_NewLogModule("gio");
 #endif
 
-  nsCOMPtr<nsIPrefBranch2> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
+  nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
   if (prefs)
   {
     InitSupportedProtocolsPref(prefs);
     prefs->AddObserver(MOZ_GIO_SUPPORTED_PROTOCOLS, this, false);
   }
 
   return NS_OK;
 }
--- a/extensions/gnomevfs/nsGnomeVFSProtocolHandler.cpp
+++ b/extensions/gnomevfs/nsGnomeVFSProtocolHandler.cpp
@@ -42,17 +42,17 @@ extern "C" {
 #include <libgnomevfs/gnome-vfs-mime-utils.h>
 }
 
 #include "nsServiceManagerUtils.h"
 #include "nsComponentManagerUtils.h"
 #include "mozilla/ModuleUtils.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsIPrefService.h"
-#include "nsIPrefBranch2.h"
+#include "nsIPrefBranch.h"
 #include "nsIObserver.h"
 #include "nsThreadUtils.h"
 #include "nsProxyRelease.h"
 #include "nsIAuthPrompt.h"
 #include "nsIStringBundle.h"
 #include "nsIStandardURL.h"
 #include "nsIURL.h"
 #include "nsMimeTypes.h"
@@ -794,17 +794,17 @@ nsGnomeVFSProtocolHandler::Init()
   {
     if (!gnome_vfs_init())
     {
       NS_WARNING("gnome_vfs_init failed");
       return NS_ERROR_UNEXPECTED;
     }
   }
 
-  nsCOMPtr<nsIPrefBranch2> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
+  nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
   if (prefs)
   {
     InitSupportedProtocolsPref(prefs);
     prefs->AddObserver(MOZ_GNOMEVFS_SUPPORTED_PROTOCOLS, this, false);
   }
 
   return NS_OK;
 }
--- a/extensions/permissions/nsContentBlocker.h
+++ b/extensions/permissions/nsContentBlocker.h
@@ -35,17 +35,17 @@
  * ***** END LICENSE BLOCK ***** */
 #ifndef nsContentBlocker_h__
 #define nsContentBlocker_h__
 
 #include "nsIContentPolicy.h"
 #include "nsIObserver.h"
 #include "nsWeakReference.h"
 #include "nsIPermissionManager.h"
-#include "nsIPrefBranch2.h"
+#include "nsIPrefBranch.h"
 
 class nsIPrefBranch;
 
 ////////////////////////////////////////////////////////////////////////////////
 
 class nsContentBlocker : public nsIContentPolicy,
                          public nsIObserver,
                          public nsSupportsWeakReference
@@ -66,17 +66,17 @@ private:
   void PrefChanged(nsIPrefBranch *, const char *);
   nsresult TestPermission(nsIURI *aCurrentURI,
                           nsIURI *aFirstURI,
                           PRInt32 aContentType,
                           bool *aPermission,
                           bool *aFromPrefs);
 
   nsCOMPtr<nsIPermissionManager> mPermissionManager;
-  nsCOMPtr<nsIPrefBranch2> mPrefBranchInternal;
+  nsCOMPtr<nsIPrefBranch> mPrefBranchInternal;
   static PRUint8 mBehaviorPref[];
 };
 
 #define NS_CONTENTBLOCKER_CID \
 { 0x4ca6b67b, 0x5cc7, 0x4e71, \
   { 0xa9, 0x8a, 0x97, 0xaf, 0x1c, 0x13, 0x48, 0x62 } }
 
 #define NS_CONTENTBLOCKER_CONTRACTID "@mozilla.org/permissions/contentblocker;1"
--- a/extensions/spellcheck/src/mozPersonalDictionary.cpp
+++ b/extensions/spellcheck/src/mozPersonalDictionary.cpp
@@ -40,17 +40,16 @@
 #include "nsReadableUtils.h"
 #include "nsIFile.h"
 #include "nsAppDirectoryServiceDefs.h"
 #include "nsICharsetConverterManager.h"
 #include "nsICharsetAlias.h"
 #include "nsIObserverService.h"
 #include "nsIPrefService.h"
 #include "nsIPrefBranch.h"
-#include "nsIPrefBranch2.h"
 #include "nsIWeakReference.h"
 #include "nsCRT.h"
 #include "nsNetUtil.h"
 #include "nsStringEnumerator.h"
 #include "nsUnicharInputStream.h"
 
 #define MOZ_PERSONAL_DICT_NAME "persdict.dat"
 
--- a/security/manager/ssl/src/nsNSSComponent.cpp
+++ b/security/manager/ssl/src/nsNSSComponent.cpp
@@ -62,17 +62,16 @@
 #include "nsIX509CertDB.h"
 #include "nsIProfileChangeStatus.h"
 #include "nsNSSCertificate.h"
 #include "nsNSSHelper.h"
 #include "nsSmartCardMonitor.h"
 #include "prlog.h"
 #include "nsIPrefService.h"
 #include "nsIPrefBranch.h"
-#include "nsIPrefBranch2.h"
 #include "nsIDateTimeFormat.h"
 #include "nsDateTimeFormatCID.h"
 #include "nsIDOMEvent.h"
 #include "nsIDOMDocument.h"
 #include "nsIDOMWindow.h"
 #include "nsIDOMWindowCollection.h"
 #include "nsIDOMSmartCardEvent.h"
 #include "nsIDOMCrypto.h"
@@ -1777,18 +1776,17 @@ nsNSSComponent::InitializeNSS(bool showW
 
       ::NSS_SetDomesticPolicy();
       //  SSL_EnableCipher(SSL_RSA_WITH_NULL_MD5, SSL_ALLOWED);
       //  SSL_EnableCipher(SSL_RSA_WITH_NULL_SHA, SSL_ALLOWED);
 
       PK11_SetPasswordFunc(PK11PasswordPrompt);
 
       // Register an observer so we can inform NSS when these prefs change
-      nsCOMPtr<nsIPrefBranch2> pbi = do_QueryInterface(mPrefBranch);
-      pbi->AddObserver("security.", this, false);
+      mPrefBranch->AddObserver("security.", this, false);
 
       SSL_OptionSetDefault(SSL_ENABLE_SSL2, false);
       SSL_OptionSetDefault(SSL_V2_COMPATIBLE_HELLO, false);
       bool enabled;
       mPrefBranch->GetBoolPref("security.enable_ssl3", &enabled);
       SSL_OptionSetDefault(SSL_ENABLE_SSL3, enabled);
       mPrefBranch->GetBoolPref("security.enable_tls", &enabled);
       SSL_OptionSetDefault(SSL_ENABLE_TLS, enabled);
@@ -1902,18 +1900,17 @@ nsNSSComponent::ShutdownNSS()
   if (mNSSInitialized) {
     mNSSInitialized = false;
 
     PK11_SetPasswordFunc((PK11PasswordFunc)nsnull);
     mHttpForNSS.unregisterHttpClient();
     UnregisterMyOCSPAIAInfoCallback();
 
     if (mPrefBranch) {
-      nsCOMPtr<nsIPrefBranch2> pbi = do_QueryInterface(mPrefBranch);
-      pbi->RemoveObserver("security.", this);
+      mPrefBranch->RemoveObserver("security.", this);
     }
 
     ShutdownSmartCardThreads();
     SSL_ClearSessionCache();
     if (mClientAuthRememberService) {
       mClientAuthRememberService->ClearRememberedDecisions();
     }
     UnloadLoadableRoots();
--- a/security/manager/ssl/tests/mochitest/stricttransportsecurity/test_sts_privatebrowsing.html
+++ b/security/manager/ssl/tests/mochitest/stricttransportsecurity/test_sts_privatebrowsing.html
@@ -96,17 +96,17 @@
     if (_PrefSvc)
       return _PrefSvc;
 
     // not all apps will have the private browsing service.
     try {
       netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
       _PrefSvc = Components.classes["@mozilla.org/preferences-service;1"]
         .getService(Components.interfaces.nsIPrefService)
-        .QueryInterface(Components.interfaces.nsIPrefBranch2);
+        .QueryInterface(Components.interfaces.nsIPrefBranch);
       return _PrefSvc;
     } catch (e) {}
     return null;
   }
 
   function startRound(round) {
     currentround = round;
     testsleftinround = NUM_TEST_FRAMES;
--- a/services/crypto/modules/WeaveCrypto.js
+++ b/services/crypto/modules/WeaveCrypto.js
@@ -83,17 +83,16 @@ WeaveCrypto.prototype = {
             }
         }
     },
 
     init : function() {
         try {
             // Preferences. Add observer so we get notified of changes.
             this.prefBranch = Services.prefs.getBranch("services.sync.log.");
-            this.prefBranch.QueryInterface(Ci.nsIPrefBranch2);
             this.prefBranch.addObserver("cryptoDebug", this.observer, false);
             this.observer._self = this;
             this.debug = this.prefBranch.getBoolPref("cryptoDebug");
 
             this.initNSS();
             this.initAlgorithmSettings();   // Depends on NSS.
             this.initIVSECItem();
             this.initSharedInts();
--- a/services/sync/modules/engines/prefs.js
+++ b/services/sync/modules/engines/prefs.js
@@ -252,28 +252,28 @@ PrefTracker.prototype = {
   },
 
   _enabled: false,
   observe: function(aSubject, aTopic, aData) {
     switch (aTopic) {
       case "weave:engine:start-tracking":
         if (!this._enabled) {
           Cc["@mozilla.org/preferences-service;1"]
-            .getService(Ci.nsIPrefBranch2).addObserver("", this, false);
+            .getService(Ci.nsIPrefBranch).addObserver("", this, false);
           this._enabled = true;
         }
         break;
       case "weave:engine:stop-tracking":
         if (this._enabled)
           this._enabled = false;
         // Fall through to clean up.
       case "profile-before-change":
         this.__prefs = null;
         Cc["@mozilla.org/preferences-service;1"]
-          .getService(Ci.nsIPrefBranch2).removeObserver("", this);
+          .getService(Ci.nsIPrefBranch).removeObserver("", this);
         break;
       case "nsPref:changed":
         // Trigger a sync for MULTI-DEVICE for a change that determines
         // which prefs are synced or a regular pref change.
         if (aData.indexOf(WEAVE_SYNC_PREFS) == 0 || 
             this._prefs.get(WEAVE_SYNC_PREFS + aData, false)) {
           this.score += SCORE_INCREMENT_XLARGE;
           this.modified = true;
--- a/services/sync/modules/ext/Preferences.js
+++ b/services/sync/modules/ext/Preferences.js
@@ -431,18 +431,17 @@ Preferences.prototype = {
    * @private
    */
   get _prefSvc() {
     let prefSvc = Cc["@mozilla.org/preferences-service;1"]
                   .getService(Ci.nsIPrefService);
     if (this._defaultBranch) {
       prefSvc = prefSvc.getDefaultBranch(this._prefBranch);
     } else {
-      prefSvc = prefSvc.getBranch(this._prefBranch)
-                .QueryInterface(Ci.nsIPrefBranch2);
+      prefSvc = prefSvc.getBranch(this._prefBranch);
     }
 
     this.__defineGetter__("_prefSvc", function() prefSvc);
     return this._prefSvc;
   },
 
   /**
    * IO Service
--- a/services/sync/tests/unit/test_Preferences.js
+++ b/services/sync/tests/unit/test_Preferences.js
@@ -190,17 +190,17 @@ function test_observe_prefs_object() {
   Preferences.reset("test_observe_prefs_object");
 }
 
 function test_observe_prefs_nsIObserver() {
   let observer = {
     observed: false,
     observe: function(subject, topic, data) {
       this.observed = !this.observed;
-      do_check_true(subject instanceof Ci.nsIPrefBranch2);
+      do_check_true(subject instanceof Ci.nsIPrefBranch);
       do_check_eq(topic, "nsPref:changed");
       do_check_eq(data, "test_observe_prefs_nsIObserver");
     }
   };
 
   Preferences.observe("test_observe_prefs_nsIObserver", observer);
   Preferences.set("test_observe_prefs_nsIObserver", "something");
   do_check_true(observer.observed);
--- a/widget/tests/window_bug478536.xul
+++ b/widget/tests/window_bug478536.xul
@@ -72,17 +72,17 @@ var gTests = [
  { scrollToForward: true,  shouldScroll: true },
  { scrollToForward: false, shouldScroll: true },
  { scrollToForward: false, shouldScroll: false }
 ];
 var gCurrentTestIndex = -1;
 var gIgnoreScrollEvent = true;
 
 var gPrefSvc = Components.classes["@mozilla.org/preferences-service;1"].
-               getService(Components.interfaces.nsIPrefBranch2);
+               getService(Components.interfaces.nsIPrefBranch);
 const kPrefSmoothScroll = "general.smoothScroll";
 const kPrefNameTimeout = "mousewheel.transaction.timeout";
 const kDefaultTimeout = gPrefSvc.getIntPref(kPrefNameTimeout);
 
 gPrefSvc.setBoolPref(kPrefSmoothScroll, false);
 
 var gTimeout = kDefaultTimeout;
 
--- a/widget/tests/window_wheeltransaction.xul
+++ b/widget/tests/window_wheeltransaction.xul
@@ -104,17 +104,17 @@ var gLitesnEvents = kListenEvent_None;
  * difficult and it can be create more complex testing code.  So, we should use
  * only one timer at one time.  For that, we must store the timer id to this
  * variable.  And the functions which may be called via a timer must clear the
  * current timer by |_clearTimer| function.
  */
 var gTimer;
 
 var gPrefSvc = Components.classes["@mozilla.org/preferences-service;1"].
-               getService(Components.interfaces.nsIPrefBranch2);
+               getService(Components.interfaces.nsIPrefBranch);
 const kPrefSmoothScroll = "general.smoothScroll";
 const kPrefNameTimeout = "mousewheel.transaction.timeout";
 const kPrefNameIgnoreMoveDelay = "mousewheel.transaction.ignoremovedelay";
 
 const kDefaultTimeout = gPrefSvc.getIntPref(kPrefNameTimeout);
 const kDefaultIgnoreMoveDelay = gPrefSvc.getIntPref(kPrefNameIgnoreMoveDelay);
 
 gPrefSvc.setBoolPref(kPrefSmoothScroll, false);