Bug 727408 - Remove nsIPrefBranch2 uses from comm-central, Part B - suite/ ; r=Callek
authorGeoff Lankow <geoff@darktrojan.net>
Wed, 22 Feb 2012 11:46:59 +1300
changeset 10905 1568ea5a5309db1274c88558003fdbc2089a2a03
parent 10904 f148c7fda60f3d7b7a29943c18d88f3fde78a33b
child 10906 b55594e9215d5909421b6c9aee198f44b8d3553d
push id463
push userbugzilla@standard8.plus.com
push dateTue, 24 Apr 2012 17:34:51 +0000
treeherdercomm-beta@e53588e8f7b0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersCallek
bugs727408
Bug 727408 - Remove nsIPrefBranch2 uses from comm-central, Part B - suite/ ; r=Callek
suite/browser/tabbrowser.xml
suite/browser/urlbarBindings.xml
suite/common/bindings/findbar.xml
suite/common/bindings/notification.xml
suite/common/bindings/toolbar.xml
suite/common/pref/pref-applications.js
suite/common/search/search.xml
suite/common/src/nsSessionStore.js
suite/feeds/src/FeedWriter.js
suite/mailnews/compose/MsgComposeCommands.js
suite/mailnews/tabmail.js
suite/mailnews/tabmail.xml
suite/modules/Sanitizer.jsm
suite/modules/WindowsJumpLists.jsm
--- a/suite/browser/tabbrowser.xml
+++ b/suite/browser/tabbrowser.xml
@@ -131,17 +131,17 @@
     </content>
     <implementation implements="nsIObserver">
       <field name="mSessionStore" readonly="true">
         Components.classes["@mozilla.org/suite/sessionstore;1"]
                    .getService(Components.interfaces.nsISessionStore);
       </field>
       <field name="mPrefs" readonly="true">
         Components.classes['@mozilla.org/preferences-service;1']
-                  .getService(Components.interfaces.nsIPrefBranch2);
+                  .getService(Components.interfaces.nsIPrefBranch);
       </field>
       <field name="mURIFixup" readonly="true">
         Components.classes["@mozilla.org/docshell/urifixup;1"]
                   .getService(Components.interfaces.nsIURIFixup);
       </field>
       <field name="mFaviconService" readonly="true">
         Components.classes["@mozilla.org/browser/favicon-service;1"]
                   .getService(Components.interfaces.nsIFaviconService);
@@ -2947,17 +2947,17 @@
       <destructor>
         <![CDATA[
           window.removeEventListener("resize", this, false);
         ]]>
       </destructor>
 
       <field name="mPrefs" readonly="true">
         Components.classes["@mozilla.org/preferences-service;1"]
-                  .getService(Components.interfaces.nsIPrefBranch2);
+                  .getService(Components.interfaces.nsIPrefBranch);
       </field>
 
       <field name="mTabstripWidth">0</field>
 
       <field name="mTabstrip">
         document.getAnonymousElementByAttribute(this, "anonid", "arrowscrollbox");
       </field>
 
--- a/suite/browser/urlbarBindings.xml
+++ b/suite/browser/urlbarBindings.xml
@@ -38,31 +38,27 @@
                    xbl:inherits="for=id,nomatch"/>
       </xul:popupset>
 
       <children includes="menupopup"/>
     </content>
 
     <implementation>
       <constructor><![CDATA[
-        var pbi = this.mPrefs.QueryInterface(Components.interfaces.nsIPrefBranch2);
-        if (pbi)
-          pbi.addObserver("browser.urlbar", this.mPrefObserver, false);
+        this.mPrefs.addObserver("browser.urlbar", this.mPrefObserver, false);
 
         this.updatePref("browser.urlbar.showPopup");
         this.updatePref("browser.urlbar.autoFill");
         this.updatePref("browser.urlbar.showSearch");
         this.inputField.controllers.insertControllerAt(0, this._editItemsController);
       ]]></constructor>
 
       <destructor><![CDATA[
         this.inputField.controllers.removeController(this._editItemsController);
-        var pbi = this.mPrefs.QueryInterface(Components.interfaces.nsIPrefBranch2);
-        if (pbi)
-          pbi.removeObserver("browser.urlbar", this.mPrefObserver);
+        this.mPrefs.removeObserver("browser.urlbar", this.mPrefObserver);
       ]]></destructor>
 
       <field name="mPrefs">
         var svc = Components.classes["@mozilla.org/preferences-service;1"]
                             .getService(Components.interfaces.nsIPrefService);
         svc.getBranch(null);
       </field>
 
