Bug 1530765 - Replace waitForEvent in the browser_pageinfo_firstPartyIsolation.js by the BrowserTestUtils.waitForEvent utility function. r=johannh CLOSED TREE

--HG--
extra : amend_source : c27dd680e777ecc7527c1d022148298110c682e0
This commit is contained in:
jawad 2019-02-27 19:40:17 +05:00
parent 9aed4b2b35
commit 9f4c7e75a5

View File

@ -1,10 +1,5 @@
const Cm = Components.manager;
function waitForEvent(elem, event) {
return new Promise(resolve => {
elem.addEventListener(event, resolve, {capture: true, once: true});
});
}
function testFirstPartyDomain(pageInfo) {
return new Promise(resolve => {
@ -32,9 +27,9 @@ function testFirstPartyDomain(pageInfo) {
// the triggeringprincipal attribute on the node, so we simply wait for
// loadstart.
if (i == 0) {
await waitForEvent(preview, "loadend");
await BrowserTestUtils.waitForEvent(preview, "loadend");
} else {
await waitForEvent(preview, "loadstart");
await BrowserTestUtils.waitForEvent(preview, "loadstart");
}
info("preview load " + i);
@ -81,7 +76,7 @@ async function test() {
// see bug 1403365.
let pageInfo = BrowserPageInfo(url, "mediaTab", {});
info("waitForEvent pageInfo");
await waitForEvent(pageInfo, "load");
await BrowserTestUtils.waitForEvent(pageInfo, "load");
info("calling testFirstPartyDomain");
await testFirstPartyDomain(pageInfo);