Bug 1657182: browser_PanelMultiView_keyboard.js: Use a capturing event listener on the browser/iframe to capture the load event from the child document. r=Gijs

Differential Revision: https://phabricator.services.mozilla.com/D86112
This commit is contained in:
James Teh 2020-08-07 12:23:12 +00:00
Родитель 6d82f7f1a0
Коммит 03d92312c3
1 изменённых файлов: 4 добавлений и 11 удалений

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

@ -460,17 +460,10 @@ async function testTabArrowsEmbeddedDoc(aView, aEmbedder) {
if (doc.readyState != "complete" || doc.location.href != kEmbeddedDocUrl) { if (doc.readyState != "complete" || doc.location.href != kEmbeddedDocUrl) {
info(`Embedded doc readyState ${doc.readyState}, location ${doc.location}`); info(`Embedded doc readyState ${doc.readyState}, location ${doc.location}`);
info("Waiting for load on embedder"); info("Waiting for load on embedder");
if (aEmbedder.tagName == "browser") { // Browsers don't fire load events, and iframes don't fire load events in
// We can't use BrowserTestUtils.browserLoaded because it assumes the // typeChrome windows. We can handle both by using a capturing event
// browser is linked to a tab. // listener to capture the load event from the child document.
await BrowserTestUtils.waitForEvent( await BrowserTestUtils.waitForEvent(aEmbedder, "load", true);
aEmbedder,
"BrowserTestUtils:ContentEvent:load"
);
} else {
// iframe
await BrowserTestUtils.waitForEvent(aEmbedder, "load");
}
// The original doc might have been a temporary about:blank, so fetch it // The original doc might have been a temporary about:blank, so fetch it
// again. // again.
doc = aEmbedder.contentDocument; doc = aEmbedder.contentDocument;