Bug 718255 - Merge nsIPrefBranch2 with nsIPrefBranch - Part B, remove uses of nsIPrefBranch2 in modules/libpref/ ; r=bsmedberg
authorGeoff Lankow <geoff@darktrojan.net>
Mon, 16 Jan 2012 21:47:13 +1300
changeset 86757 910cc1ad28039d8970ac40ab2bf402b26c5af9e4
parent 86756 e933d31eb6965196994df3c2298dd2c09224980c
child 86758 860513cc7d5adeec8b3ab7c9b8581de485484d34
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 B, remove uses of nsIPrefBranch2 in modules/libpref/ ; r=bsmedberg
docshell/base/nsDSURIContentListener.cpp
modules/libpref/public/Preferences.h
modules/libpref/src/Preferences.cpp
modules/libpref/src/nsPrefBranch.cpp
modules/libpref/test/unit/test_bug345529.js
modules/libpref/test/unit/test_bug577950.js
modules/libpref/test/unit/test_libPrefs.js
--- a/docshell/base/nsDSURIContentListener.cpp
+++ b/docshell/base/nsDSURIContentListener.cpp
@@ -62,17 +62,17 @@ nsDSURIContentListener::nsDSURIContentLi
     : mDocShell(aDocShell), 
       mParentContentListener(nsnull)
 {
   static bool initializedPrefCache = false;
 
   // Set up a pref cache for sIgnoreXFrameOptions, if we haven't already.
   if (NS_UNLIKELY(!initializedPrefCache)) {
     // Lock the pref so that the user's changes to it, if any, are ignored.
-    nsIPrefBranch2 *root = Preferences::GetRootBranch();
+    nsIPrefBranch *root = Preferences::GetRootBranch();
     root->LockPref("b2g.ignoreXFrameOptions");
 
     Preferences::AddBoolVarCache(&sIgnoreXFrameOptions, "b2g.ignoreXFrameOptions");
     initializedPrefCache = true;
   }
 }
 
 nsDSURIContentListener::~nsDSURIContentListener()
--- a/modules/libpref/public/Preferences.h
+++ b/modules/libpref/public/Preferences.h
@@ -68,17 +68,16 @@ class Preferences : public nsIPrefServic
                     public nsIObserver,
                     public nsIPrefBranchInternal,
                     public nsSupportsWeakReference
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIPREFSERVICE
   NS_FORWARD_NSIPREFBRANCH(sRootBranch->)
-  NS_FORWARD_NSIPREFBRANCH2(sRootBranch->)
   NS_DECL_NSIOBSERVER
 
   Preferences();
   virtual ~Preferences();
 
   nsresult Init();
 
   /**
@@ -105,17 +104,17 @@ public:
     NS_ENSURE_TRUE(InitStaticMembers(), nsnull);
     return sPreferences;
   }
 
   /**
    * Returns shared pref branch instance.
    * NOTE: not addreffed.
    */
-  static nsIPrefBranch2* GetRootBranch()
+  static nsIPrefBranch* GetRootBranch()
   {
     NS_ENSURE_TRUE(InitStaticMembers(), nsnull);
     return sRootBranch;
   }
 
   /**
    * Returns shared default pref branch instance.
    * NOTE: not addreffed.
@@ -360,18 +359,17 @@ protected:
   nsresult SavePrefFileInternal(nsIFile* aFile);
   nsresult WritePrefFile(nsIFile* aFile);
   nsresult MakeBackupPrefFile(nsIFile *aFile);
 
 private:
   nsCOMPtr<nsIFile>        mCurrentFile;
 
   static Preferences*      sPreferences;
-  static nsIPrefBranch2*   sRootBranch;
-  // NOTE: default branch doesn't return nsIPrefBranch2 interface at query.
+  static nsIPrefBranch*    sRootBranch;
   static nsIPrefBranch*    sDefaultRootBranch;
   static bool              sShutdown;
 
   /**
    * Init static members.  TRUE if it succeeded.  Otherwise, FALSE.
    */
   static bool InitStaticMembers();
 };
--- a/modules/libpref/src/Preferences.cpp
+++ b/modules/libpref/src/Preferences.cpp
@@ -85,17 +85,17 @@ static NS_DEFINE_CID(kZipReaderCID, NS_Z
 
 // Prototypes
 static nsresult openPrefFile(nsIFile* aFile);
 static nsresult pref_InitInitialObjects(void);
 static nsresult pref_LoadPrefsInDirList(const char *listId);
 static nsresult ReadExtensionPrefs(nsIFile *aFile);
 
 Preferences* Preferences::sPreferences = nsnull;
-nsIPrefBranch2* Preferences::sRootBranch = nsnull;
+nsIPrefBranch* Preferences::sRootBranch = nsnull;
 nsIPrefBranch* Preferences::sDefaultRootBranch = nsnull;
 bool Preferences::sShutdown = false;
 
 class ValueObserverHashKey : public PLDHashEntryHdr {
 public:
   typedef ValueObserverHashKey* KeyType;
   typedef const ValueObserverHashKey* KeyTypePointer;
 
--- a/modules/libpref/src/nsPrefBranch.cpp
+++ b/modules/libpref/src/nsPrefBranch.cpp
@@ -556,21 +556,16 @@ NS_IMETHODIMP nsPrefBranch::GetChildList
     }
     *aChildArray = outArray;
   }
   *aCount = numPrefs;
 
   return NS_OK;
 }
 
-
-/*
- *  nsIPrefBranch2 methods
- */
-
 NS_IMETHODIMP nsPrefBranch::AddObserver(const char *aDomain, nsIObserver *aObserver, bool aHoldWeak)
 {
   PrefCallback *pCallback;
   const char *pref;
 
   NS_ENSURE_ARG(aDomain);
   NS_ENSURE_ARG(aObserver);
 
--- a/modules/libpref/test/unit/test_bug345529.js
+++ b/modules/libpref/test/unit/test_bug345529.js
@@ -4,17 +4,17 @@
 // Regression test for bug 345529 - crash removing an observer during an
 // nsPref:changed notification.
 function run_test() {
   const Cc = Components.classes;
   const Ci = Components.interfaces;
   const PREF_NAME = "testPref";
 
   var prefs = Cc["@mozilla.org/preferences-service;1"]
-              .getService(Ci.nsIPrefBranch2);
+              .getService(Ci.nsIPrefBranch);
   var observer = {
     QueryInterface: function QueryInterface(aIID) {
       if (aIID.equals(Ci.nsIObserver) ||
           aIID.equals(Ci.nsISupports))
          return this;
       throw Components.results.NS_NOINTERFACE;
     },
 
--- a/modules/libpref/test/unit/test_bug577950.js
+++ b/modules/libpref/test/unit/test_bug577950.js
@@ -33,19 +33,16 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 function run_test() {
   var ps = Cc["@mozilla.org/preferences-service;1"].
             getService(Ci.nsIPrefService);
 
-  var pb2= Cc["@mozilla.org/preferences-service;1"].
-            getService(Ci.nsIPrefBranch2);
-
   var pb = Cc["@mozilla.org/preferences-service;1"].
             getService(Ci.nsIPrefBranch);
 
   var observer = {
     QueryInterface: function QueryInterface(aIID) {
       if (aIID.equals(Ci.nsIObserver) ||
           aIID.equals(Ci.nsISupports))
          return this;
--- a/modules/libpref/test/unit/test_libPrefs.js
+++ b/modules/libpref/test/unit/test_libPrefs.js
@@ -50,17 +50,17 @@ function makeList(a)
 }
 
 function run_test() {
 
   var ps = Cc["@mozilla.org/preferences-service;1"].
             getService(Ci.nsIPrefService);
 
   var pb2= Cc["@mozilla.org/preferences-service;1"].
-            getService(Ci.nsIPrefBranch2);
+            getService(Ci.nsIPrefBranch);
 
   var pb = Cc["@mozilla.org/preferences-service;1"].
             getService(Ci.nsIPrefBranch);
 
   //**************************************************************************//
   // Nullsafety
 
   do_check_throws(function() {