diff --git a/browser/components/extensions/ExtensionPopups.jsm b/browser/components/extensions/ExtensionPopups.jsm index 13bb74c3d355..de7d524d3d6b 100644 --- a/browser/components/extensions/ExtensionPopups.jsm +++ b/browser/components/extensions/ExtensionPopups.jsm @@ -117,6 +117,9 @@ class BasePopup { this.destroyBrowser(this.browser, true); this.browser.remove(); } + if (this.stack) { + this.stack.remove(); + } if (this.viewNode) { this.viewNode.removeEventListener(this.DESTROY_EVENT, this); @@ -132,6 +135,7 @@ class BasePopup { } this.browser = null; + this.stack = null; this.viewNode = null; }); } @@ -220,6 +224,9 @@ class BasePopup { createBrowser(viewNode, popupURL = null) { let document = viewNode.ownerDocument; + + let stack = document.createElementNS(XUL_NS, "stack"); + let browser = document.createElementNS(XUL_NS, "browser"); browser.setAttribute("type", "content"); browser.setAttribute("disableglobalhistory", "true"); @@ -249,6 +256,7 @@ class BasePopup { // will be if and when we popup debugging. this.browser = browser; + this.stack = stack; let readyPromise; if (this.extension.remote) { @@ -257,7 +265,8 @@ class BasePopup { readyPromise = promiseEvent(browser, "load"); } - viewNode.appendChild(browser); + stack.appendChild(browser); + viewNode.appendChild(stack); ExtensionParent.apiManager.emit("extension-browser-inserted", browser); diff --git a/toolkit/components/prompts/content/tabprompts.xml b/toolkit/components/prompts/content/tabprompts.xml index e03637f6851a..a3e6fa2f23a4 100644 --- a/toolkit/components/prompts/content/tabprompts.xml +++ b/toolkit/components/prompts/content/tabprompts.xml @@ -160,7 +160,9 @@ this.isLive = true; window.addEventListener("resize", this); window.addEventListener("unload", this); - linkedTab.addEventListener("TabClose", this); + if (linkedTab) { + linkedTab.addEventListener("TabClose", this); + } // Note: // nsPrompter.js or in e10s mode browser-parent.js call abortPrompt, // when the domWindow, for which the prompt was created, generates @@ -191,7 +193,9 @@ try { window.removeEventListener("resize", this); window.removeEventListener("unload", this); - this.linkedTab.removeEventListener("TabClose", this); + if (this.linkedTab) { + this.linkedTab.removeEventListener("TabClose", this); + } } catch (e) { } this.isLive = false; // invoke callback