From d488948063f9c996f035c51ca7d4e6a4aea3fdf3 Mon Sep 17 00:00:00 2001 From: Alexandre Poirot Date: Thu, 20 Mar 2014 09:33:18 -0400 Subject: [PATCH] Bug 985555 - Prevent creating multiple markup view iframes when browsing in history. r=bgrins --- browser/devtools/inspector/inspector-panel.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/browser/devtools/inspector/inspector-panel.js b/browser/devtools/inspector/inspector-panel.js index 9c4fe10a78c..bd0d5000f6b 100644 --- a/browser/devtools/inspector/inspector-panel.js +++ b/browser/devtools/inspector/inspector-panel.js @@ -318,7 +318,13 @@ InspectorPanel.prototype = { this._destroyMarkup(); this.isDirty = false; - this._getDefaultNodeForSelection().then(defaultNode => { + let onNodeSelected = defaultNode => { + // Cancel this promise resolution as a new one had + // been queued up. + if (this._pendingSelection != onNodeSelected) { + return; + } + this._pendingSelection = null; this.selection.setNodeFront(defaultNode, "navigateaway"); this._initMarkup(); @@ -330,7 +336,9 @@ InspectorPanel.prototype = { this.setupSearchBox(); this.emit("new-root"); }); - }); + }; + this._pendingSelection = onNodeSelected; + this._getDefaultNodeForSelection().then(onNodeSelected); }, _selectionCssSelector: null,