Bug 1144296 - Allow extending bindings of prefWindow to override instantApply in preferences.xml. r=jaws
authoraceman <acelists@atlas.sk>
Mon, 06 Apr 2015 04:35:00 -0400
changeset 237981 b45bb3e0a30dd270ba64517c4a2f370f0e07ccf8
parent 237980 79e51bf97839c66b2a7cdac648489f5e5d900eb4
child 237982 cf861d5cdf2f7a26dc80749f552b3308b25a5a9a
push id58080
push userryanvm@gmail.com
push dateTue, 07 Apr 2015 20:23:52 +0000
treeherdermozilla-inbound@105106bde936 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjaws
bugs1144296
milestone40.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 1144296 - Allow extending bindings of prefWindow to override instantApply in preferences.xml. r=jaws
toolkit/content/widgets/preferences.xml
--- a/toolkit/content/widgets/preferences.xml
+++ b/toolkit/content/widgets/preferences.xml
@@ -616,19 +616,21 @@
       <xul:hbox>
         <children/>
       </xul:hbox>
     </content>
     <implementation implements="nsITimerCallback">
       <constructor>
       <![CDATA[
         if (this.type != "child") {
-          var psvc = Components.classes["@mozilla.org/preferences-service;1"]
-                               .getService(Components.interfaces.nsIPrefBranch);
-          this.instantApply = psvc.getBoolPref("browser.preferences.instantApply");
+          if (!this._instantApplyInitialized) {
+            let psvc = Components.classes["@mozilla.org/preferences-service;1"]
+                                 .getService(Components.interfaces.nsIPrefBranch);
+            this.instantApply = psvc.getBoolPref("browser.preferences.instantApply");
+          }
           if (this.instantApply) {
             var docElt = document.documentElement;
             var acceptButton = docElt.getButton("accept");
             acceptButton.hidden = true;
             var cancelButton  = docElt.getButton("cancel");
 #ifdef XP_MACOSX
             // no buttons on Mac except Help
             cancelButton.hidden = true;
@@ -688,18 +690,23 @@
         }
         if (this._fadeTimer) {
           this._fadeTimer.cancel();
           this._fadeTimer = null;
         }
       ]]>
       </destructor>
 
+      <!-- Derived bindings can set this to true to cause us to skip
+           reading the browser.preferences.instantApply pref in the constructor.
+           Then they can set instantApply to their wished value. -->
+      <field name="_instantApplyInitialized">false</field>
+      <!-- Controls whether changed pref values take effect immediately. -->
       <field name="instantApply">false</field>
-      
+
       <property name="preferencePanes"
                 onget="return this.getElementsByTagName('prefpane');"/>
 
       <property name="type" onget="return this.getAttribute('type');"/>
       <property name="_paneDeck"
                 onget="return document.getAnonymousElementByAttribute(this, 'anonid', 'paneDeck');"/>
       <property name="_paneDeckContainer"
                 onget="return document.getAnonymousElementByAttribute(this, 'class', 'paneDeckContainer');"/>