mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1199832 - [webext] browser.tabs.executeScript must create a context (r=gabor)
This commit is contained in:
parent
6867e342f2
commit
fdb75efced
@ -1,3 +1,4 @@
|
||||
[browser_extensions_simple.js]
|
||||
[browser_ext_tabs_executeScript.js]
|
||||
[browser_ext_tabs_query.js]
|
||||
[browser_ext_tabs_update.js]
|
||||
|
@ -0,0 +1,32 @@
|
||||
add_task(function* () {
|
||||
let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, "http://mochi.test:8888/");
|
||||
|
||||
let extension = ExtensionTestUtils.loadExtension({
|
||||
manifest: {
|
||||
"permissions": ["tabs"]
|
||||
},
|
||||
|
||||
background: function() {
|
||||
browser.runtime.onMessage.addListener((msg, sender) => {
|
||||
browser.test.assertEq(msg, "script ran", "script ran");
|
||||
browser.test.notifyPass("executeScript");
|
||||
});
|
||||
|
||||
browser.tabs.executeScript({
|
||||
file: "script.js"
|
||||
});
|
||||
},
|
||||
|
||||
files: {
|
||||
"script.js": function() {
|
||||
browser.runtime.sendMessage("script ran");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
yield extension.startup();
|
||||
yield extension.awaitFinish("executeScript");
|
||||
yield extension.unload();
|
||||
|
||||
yield BrowserTestUtils.removeTab(tab);
|
||||
});
|
@ -336,11 +336,7 @@ let DocumentManager = {
|
||||
|
||||
executeScript(global, extensionId, script) {
|
||||
let window = global.content;
|
||||
let extensions = this.windows.get(window);
|
||||
if (!extensions) {
|
||||
return;
|
||||
}
|
||||
let context = extensions.get(extensionId);
|
||||
let context = this.getContext(extensionId, window);
|
||||
if (!context) {
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user