Bug 1527029 - Split about:blank test from browser_ext_tabs_executeScript.js r=zombie

The browser_ext_tabs_executeScript.js test occasionally times out.
Apparently the part of the test that opens "about:blank" and awaits the
result sometimes times out (`tabs.executeScript` does not resolve).

To avoid collateral damage by this small part of the test, the
"about:blank" test has been moved to its own file.

Differential Revision: https://phabricator.services.mozilla.com/D45955

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Rob Wu 2019-09-15 22:18:27 +00:00
Родитель daa68529bc
Коммит 6c8fef0765
3 изменённых файлов: 31 добавлений и 14 удалений

Просмотреть файл

@ -226,7 +226,7 @@ fail-if = fission
skip-if = true # Bug 1521363
[browser_ext_tabs_events_order.js]
[browser_ext_tabs_executeScript.js]
skip-if = (verify && !debug && (os == 'mac'))
[browser_ext_tabs_executeScript_about_blank.js]
[browser_ext_tabs_executeScript_good.js]
[browser_ext_tabs_executeScript_bad.js]
[browser_ext_tabs_executeScript_multiple.js]

Просмотреть файл

@ -383,19 +383,6 @@ add_task(async function testExecuteScript() {
await browser.tabs.remove(tab.id);
}),
browser.tabs.create({ url: "about:blank" }).then(async tab => {
const result = await browser.tabs.executeScript(tab.id, {
code: "location.href",
matchAboutBlank: true,
});
browser.test.assertEq(
"about:blank",
result[0],
"Script executed correctly in new tab"
);
await browser.tabs.remove(tab.id);
}),
new Promise(resolve => {
browser.runtime.onMessage.addListener(message => {
browser.test.assertEq(

Просмотреть файл

@ -0,0 +1,30 @@
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set sts=2 sw=2 et tw=80: */
"use strict";
add_task(async function testExecuteScript_at_about_blank() {
let extension = ExtensionTestUtils.loadExtension({
async background() {
try {
const tab = await browser.tabs.create({ url: "about:blank" });
const result = await browser.tabs.executeScript(tab.id, {
code: "location.href",
matchAboutBlank: true,
});
browser.test.assertEq(
"about:blank",
result[0],
"Script executed correctly in new tab"
);
await browser.tabs.remove(tab.id);
browser.test.notifyPass("executeScript");
} catch (e) {
browser.test.fail(`Error: ${e} :: ${e.stack}`);
browser.test.notifyFail("executeScript");
}
},
});
await extension.startup();
await extension.awaitFinish("executeScript");
await extension.unload();
});