From a5505820e9dc2df24dc8346578ce61734b7c5b6e Mon Sep 17 00:00:00 2001 From: Gabriel Luong Date: Fri, 22 Feb 2019 00:38:30 -0500 Subject: [PATCH] Bug 1529845 - Add a destroy for the MarkupContextMenu. r=rcaliman Differential Revision: https://phabricator.services.mozilla.com/D20783 --- .../client/inspector/markup/markup-context-menu.js | 10 ++++++++++ devtools/client/inspector/markup/markup.js | 5 +++++ 2 files changed, 15 insertions(+) diff --git a/devtools/client/inspector/markup/markup-context-menu.js b/devtools/client/inspector/markup/markup-context-menu.js index 30f3e9c2a672..c8d4849a382a 100644 --- a/devtools/client/inspector/markup/markup-context-menu.js +++ b/devtools/client/inspector/markup/markup-context-menu.js @@ -36,6 +36,16 @@ class MarkupContextMenu { 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]") || diff --git a/devtools/client/inspector/markup/markup.js b/devtools/client/inspector/markup/markup.js index 99fb8bc35c80..210e5c1b5857 100644 --- a/devtools/client/inspector/markup/markup.js +++ b/devtools/client/inspector/markup/markup.js @@ -2029,6 +2029,11 @@ MarkupView.prototype = { this._hoveredContainer = null; + if (this._contextMenu) { + this._contextMenu.destroy(); + this._contextMenu = null; + } + if (this._eventDetailsTooltip) { this._eventDetailsTooltip.destroy(); this._eventDetailsTooltip = null;