зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1207911 - [webext] Fix races in webextension tests (r=gabor)
This commit is contained in:
Родитель
3aafaa38cb
Коммит
330e587de8
|
@ -10,8 +10,7 @@ add_task(function* test_simple() {
|
|||
add_task(function* test_background() {
|
||||
let extension = ExtensionTestUtils.loadExtension("background");
|
||||
info("load complete");
|
||||
yield extension.startup();
|
||||
let x = yield extension.awaitMessage("running");
|
||||
let [, x] = yield Promise.all([extension.startup(), extension.awaitMessage("running")]);
|
||||
is(x, 1, "got correct value from extension");
|
||||
info("startup complete");
|
||||
extension.sendMessage(10, 20);
|
||||
|
|
|
@ -30,8 +30,7 @@ add_task(function* () {
|
|||
},
|
||||
});
|
||||
|
||||
yield extension.startup();
|
||||
yield extension.awaitMessage("check");
|
||||
yield Promise.all([extension.startup(), extension.awaitMessage("check")]);
|
||||
|
||||
ok(gBrowser.selectedTab == tab2, "correct tab selected");
|
||||
|
||||
|
|
|
@ -40,8 +40,7 @@ add_task(function* () {
|
|||
},
|
||||
});
|
||||
|
||||
yield extension.startup();
|
||||
yield extension.awaitMessage("check");
|
||||
yield Promise.all([extension.startup(), extension.awaitMessage("check")]);
|
||||
|
||||
yield promiseWaitForFocus(window1);
|
||||
|
||||
|
|
|
@ -16,8 +16,6 @@
|
|||
add_task(function* test_contentscript()
|
||||
{
|
||||
let extension = ExtensionTestUtils.loadExtension("content_script");
|
||||
yield extension.startup();
|
||||
info("extension loaded");
|
||||
|
||||
let loadingCount = 0;
|
||||
let interactiveCount = 0;
|
||||
|
@ -31,6 +29,9 @@ add_task(function* test_contentscript()
|
|||
|
||||
let chromeNamespacePromise = extension.awaitMessage("chrome-namespace-ok");
|
||||
|
||||
yield extension.startup();
|
||||
info("extension loaded");
|
||||
|
||||
let win = window.open("file_sample.html");
|
||||
|
||||
yield Promise.all([waitForLoad(win), completePromise, chromeNamespacePromise]);
|
||||
|
|
|
@ -32,8 +32,7 @@ let extensionData = {
|
|||
add_task(function* test_background() {
|
||||
let extension = ExtensionTestUtils.loadExtension(extensionData);
|
||||
info("load complete");
|
||||
yield extension.startup();
|
||||
let x = yield extension.awaitMessage("running");
|
||||
let [, x] = yield Promise.all([extension.startup(), extension.awaitMessage("running")]);
|
||||
is(x, 1, "got correct value from extension");
|
||||
info("startup complete");
|
||||
extension.sendMessage(10, 20);
|
||||
|
|
|
@ -24,8 +24,7 @@ add_task(function* test_simple() {
|
|||
add_task(function* test_background() {
|
||||
let extension = ExtensionTestUtils.loadExtension("background");
|
||||
info("load complete");
|
||||
yield extension.startup();
|
||||
let x = yield extension.awaitMessage("running");
|
||||
let [, x] = yield Promise.all([extension.startup(), extension.awaitMessage("running")]);
|
||||
is(x, 1, "got correct value from extension");
|
||||
info("startup complete");
|
||||
extension.sendMessage(10, 20);
|
||||
|
|
|
@ -156,9 +156,7 @@ let extensionData = {
|
|||
|
||||
add_task(function* test_contentscript() {
|
||||
let extension = ExtensionTestUtils.loadExtension(extensionData);
|
||||
yield extension.startup();
|
||||
info("extension loaded");
|
||||
yield extension.awaitMessage("invalidate");
|
||||
yield Promise.all([extension.startup(), extension.awaitMessage("invalidate")]);
|
||||
SpecialPowers.invalidateExtensionStorageCache();
|
||||
extension.sendMessage("invalidated");
|
||||
yield extension.awaitFinish("storage");
|
||||
|
|
|
@ -77,8 +77,7 @@ function compareLists(list1, list2, kind)
|
|||
function* test_once()
|
||||
{
|
||||
let extension = ExtensionTestUtils.loadExtension("webrequest");
|
||||
yield extension.startup();
|
||||
yield extension.awaitMessage("ready");
|
||||
yield Promise.all([extension.startup(), extension.awaitMessage("ready")]);
|
||||
info("webrequest extension loaded");
|
||||
|
||||
yield new Promise(resolve => { setTimeout(resolve, 0); });
|
||||
|
|
Загрузка…
Ссылка в новой задаче