Bug 1450896 - ensure update picker button is re-rendered when a11y service is enabled/disabled. r=jdescottes
authorYura Zenevich <yura.zenevich@gmail.com>
Fri, 13 Apr 2018 15:04:08 -0400
changeset 414110 4868cb6ca4a6cf04e3376f0c3fe8ab5710a22fa5
parent 414109 f3530ea9b461e18b80478b009a019314f03bc665
child 414111 64ca4238a4208fe6283806a92d74e50067900309
push id33858
push userncsoregi@mozilla.com
push dateTue, 17 Apr 2018 21:55:44 +0000
treeherdermozilla-central@d6eb5597d744 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdescottes
bugs1450896
milestone61.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 1450896 - ensure update picker button is re-rendered when a11y service is enabled/disabled. r=jdescottes MozReview-Commit-ID: DyVhukiYCfR
devtools/client/accessibility/accessibility-panel.js
devtools/client/framework/toolbox.js
--- a/devtools/client/accessibility/accessibility-panel.js
+++ b/devtools/client/accessibility/accessibility-panel.js
@@ -35,16 +35,17 @@ function AccessibilityPanel(iframeWindow
   this.onTabNavigated = this.onTabNavigated.bind(this);
   this.onPanelVisibilityChange = this.onPanelVisibilityChange.bind(this);
   this.onNewAccessibleFrontSelected =
     this.onNewAccessibleFrontSelected.bind(this);
   this.onAccessibilityInspectorUpdated =
     this.onAccessibilityInspectorUpdated.bind(this);
   this.updateA11YServiceDurationTimer = this.updateA11YServiceDurationTimer.bind(this);
   this.updatePickerButton = this.updatePickerButton.bind(this);
+  this.updateToolboxButtons = this.updateToolboxButtons.bind(this);
 
   EventEmitter.decorate(this);
 }
 
 AccessibilityPanel.prototype = {
   /**
    * Open is effectively an asynchronous constructor.
    */
@@ -125,21 +126,21 @@ AccessibilityPanel.prototype = {
   onPanelVisibilityChange() {
     this._opening.then(() => this.refresh());
   },
 
   refresh() {
     this.cancelPicker();
 
     if (this.isVisible) {
-      this._front.on("init", this.updatePickerButton);
-      this._front.on("shutdown", this.updatePickerButton);
+      this._front.on("init", this.updateToolboxButtons);
+      this._front.on("shutdown", this.updateToolboxButtons);
     } else {
-      this._front.off("init", this.updatePickerButton);
-      this._front.off("shutdown", this.updatePickerButton);
+      this._front.off("init", this.updateToolboxButtons);
+      this._front.off("shutdown", this.updateToolboxButtons);
       // Do not refresh if the panel isn't visible.
       return;
     }
 
     // Do not refresh if it isn't necessary.
     if (!this.shouldRefresh) {
       return;
     }
@@ -178,16 +179,20 @@ AccessibilityPanel.prototype = {
       bubbles: true,
       cancelable: true,
       data: { type, args }
     });
 
     this.panelWin.dispatchEvent(event);
   },
 
+  updateToolboxButtons() {
+    this._toolbox.updatePickerButton();
+  },
+
   updatePickerButton() {
     this.picker && this.picker.updateButton();
   },
 
   togglePicker(focus) {
     this.picker && this.picker.toggle();
   },
 
--- a/devtools/client/framework/toolbox.js
+++ b/devtools/client/framework/toolbox.js
@@ -150,17 +150,17 @@ function Toolbox(target, selectedTool, h
   this._onToolbarFocus = this._onToolbarFocus.bind(this);
   this._onToolbarArrowKeypress = this._onToolbarArrowKeypress.bind(this);
   this._onPickerClick = this._onPickerClick.bind(this);
   this._onPickerKeypress = this._onPickerKeypress.bind(this);
   this._onPickerStarted = this._onPickerStarted.bind(this);
   this._onPickerStopped = this._onPickerStopped.bind(this);
   this._onInspectObject = this._onInspectObject.bind(this);
   this._onNewSelectedNodeFront = this._onNewSelectedNodeFront.bind(this);
-  this._updatePickerButton = this._updatePickerButton.bind(this);
+  this.updatePickerButton = this.updatePickerButton.bind(this);
   this.selectTool = this.selectTool.bind(this);
   this.toggleSplitConsole = this.toggleSplitConsole.bind(this);
 
   this._target.on("close", this.destroy);
 
   if (!selectedTool) {
     selectedTool = Services.prefs.getCharPref(this._prefs.LAST_TOOL);
   }
@@ -175,17 +175,17 @@ function Toolbox(target, selectedTool, h
 
   this._target.on("will-navigate", this._onWillNavigate);
   this._target.on("navigate", this._refreshHostTitle);
   this._target.on("frame-update", this._updateFrames);
   this._target.on("inspect-object", this._onInspectObject);
 
   this.on("host-changed", this._refreshHostTitle);
   this.on("select", this._refreshHostTitle);
-  this.on("select", this._updatePickerButton);
+  this.on("select", this.updatePickerButton);
 
   this.on("ready", this._showDevEditionPromo);
 
   gDevTools.on("tool-registered", this._toolRegistered);
   gDevTools.on("tool-unregistered", this._toolUnregistered);
 
   this.on("picker-started", this._onPickerStarted);
   this.on("picker-stopped", this._onPickerStopped);
@@ -1360,17 +1360,17 @@ Toolbox.prototype = {
   },
 
   /**
    * Visually update picker button.
    * This function is called on every "select" event. Newly selected panel can
    * update the visual state of the picker button such as disabled state,
    * additional CSS classes (className), and tooltip (description).
    */
-  _updatePickerButton() {
+  updatePickerButton() {
     const button = this.pickerButton;
     let currentPanel = this.getCurrentPanel();
 
     if (currentPanel && currentPanel.updatePickerButton) {
       currentPanel.updatePickerButton();
     } else {
       // If the current panel doesn't define a custom updatePickerButton,
       // revert the button to its default state
@@ -2665,17 +2665,17 @@ Toolbox.prototype = {
 
     this.emit("destroy");
 
     this._target.off("inspect-object", this._onInspectObject);
     this._target.off("will-navigate", this._onWillNavigate);
     this._target.off("navigate", this._refreshHostTitle);
     this._target.off("frame-update", this._updateFrames);
     this.off("select", this._refreshHostTitle);
-    this.off("select", this._updatePickerButton);
+    this.off("select", this.updatePickerButton);
     this.off("host-changed", this._refreshHostTitle);
     this.off("ready", this._showDevEditionPromo);
 
     gDevTools.off("tool-registered", this._toolRegistered);
     gDevTools.off("tool-unregistered", this._toolUnregistered);
 
     Services.prefs.removeObserver("devtools.cache.disabled", this._applyCacheSettings);
     Services.prefs.removeObserver("devtools.serviceWorkers.testing.enabled",