Bug 1447528 - Remove the pref observer for the split rule view pref in the inspector. r=pbro draft
authorGabriel Luong <gabriel.luong@gmail.com>
Wed, 21 Mar 2018 01:43:35 -0400
changeset 770405 98bb4a0771f933d6c9270d13d290b63710dd1f6a
parent 770400 885915481ec51089613bf2f36985bcd77b17e08a
push id103399
push userbmo:gl@mozilla.com
push dateWed, 21 Mar 2018 05:44:02 +0000
reviewerspbro
bugs1447528
milestone61.0a1
Bug 1447528 - Remove the pref observer for the split rule view pref in the inspector. r=pbro MozReview-Commit-ID: HhOg21levyH
devtools/client/inspector/inspector.js
--- a/devtools/client/inspector/inspector.js
+++ b/devtools/client/inspector/inspector.js
@@ -132,20 +132,18 @@ function Inspector(toolbox) {
   this.onPanelWindowResize = this.onPanelWindowResize.bind(this);
   this.onShowBoxModelHighlighterForNode =
     this.onShowBoxModelHighlighterForNode.bind(this);
   this.onSidebarHidden = this.onSidebarHidden.bind(this);
   this.onSidebarResized = this.onSidebarResized.bind(this);
   this.onSidebarSelect = this.onSidebarSelect.bind(this);
   this.onSidebarShown = this.onSidebarShown.bind(this);
   this.onSidebarToggle = this.onSidebarToggle.bind(this);
-  this.onSplitRuleViewPrefChanged = this.onSplitRuleViewPrefChanged.bind(this);
 
   this._target.on("will-navigate", this._onBeforeNavigate);
-  this.prefsObserver.on(SPLIT_RULE_VIEW_PREF, this.onSplitRuleViewPrefChanged);
 }
 
 Inspector.prototype = {
   /**
    * open is effectively an asynchronous constructor
    */
   init: Task.async(function* () {
     // Localize all the nodes containing a data-localization attribute.
@@ -580,24 +578,16 @@ Inspector.prototype = {
     this.splitBox.setState({ width, height });
     this.sidebarSplitBox.setState({ width: splitSidebarWidth });
   },
 
   onSidebarToggle: function() {
     Services.prefs.setBoolPref(SPLIT_RULE_VIEW_PREF, !this.isSplitRuleViewEnabled);
   },
 
-  async onSplitRuleViewPrefChanged() {
-    // Update the stored value of the split rule view preference since it changed.
-    this.isSplitRuleViewEnabled = Services.prefs.getBoolPref(SPLIT_RULE_VIEW_PREF);
-
-    await this.setupToolbar();
-    await this.addRuleView();
-  },
-
   /**
    * Adds the rule view to the main or split sidebar depending on whether or not it is
    * split view mode. The default tab specifies whether or not the rule view should be
    * selected. The defaultTab defaults to the rule view when the rule view is being merged
    * back into the sidebar from the split sidebar. Otherwise, we specify the default tab
    * when handling the sidebar setup.
    *
    * @params {String} defaultTab
@@ -1273,17 +1263,16 @@ Inspector.prototype = {
 
     if (this.walker) {
       this.walker.off("new-root", this.onNewRoot);
       this.pageStyle = null;
     }
 
     this.cancelUpdate();
 
-    this.prefsObserver.off(SPLIT_RULE_VIEW_PREF, this.onSplitRuleViewPrefChanged);
     this.target.off("will-navigate", this._onBeforeNavigate);
     this.target.off("thread-paused", this.updateDebuggerPausedWarning);
     this.target.off("thread-resumed", this.updateDebuggerPausedWarning);
     this._toolbox.off("select", this.updateDebuggerPausedWarning);
 
     for (let [, panel] of this._panels) {
       panel.destroy();
     }