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
--- 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