Commit a885c2a4 authored by Ingrid Buh twigle_ingrid's avatar Ingrid Buh twigle_ingrid
Browse files

Bug 1640877 - Fix intermittent failures for...

Bug 1640877 - Fix intermittent failures for browser/base/content/test/about/browser_aboutNetError_csp_iframe.js. r=johannh,prathiksha, a=test-only

Differential Revision: https://phabricator.services.mozilla.com/D77059
parent 5e8ce219
......@@ -62,13 +62,21 @@ async function setupPage(htmlPageName, blockedPage) {
is(strictCookie.sameSite, 2, "The cookie is a same site strict cookie");
// Opening the page containing the iframe
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, iFramePage);
// Opening the page that contains the iframe
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser);
let browser = tab.linkedBrowser;
let browserLoaded = BrowserTestUtils.browserLoaded(
browser,
true,
blockedPage,
true
);
await SpecialPowers.spawn(browser, [blockedPage], async function(
cspBlockedPage
) {
BrowserTestUtils.loadURI(browser, iFramePage);
await browserLoaded;
info("The error page has loaded!");
await SpecialPowers.spawn(browser, [], async function() {
let iframe = content.document.getElementById("theIframe");
await ContentTaskUtils.waitForCondition(() =>
......@@ -78,7 +86,7 @@ async function setupPage(htmlPageName, blockedPage) {
let iframe = browser.browsingContext.children[0];
let loaded = BrowserTestUtils.waitForNewTab(gBrowser, null, true);
let newTabLoaded = BrowserTestUtils.waitForNewTab(gBrowser, null, true);
// In the iframe, we see the correct error page and click on the button
// to open the blocked page in a new window/tab
......@@ -100,8 +108,11 @@ async function setupPage(htmlPageName, blockedPage) {
// We click on the button
await EventUtils.synthesizeMouseAtCenter(button, {}, content);
});
info("Button was clicked!");
// We wait for the new tab to load
await loaded;
await newTabLoaded;
info("The new tab has loaded!");
let iframePageTab = tab;
return {
......
......@@ -62,13 +62,21 @@ async function setupPage(htmlPageName, blockedPage) {
is(strictCookie.sameSite, 2, "The cookie is a same site strict cookie");
// Opening the page containing the iframe
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, iFramePage);
// Opening the page that contains the iframe
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser);
let browser = tab.linkedBrowser;
let browserLoaded = BrowserTestUtils.browserLoaded(
browser,
true,
blockedPage,
true
);
await SpecialPowers.spawn(browser, [blockedPage], async function(
xfoBlockedPage
) {
BrowserTestUtils.loadURI(browser, iFramePage);
await browserLoaded;
info("The error page has loaded!");
await SpecialPowers.spawn(browser, [], async function() {
let iframe = content.document.getElementById("theIframe");
await ContentTaskUtils.waitForCondition(() =>
......@@ -77,7 +85,7 @@ async function setupPage(htmlPageName, blockedPage) {
});
let frameContext = browser.browsingContext.children[0];
let loaded = BrowserTestUtils.waitForNewTab(gBrowser, null, true);
let newTabLoaded = BrowserTestUtils.waitForNewTab(gBrowser, null, true);
// In the iframe, we see the correct error page and click on the button
// to open the blocked page in a new window/tab
......@@ -99,8 +107,11 @@ async function setupPage(htmlPageName, blockedPage) {
// We click on the button
await EventUtils.synthesizeMouseAtCenter(button, {}, content);
});
info("Button was clicked!");
// We wait for the new tab to load
await loaded;
await newTabLoaded;
info("The new tab has loaded!");
let iframePageTab = tab;
return {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment