Bug 1251658 - Reset the ui.popup.disable_autohide pref when closing the Browser Toolbox;r=ochameau
authorBrian Grinstead <bgrinstead@mozilla.com>
Tue, 05 Sep 2017 10:25:25 -0700
changeset 428545 b5016d8477442b6602be7cbf60f72d09e2b6a2b4
parent 428544 0f3a0442c2adff8805bac300b570883add78df29
child 428546 ba9d54c93db83a4d5370e3af3a14520e2b55bb62
push id7761
push userjlund@mozilla.com
push dateFri, 15 Sep 2017 00:19:52 +0000
treeherdermozilla-beta@c38455951db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersochameau
bugs1251658
milestone57.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 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