зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1607984 - P11. Don't assume the page will be loaded synchronously. r=zombie
We must wait for the iframe created by extension1 to be fully loaded before we can attempt to send a message to it. So we send a message when it is ready, and suspend the execution until this message is received. Differential Revision: https://phabricator.services.mozilla.com/D70008
This commit is contained in:
Родитель
e417e5a34d
Коммит
46e166596d
|
@ -22,6 +22,8 @@ add_task(async function() {
|
|||
browser.runtime.onMessage.addListener((msg, sender) => {
|
||||
browser.test.sendMessage("received-page", { msg, sender });
|
||||
});
|
||||
// Let them know we're done loading the page.
|
||||
browser.test.sendMessage("page-ready");
|
||||
},
|
||||
"page.html": `<!DOCTYPE html><meta charset="utf-8"><script src="page.js"></script>`,
|
||||
},
|
||||
|
@ -37,6 +39,7 @@ add_task(async function() {
|
|||
});
|
||||
|
||||
await Promise.all([extension1.startup(), extension2.startup()]);
|
||||
await extension1.awaitMessage("page-ready");
|
||||
|
||||
// Check that a message was sent within extension1.
|
||||
async function checkLocalMessage(msg) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче