From 06a195312a1bbab90a78b0253e4d601ac99f4fe7 Mon Sep 17 00:00:00 2001 From: Bill McCloskey Date: Fri, 28 Aug 2015 17:11:16 -0700 Subject: [PATCH] Bug 1199842 - [webext] Add missing XUL_NS variable for browser_action (r=gabor) --- .../extensions/ext-browserAction.js | 1 + .../extensions/test/browser/browser.ini | 1 + .../browser_ext_browserAction_simple.js | 36 +++++++++++++++++++ 3 files changed, 38 insertions(+) create mode 100644 browser/components/extensions/test/browser/browser_ext_browserAction_simple.js diff --git a/browser/components/extensions/ext-browserAction.js b/browser/components/extensions/ext-browserAction.js index f29cd2038a47..7fe82cf8d493 100644 --- a/browser/components/extensions/ext-browserAction.js +++ b/browser/components/extensions/ext-browserAction.js @@ -140,6 +140,7 @@ BrowserAction.prototype = { panel.setAttribute("flip", "slide"); node.appendChild(panel); + const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; let browser = document.createElementNS(XUL_NS, "browser"); browser.setAttribute("type", "content"); browser.setAttribute("disableglobalhistory", "true"); diff --git a/browser/components/extensions/test/browser/browser.ini b/browser/components/extensions/test/browser/browser.ini index f159e5f71054..83eb1fba1ba8 100644 --- a/browser/components/extensions/test/browser/browser.ini +++ b/browser/components/extensions/test/browser/browser.ini @@ -1,4 +1,5 @@ [browser_extensions_simple.js] +[browser_ext_browserAction_simple.js] [browser_ext_tabs_executeScript.js] [browser_ext_tabs_query.js] [browser_ext_tabs_update.js] diff --git a/browser/components/extensions/test/browser/browser_ext_browserAction_simple.js b/browser/components/extensions/test/browser/browser_ext_browserAction_simple.js new file mode 100644 index 000000000000..9a5d74b49e71 --- /dev/null +++ b/browser/components/extensions/test/browser/browser_ext_browserAction_simple.js @@ -0,0 +1,36 @@ +add_task(function* () { + let extension = ExtensionTestUtils.loadExtension({ + manifest: { + "browser_action": { + "default_popup": "popup.html" + } + }, + + files: { + "popup.html": ` + + + + + `, + + "popup.js": function() { + browser.runtime.sendMessage("from-popup"); + } + }, + + background: function() { + browser.runtime.onMessage.addListener(msg => { + browser.test.assertEq(msg, "from-popup", "correct message received"); + browser.test.notifyPass("browser_action.simple"); + }); + }, + }); + + yield extension.startup(); + + // FIXME: Should really test opening the popup here. + + yield extension.awaitFinish("browser_action.simple"); + yield extension.unload(); +});