Bug 1500689 - Only update the frame button checked state if it is visible. r=mtigley
authorGabriel Luong <gabriel.luong@gmail.com>
Mon, 22 Oct 2018 13:29:04 -0400
changeset 490700 2bb5c6697edc7545fb94828defb65173fca2ade5
parent 490662 97b682ea485d8f5d2f483051dcc53c59883344d1
child 490702 8c1121739072bf560b00acd482745de2c952b33a
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewersmtigley
bugs1500689
milestone64.0a1
Bug 1500689 - Only update the frame button checked state if it is visible. r=mtigley
devtools/client/framework/toolbox.js
--- a/devtools/client/framework/toolbox.js
+++ b/devtools/client/framework/toolbox.js
@@ -1439,21 +1439,25 @@ Toolbox.prototype = {
       this.frameButton.disabled = true;
       this.frameButton.description = L10N.getStr("toolbox.frames.disabled.tooltip");
     } else {
       // Otherwise, enable the button and update the description.
       this.frameButton.disabled = false;
       this.frameButton.description = L10N.getStr("toolbox.frames.tooltip");
     }
 
-    // Highlight the button when a child frame is selected
+    // Highlight the button when a child frame is selected and visible.
     const selectedFrame = this.frameMap.get(this.selectedFrameId) || {};
-    this.frameButton.isChecked = selectedFrame.parentID != null;
-
-    this.frameButton.isVisible = this._commandIsVisible(this.frameButton);
+    const isVisible = this._commandIsVisible(this.frameButton);
+
+    this.frameButton.isVisible = isVisible;
+
+    if (isVisible) {
+      this.frameButton.isChecked = selectedFrame.parentID != null;
+    }
   },
 
   /**
    * Ensure the visibility of each toolbox button matches the preference value.
    */
   _commandIsVisible: function(button) {
     const {
       isTargetSupported,