зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1199832 - [webext] browser.tabs.executeScript must create a context (r=gabor)
This commit is contained in:
Родитель
828a74056a
Коммит
1b946c60b2
|
@ -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;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче