Bug 1529845 - Add a destroy for the MarkupContextMenu. r=rcaliman
authorGabriel Luong <gabriel.luong@gmail.com>
Fri, 22 Feb 2019 00:38:30 -0500
changeset 460704 b42cb063ba27b92ec36a8d9b0f98391a22be5be7
parent 460703 241d2964ae968a01928f5e8e4d734781fad1a546
child 460705 191134cfd07c213003c5153473df6780603068ba
push id35597
push userrmaries@mozilla.com
push dateSat, 23 Feb 2019 04:15:57 +0000
treeherdermozilla-central@6924dd16f7b1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrcaliman
bugs1529845
milestone67.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 1529845 - Add a destroy for the MarkupContextMenu. r=rcaliman Differential Revision: https://phabricator.services.mozilla.com/D20783
devtools/client/inspector/markup/markup-context-menu.js
devtools/client/inspector/markup/markup.js
--- a/devtools/client/inspector/markup/markup-context-menu.js
+++ b/devtools/client/inspector/markup/markup-context-menu.js
@@ -31,16 +31,26 @@ class MarkupContextMenu {
     this.inspector = markup.inspector;
     this.selection = this.inspector.selection;
     this.target = this.inspector.target;
     this.telemetry = this.inspector.telemetry;
     this.toolbox = this.inspector.toolbox;
     this.walker = this.inspector.walker;
   }
 
+  destroy() {
+    this.markup = null;
+    this.inspector = null;
+    this.selection = null;
+    this.target = null;
+    this.telemetry = null;
+    this.toolbox = null;
+    this.walker = null;
+  }
+
   show(event) {
     if (!(event.originalTarget instanceof Element) ||
         event.originalTarget.closest("input[type=text]") ||
         event.originalTarget.closest("input:not([type])") ||
         event.originalTarget.closest("textarea")) {
       return;
     }
 
--- a/devtools/client/inspector/markup/markup.js
+++ b/devtools/client/inspector/markup/markup.js
@@ -2024,16 +2024,21 @@ MarkupView.prototype = {
     }
 
     this._destroyer = promise.resolve();
 
     this._clearBriefBoxModelTimer();
 
     this._hoveredContainer = null;
 
+    if (this._contextMenu) {
+      this._contextMenu.destroy();
+      this._contextMenu = null;
+    }
+
     if (this._eventDetailsTooltip) {
       this._eventDetailsTooltip.destroy();
       this._eventDetailsTooltip = null;
     }
 
     if (this.htmlEditor) {
       this.htmlEditor.destroy();
       this.htmlEditor = null;