From 2cee1b7cbed9459860afe04cd36e44c7c1d1459d Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Tue, 1 Aug 2017 15:44:05 -0700 Subject: [PATCH] Bug 1375490: Part 2 - Support alerts in OOP extension sidebars. r=mixedpuppy MozReview-Commit-ID: AbQ2uVcZzM4 --HG-- extra : rebase_source : ceea4dcd9ae94a92537d3f5a8d4328c8986040a0 --- browser/base/content/webext-panels.js | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/browser/base/content/webext-panels.js b/browser/base/content/webext-panels.js index 1dd8d4966db5..164f442e0d00 100644 --- a/browser/base/content/webext-panels.js +++ b/browser/base/content/webext-panels.js @@ -24,6 +24,9 @@ function getBrowser(sidebar) { return Promise.resolve(browser); } + let stack = document.createElementNS(XUL_NS, "stack"); + stack.setAttribute("flex", "1"); + browser = document.createElementNS(XUL_NS, "browser"); browser.setAttribute("id", "webext-panels-browser"); browser.setAttribute("type", "content"); @@ -50,7 +53,9 @@ function getBrowser(sidebar) { } else { readyPromise = Promise.resolve(); } - document.documentElement.appendChild(browser); + + stack.appendChild(browser); + document.documentElement.appendChild(stack); return readyPromise.then(() => { browser.messageManager.loadFrameScript("chrome://browser/content/content.js", false); @@ -68,6 +73,20 @@ function getBrowser(sidebar) { }); } +// Stub tabbrowser implementation for use by the tab-modal alert code. +var gBrowser = { + getTabForBrowser(browser) { + return null; + }, + + getTabModalPromptBox(browser) { + if (!browser.tabModalPromptBox) { + browser.tabModalPromptBox = new TabModalPromptBox(browser); + } + return browser.tabModalPromptBox; + }, +}; + function loadWebPanel() { let sidebarURI = new URL(location); let sidebar = {