Bug 1251658 - Reset the ui.popup.disable_autohide pref when closing the Browser Toolbox;r=ochameau draft
authorBrian Grinstead <bgrinstead@mozilla.com>
Tue, 05 Sep 2017 10:25:25 -0700
changeset 659210 1185b065b263a1a192026bbdc8ce708479ca3fb9
parent 658813 1401e3eec44df87963d3af329ef8a4183ab0483f
child 729915 a9b315def5903cb1251bb2917a31ed4afd32d137
push id78048
push userbgrinstead@mozilla.com
push dateTue, 05 Sep 2017 17:25:39 +0000
reviewersochameau
bugs1251658
milestone57.0a1
Bug 1251658 - Reset the ui.popup.disable_autohide pref when closing the Browser Toolbox;r=ochameau But only reset if the pref has been toggled from the Browser Toolbox UI, to prevent unexpected resetting if the pref was changed from about:config before opening the Browser Toolbox. MozReview-Commit-ID: LwI2M5Uj4jf
devtools/client/framework/toolbox.js
--- a/devtools/client/framework/toolbox.js
+++ b/devtools/client/framework/toolbox.js
@@ -1968,16 +1968,17 @@ Toolbox.prototype = {
 
   _toggleNoAutohide: Task.async(function* () {
     let front = yield this.preferenceFront;
     let toggledValue = !(yield this._isDisableAutohideEnabled());
 
     front.setBoolPref(DISABLE_AUTOHIDE_PREF, toggledValue);
 
     this.autohideButton.isChecked = toggledValue;
+    this._autohideHasBeenToggled = true;
   }),
 
   _isDisableAutohideEnabled: Task.async(function* () {
     // Ensure that the tools are open, and the button is visible.
     yield this.isOpen;
     if (!this.autohideButton.isVisible) {
       return false;
     }
@@ -2711,16 +2712,23 @@ Toolbox.prototype = {
 
   /**
    * Destroy the preferences actor when the toolbox is unloaded.
    */
   destroyPreference: Task.async(function* () {
     if (!this._preferenceFront) {
       return;
     }
+
+    // Only reset the autohide pref in the Browser Toolbox if it's been toggled
+    // in the UI (don't reset the pref if it was already set before opening)
+    if (this._autohideHasBeenToggled) {
+      yield this._preferenceFront.clearUserPref(DISABLE_AUTOHIDE_PREF);
+    }
+
     this._preferenceFront.destroy();
     this._preferenceFront = null;
   }),
 
   /**
    * Called when any event comes from the PerformanceFront. If the performance tool is
    * already loaded when the first event comes in, immediately unbind this handler, as
    * this is only used to queue up observed recordings before the performance tool can