Bug 1484595 - Remove the HTMLTooltip hidden event listener before destroying the HTMLTooltip. r=birtles
authorMantaroh Yoshinaga <mantaroh@gmail.com>
Mon, 20 Aug 2018 07:03:07 +0000
changeset 432411 2c023d39fa5a5163e828fc9702f14e4d6b46e6db
parent 432410 655d8b94c8f1f78185f51a11ff0d30f929ac5016
child 432412 a236c987f26c926f9bf4f82e351aaad39c7ae639
push id106731
push usershindli@mozilla.com
push dateMon, 20 Aug 2018 16:36:25 +0000
treeherdermozilla-inbound@14ef4dec6126 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbirtles
bugs1484595
milestone63.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 1484595 - Remove the HTMLTooltip hidden event listener before destroying the HTMLTooltip. r=birtles MenuButton will listen the HTMLTooltip hidden event even if HTMLTooltip is destroyed. As a result of it, the timer which issued in the MenuButton's event listener might fail due to the target window is destroyed. (e.g., switching the dock mode to bottom from window mode.) This patch will remove this event listener before destroying the HTMLTooltip. Differential Revision: https://phabricator.services.mozilla.com/D3759
devtools/client/shared/components/menu/MenuButton.js
--- a/devtools/client/shared/components/menu/MenuButton.js
+++ b/devtools/client/shared/components/menu/MenuButton.js
@@ -121,18 +121,18 @@ class MenuButton extends PureComponent {
   async resetTooltip() {
     if (!this.tooltip) {
       return;
     }
 
     // Mark the menu as closed since the onHidden callback may not be called in
     // this case.
     this.setState({ expanded: false });
+    this.tooltip.off("hidden", this.onHidden);
     this.tooltip.destroy();
-    this.tooltip.off("hidden", this.onHidden);
     this.tooltip = null;
   }
 
   async showMenu(anchor) {
     this.setState({
       expanded: true
     });