зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1453260 - run test script in specific page only r=aswan
Use a more specific entry point for the test than "http://mochitest.test:8888" to make sure that the test is only started once, when the test opens a tab with the entry point. MozReview-Commit-ID: 7iAFREDuACu --HG-- extra : rebase_source : 6ab46b1114dc824f29d0bf21ffa784cd14651447
This commit is contained in:
Родитель
7e91120b19
Коммит
4a63a4cd88
|
@ -11,7 +11,7 @@ function loadExtension() {
|
|||
manifest: {
|
||||
"content_scripts": [{
|
||||
"js": ["script.js"],
|
||||
"matches": ["http://mochi.test/"],
|
||||
"matches": ["http://mochi.test/?discoTest"],
|
||||
}],
|
||||
},
|
||||
background() {
|
||||
|
@ -21,7 +21,7 @@ function loadExtension() {
|
|||
browser.test.sendMessage("port_disconnected");
|
||||
});
|
||||
port.onMessage.addListener(async msg => {
|
||||
browser.test.assertEq("connect_from_contentscript", msg, "expected message");
|
||||
browser.test.assertEq("connect_from_script", msg, "expected message");
|
||||
// Move a tab to a new window and back. Regression test for bugzil.la/1448674
|
||||
let {windowId, id: tabId, index} = port.sender.tab;
|
||||
await browser.windows.create({tabId});
|
||||
|
@ -65,7 +65,7 @@ function loadExtension() {
|
|||
});
|
||||
browser.runtime.sendMessage("disconnect-me");
|
||||
});
|
||||
port.postMessage("connect_from_contentscript");
|
||||
port.postMessage("connect_from_script");
|
||||
},
|
||||
},
|
||||
});
|
||||
|
@ -74,7 +74,7 @@ function loadExtension() {
|
|||
add_task(async function contentscript_connect_and_move_tabs() {
|
||||
let extension = loadExtension();
|
||||
await extension.startup();
|
||||
await BrowserTestUtils.openNewForegroundTab(gBrowser, "http://mochi.test:8888/");
|
||||
await BrowserTestUtils.openNewForegroundTab(gBrowser, "http://mochi.test:8888/?discoTest");
|
||||
await extension.awaitMessage("port_ping_ponged_before_disconnect");
|
||||
await extension.awaitMessage("port_disconnected");
|
||||
// Must use gBrowser.selectedTab instead of the return value of
|
||||
|
|
Загрузка…
Ссылка в новой задаче