@@ -224,29 +220,23 @@
         <xul:treechildren anonid="treebody" class="autocomplete-treebody" flex="1"/>
       </xul:tree>
       <xul:box role="search-box" class="autocomplete-search-box"/>
     </content>
     
     <implementation>
       <constructor><![CDATA[
         // listen for changes to default search engine
-        var pbi = this.mPrefs.QueryInterface(Components.interfaces.nsIPrefBranch2);
-        if (pbi) {
-          pbi.addObserver("browser.search", this.mPrefObserver, false);
-          pbi.addObserver("browser.urlbar", this.mPrefObserver, false);
-        }
+        this.mPrefs.addObserver("browser.search", this.mPrefObserver, false);
+        this.mPrefs.addObserver("browser.urlbar", this.mPrefObserver, false);
       ]]></constructor>
 
       <destructor><![CDATA[
-        var pbi = this.mPrefs.QueryInterface(Components.interfaces.nsIPrefBranch2);
-        if (pbi) {
-          pbi.removeObserver("browser.search", this.mPrefObserver);
-          pbi.removeObserver("browser.urlbar", this.mPrefObserver);
-        }
+        this.mPrefs.removeObserver("browser.search", this.mPrefObserver);
+        this.mPrefs.removeObserver("browser.urlbar", this.mPrefObserver);
       ]]></destructor>
 
       <property name="showSearch" onget="return this.mShowSearch;">
         <setter><![CDATA[
           this.mShowSearch = val;
           if (val) {
             this.updateEngines();
             this.mSearchBox.removeAttribute("hidden");
--- a/suite/common/bindings/findbar.xml
+++ b/suite/common/bindings/findbar.xml
@@ -19,17 +19,17 @@
           xmlns="http://www.mozilla.org/xbl">
 
   <binding id="findbar"
            extends="chrome://global/content/bindings/findbar.xml#findbar">
     <implementation>
       <constructor><![CDATA[
         var prefsvc =
           Components.classes["@mozilla.org/preferences-service;1"]
-                    .getService(Components.interfaces.nsIPrefBranch2);
+                    .getService(Components.interfaces.nsIPrefBranch);
 
         prefsvc.removeObserver("accessibility.typeaheadfind",
                                this._observer);
         prefsvc.addObserver("accessibility.typeaheadfind.autostart",
                             this._suiteObserver, false);
         prefsvc.addObserver("accessibility.typeaheadfind.usefindbar",
                             this._suiteObserver, false);
 
@@ -51,17 +51,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.autostart":
               this._self._useTypeAheadFind = prefsvc.getBoolPref(aPrefName);
               break;
             case "accessibility.typeaheadfind.usefindbar":
               this._self._useTypeAheadFindFindbar = prefsvc.getBoolPref(aPrefName);
               break;
@@ -86,17 +86,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.linksonly",
                                  this._observer);
           prefsvc.removeObserver("accessibility.typeaheadfind.casesensitive",
                                  this._observer);
           prefsvc.removeObserver("accessibility.typeaheadfind.usefindbar",
                                  this._suiteObserver);
           prefsvc.removeObserver("accessibility.typeaheadfind.autostart",
                                  this._suiteObserver);
--- a/suite/common/bindings/notification.xml
+++ b/suite/common/bindings/notification.xml
@@ -27,17 +27,17 @@
                     .getService(Components.interfaces.nsIStringBundleService)
                     .createBundle("chrome://branding/locale/brand.properties");
         ]]>
       </field>
 
       <field name="_prefs" readonly="true">
         <![CDATA[
           Components.classes["@mozilla.org/preferences-service;1"]
-                    .getService(Components.interfaces.nsIPrefBranch2);
+                    .getService(Components.interfaces.nsIPrefBranch);
         ]]>
       </field>
 
       <field name="_urlFormatter" readonly="true">
         <![CDATA[
           Components.classes["@mozilla.org/toolkit/URLFormatterService;1"]
                     .getService(Components.interfaces.nsIURLFormatter);
         ]]>
--- a/suite/common/bindings/toolbar.xml
+++ b/suite/common/bindings/toolbar.xml
@@ -231,17 +231,16 @@
 
       <field name="domain" readonly="true">
         "browser.chrome.toolbar_style"
       </field>
 
       <field name="prefs" readonly="true">
         Components.classes["@mozilla.org/preferences-service;1"]
                   .getService(Components.interfaces.nsIPrefService).getBranch(null)
-                  .QueryInterface(Components.interfaces.nsIPrefBranch2)
       </field>
 
       <method name="observe">
         <parameter name="subject"/>
         <parameter name="topic"/>
         <parameter name="name"/>
         <body>
           <![CDATA[
--- a/suite/common/pref/pref-applications.js
+++ b/suite/common/pref/pref-applications.js
@@ -60,17 +60,17 @@ const nsIWebContentHandlerInfo = Compone
 const nsIFilePicker = Components.interfaces.nsIFilePicker;
 const nsIMIMEInfo = Components.interfaces.nsIMIMEInfo;
 const nsIPropertyBag = Components.interfaces.nsIPropertyBag;
 
 // global services
 var handlerSvc = Components.classes["@mozilla.org/uriloader/handler-service;1"]
                            .getService(Components.interfaces.nsIHandlerService);
 var prefSvc = Components.classes["@mozilla.org/preferences-service;1"]
-                        .getService(Components.interfaces.nsIPrefBranch2);
+                        .getService(Components.interfaces.nsIPrefBranch);
 var categoryMgr = Components.classes["@mozilla.org/categorymanager;1"]
                             .getService(Components.interfaces.nsICategoryManager);
 var mimeSvc = Components.classes["@mozilla.org/mime;1"]
                         .getService(Components.interfaces.nsIMIMEService);
 var converterSvc = Components.classes["@mozilla.org/embeddor.implemented/web-content-handler-registrar;1"]
                              .getService(Components.interfaces.nsIWebContentConverterService);
 var shellSvc = null;
 if ("@mozilla.org/suite/shell-feed-service;1" in Components.classes)
--- a/suite/common/search/search.xml
+++ b/suite/common/search/search.xml
@@ -542,17 +542,17 @@
 
       <field name="_stringBundle">document.getBindingParent(this)._stringBundle</field>
       <field name="_formHistSvc">
         Components.classes["@mozilla.org/satchel/form-history;1"]
                   .getService(Components.interfaces.nsIFormHistory2)
       </field>
       <field name="_prefBranch">
         Components.classes["@mozilla.org/preferences-service;1"]
-                  .getService(Components.interfaces.nsIPrefBranch2)
+                  .getService(Components.interfaces.nsIPrefBranch)
       </field>
       <field name="_inputBox">document.getAnonymousElementByAttribute(this,
           "anonid", "textbox-input-box");</field>
       <field name="_suggestEnabled">
         this._prefBranch.getBoolPref("browser.search.suggest.enabled")
       </field>
 
       <method name="initialize">
--- a/suite/common/src/nsSessionStore.js
+++ b/suite/common/src/nsSessionStore.js
@@ -142,17 +142,17 @@ XPCOMUtils.defineLazyServiceGetter(this,
 function debug(aMsg) {
   Services.console.logStringMessage("SessionStore: " + aMsg);
 }
 
 /* :::::::: The Service ::::::::::::::: */
 
 function SessionStoreService() {
   XPCOMUtils.defineLazyGetter(this, "_prefBranch", function () {
-    return Services.prefs.getBranch("browser.").QueryInterface(Components.interfaces.nsIPrefBranch2);
+    return Services.prefs.getBranch("browser.");
   });
 
   // minimal interval between two save operations (in milliseconds)
   XPCOMUtils.defineLazyGetter(this, "_interval", function () {
     // used often, so caching/observing instead of fetching on-demand
     this._prefBranch.addObserver("sessionstore.interval", this, true);
     return this._prefBranch.getIntPref("sessionstore.interval");
   });
--- a/suite/feeds/src/FeedWriter.js
+++ b/suite/feeds/src/FeedWriter.js
@@ -1148,17 +1148,17 @@ FeedWriter.prototype = {
                            .getService(Components.interfaces.nsIScriptSecurityManager);
     this._feedPrincipal = secman.getCodebasePrincipal(this._feedURI);
 
     LOG("Subscribe Preview: feed uri = " + this._window.location.href);
 
     // Set up the subscription UI
     this._initSubscriptionUI();
     var prefs = Components.classes["@mozilla.org/preferences-service;1"]
-                          .getService(Components.interfaces.nsIPrefBranch2);
+                          .getService(Components.interfaces.nsIPrefBranch);
     prefs.addObserver(PREF_SELECTED_ACTION, this, false);
     prefs.addObserver(PREF_SELECTED_READER, this, false);
     prefs.addObserver(PREF_SELECTED_WEB, this, false);
     prefs.addObserver(PREF_SELECTED_APP, this, false);
     prefs.addObserver(PREF_VIDEO_SELECTED_ACTION, this, false);
     prefs.addObserver(PREF_VIDEO_SELECTED_READER, this, false);
     prefs.addObserver(PREF_VIDEO_SELECTED_WEB, this, false);
     prefs.addObserver(PREF_VIDEO_SELECTED_APP, this, false);
@@ -1191,17 +1191,17 @@ FeedWriter.prototype = {
   close: function close() {
     this._getUIElement("handlersMenuPopup")
         .removeEventListener("command", this, false);
     this._getUIElement("subscribeButton")
         .removeEventListener("command", this, false);
     this._document = null;
     this._window = null;
     var prefs = Components.classes["@mozilla.org/preferences-service;1"]
-                          .getService(Components.interfaces.nsIPrefBranch2);
+                          .getService(Components.interfaces.nsIPrefBranch);
     prefs.removeObserver(PREF_SELECTED_ACTION, this);
     prefs.removeObserver(PREF_SELECTED_READER, this);
     prefs.removeObserver(PREF_SELECTED_WEB, this);
     prefs.removeObserver(PREF_SELECTED_APP, this);
     prefs.removeObserver(PREF_VIDEO_SELECTED_ACTION, this);
     prefs.removeObserver(PREF_VIDEO_SELECTED_READER, this);
     prefs.removeObserver(PREF_VIDEO_SELECTED_WEB, this);
     prefs.removeObserver(PREF_VIDEO_SELECTED_APP, this);
--- a/suite/mailnews/compose/MsgComposeCommands.js
+++ b/suite/mailnews/compose/MsgComposeCommands.js
@@ -1513,17 +1513,17 @@ function ComposeLoad()
 {
   sComposeMsgsBundle = document.getElementById("bundle_composeMsgs");
   sBrandBundle = document.getElementById("brandBundle");
 
   // XXX: Get the preferences service. Remove this once LDAP autocomplete has
   // been moved to toolkit interfaces.
   sPrefs = Components.classes["@mozilla.org/preferences-service;1"]
                      .getService(Components.interfaces.nsIPrefService)
-                     .QueryInterface(Components.interfaces.nsIPrefBranch2);
+                     .QueryInterface(Components.interfaces.nsIPrefBranch);
   sPrefBranchInternal = sPrefs;
 
   var otherHeaders = getPref("mail.compose.other.header");
 
   sRDF = Components.classes['@mozilla.org/rdf/rdf-service;1']
                    .getService(Components.interfaces.nsIRDFService);
   sNameProperty = sRDF.GetResource("http://home.netscape.com/NC-rdf#Name?sort=true");
 
--- a/suite/mailnews/tabmail.js
+++ b/suite/mailnews/tabmail.js
@@ -44,17 +44,17 @@
 // common pref object for all windows using tabmail
 // alas, it's a legacy name without a 'g' prefix
 var pref = null;
 
 function GetPrefService()
 {
   if (!pref)
     pref = Components.classes["@mozilla.org/preferences-service;1"]
-                     .getService(Components.interfaces.nsIPrefBranch2);
+                     .getService(Components.interfaces.nsIPrefBranch);
   return pref;
 }
 
 // Traditionally, mailnews tabs come in two flavours: "folder" and
 // "message" tabs. But these modes are just mere default settings on tab
 // creation, defining layout, URI to load, etc.
 // The user can turn a "message" tab into a "folder" tab just by unhiding
 // the folder pane (F9) and hiding the message pane (F8), and vice versa.
--- a/suite/mailnews/tabmail.xml
+++ b/suite/mailnews/tabmail.xml
@@ -259,17 +259,17 @@
         <![CDATA[
           this.mPrefs.removeObserver("browser.tabs.autoHide", this);
           window.controllers.removeController(this);
         ]]>
       </destructor>
 
       <field name="mPrefs">
         Components.classes["@mozilla.org/preferences-service;1"]
-                  .getService(Components.interfaces.nsIPrefBranch2);
+                  .getService(Components.interfaces.nsIPrefBranch);
       </field>
 
       <field name="currentTabInfo">
         null
       </field>
 
       <field name="tabTypes" readonly="true">
         new Object()
@@ -1104,17 +1104,17 @@
           }
           this.mTabstrip.removeEventListener("overflow", this, false);
           this.mTabstrip.removeEventListener("underflow", this, false);
         ]]>
       </destructor>
 
       <field name="mPrefs">
         Components.classes["@mozilla.org/preferences-service;1"]
-                  .getService(Components.interfaces.nsIPrefBranch2);
+                  .getService(Components.interfaces.nsIPrefBranch);
       </field>
 
       <field name="mTabstripWidth">0</field>
 
       <field name="mTabstrip">
         document.getAnonymousElementByAttribute(this, "anonid", "arrowscrollbox");
       </field>
 
--- a/suite/modules/Sanitizer.jsm
+++ b/suite/modules/Sanitizer.jsm
@@ -224,33 +224,33 @@ var Sanitizer = {
         // the browser:purge-session-history notification. (like error console)
       canClear: true
     },
 
     urlbar: {
       clear: function() {
         // 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");
         } catch(ex) {}
 
         // Clear URLbar history (see also pref-history.js)
         var file = Components.classes["@mozilla.org/file/directory_service;1"]
                              .getService(Components.interfaces.nsIProperties)
                              .get("ProfD", Components.interfaces.nsIFile);
         file.append("urlbarhistory.sqlite");
         if (file.exists())
           file.remove(false);
       },
 
       get canClear() {
         var prefs = Components.classes["@mozilla.org/preferences-service;1"]
-                              .getService(Components.interfaces.nsIPrefBranch2);
+                              .getService(Components.interfaces.nsIPrefBranch);
         if (!prefs.prefIsLocked("general.open_location.last_url") &&
             prefs.prefHasUserValue("general.open_location.last_url"))
           return true;
 
         var file = Components.classes["@mozilla.org/file/directory_service;1"]
                              .getService(Components.interfaces.nsIProperties)
                              .get("ProfD", Components.interfaces.nsIFile);
         file.append("urlbarhistory.sqlite");
--- a/suite/modules/WindowsJumpLists.jsm
+++ b/suite/modules/WindowsJumpLists.jsm
@@ -73,18 +73,17 @@ let EXPORTED_SYMBOLS = [
   "WinTaskbarJumpList",
 ];
 
 /**
  * Smart getters
  */
 
 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() {
   return Services.strings
                  .createBundle("chrome://navigator/locale/taskbar.properties");
 });
 
 XPCOMUtils.defineLazyGetter(this, "PlacesUtils", function() {