Bug 1378790 - Remove keyboard navigation event listeners when a photonpanelmultiview instance is destroyed. r?Gijs draft
authorMike de Boer <mdeboer@mozilla.com>
Thu, 06 Jul 2017 16:30:07 +0200
changeset 604834 ea4f45565cf50e5e022fc876b428292fc95ed920
parent 604833 d9a5794f279c341cd072d55338ec3e6755a3f34b
child 604837 cc1862e42d773e835772af973ba0a34a3344adbe
push id67201
push usermdeboer@mozilla.com
push dateThu, 06 Jul 2017 14:34:20 +0000
reviewersGijs
bugs1378790
milestone56.0a1
Bug 1378790 - Remove keyboard navigation event listeners when a photonpanelmultiview instance is destroyed. r?Gijs MozReview-Commit-ID: JcAUwLClq7M
browser/components/customizableui/PanelMultiView.jsm
--- a/browser/components/customizableui/PanelMultiView.jsm
+++ b/browser/components/customizableui/PanelMultiView.jsm
@@ -325,19 +325,21 @@ this.PanelMultiView = class {
       this._moveOutKids(this._subViews);
 
     if (this.panelViews) {
       this._moveOutKids(this._viewStack);
       this.panelViews.clear();
     } else {
       this._clickCapturer.removeEventListener("click", this);
     }
+    this._panel.removeEventListener("mousemove", this);
     this._panel.removeEventListener("popupshowing", this);
     this._panel.removeEventListener("popupshown", this);
     this._panel.removeEventListener("popuphidden", this);
+    this.window.removeEventListener("keydown", this);
     this.node.dispatchEvent(new this.window.CustomEvent("destructed"));
     this.node = this._clickCapturer = this._viewContainer = this._mainViewContainer =
       this._subViews = this._viewStack = this.__dwu = this._panelViewCache = null;
   }
 
   /**
    * Remove any child subviews into the panelViewCache, to ensure
    * they remain usable even if this panelmultiview instance is removed