From 52d6e76c0256d029283f1a64facd9ecc2c328591 Mon Sep 17 00:00:00 2001 From: Matt Woodrow Date: Wed, 6 Nov 2019 18:22:17 +0000 Subject: [PATCH] Bug 1593560 - Adjust tests to wait for data uri to load properly, since it now includes an extra IPDL roundtrip. r=kmag,ochameau Differential Revision: https://phabricator.services.mozilla.com/D51548 --HG-- extra : moz-landing-system : lando --- .../browser/browser_firstPartyIsolation.js | 23 +++++++++++++------ .../originattributes/test/browser/window.html | 3 --- .../browser/browser_tabMatchesInAwesomebar.js | 8 +++---- devtools/server/tests/browser/browser.ini | 1 + dom/html/test/test_fullscreen-api-race.html | 23 ++++++++++--------- 5 files changed, 32 insertions(+), 26 deletions(-) diff --git a/browser/components/originattributes/test/browser/browser_firstPartyIsolation.js b/browser/components/originattributes/test/browser/browser_firstPartyIsolation.js index 4747db978f7f..b98004d085a9 100644 --- a/browser/components/originattributes/test/browser/browser_firstPartyIsolation.js +++ b/browser/components/originattributes/test/browser/browser_firstPartyIsolation.js @@ -254,25 +254,33 @@ add_task(async function openWindow_test() { }); let tab = BrowserTestUtils.addTab(gBrowser, BASE_URL + "window.html"); - let win = await BrowserTestUtils.waitForNewWindow(); + await BrowserTestUtils.browserLoaded(tab.linkedBrowser); await SpecialPowers.spawn( - win.gBrowser.selectedBrowser, + tab.linkedBrowser, [{ firstPartyDomain: "mochi.test" }], async function(attrs) { + let promise = new Promise(resolve => { + content.addEventListener("message", resolve, { once: true }); + }); + var w = content.wrappedJSObject.open(); + w.document.body.innerHTML = ``; + + await promise; + Assert.equal( - content.docShell.getOriginAttributes().firstPartyDomain, + w.content.docShell.getOriginAttributes().firstPartyDomain, attrs.firstPartyDomain, "window.open() should have firstPartyDomain attribute" ); Assert.equal( - content.document.nodePrincipal.originAttributes.firstPartyDomain, + w.content.document.nodePrincipal.originAttributes.firstPartyDomain, attrs.firstPartyDomain, "The document should have firstPartyDomain" ); - let iframe = content.document.getElementById("iframe1"); - SpecialPowers.spawn(iframe, [attrs.firstPartyDomain], function( + let iframe = w.content.document.getElementById("iframe1"); + await SpecialPowers.spawn(iframe, [attrs.firstPartyDomain], function( firstPartyDomain ) { Assert.equal( @@ -287,11 +295,12 @@ add_task(async function openWindow_test() { "iframe should have firstPartyDomain" ); }); + + w.close(); } ); gBrowser.removeTab(tab); - await BrowserTestUtils.closeWindow(win); }); /** diff --git a/browser/components/originattributes/test/browser/window.html b/browser/components/originattributes/test/browser/window.html index 34216030c752..e87e93b0b307 100644 --- a/browser/components/originattributes/test/browser/window.html +++ b/browser/components/originattributes/test/browser/window.html @@ -6,8 +6,5 @@ - diff --git a/browser/components/urlbar/tests/browser/browser_tabMatchesInAwesomebar.js b/browser/components/urlbar/tests/browser/browser_tabMatchesInAwesomebar.js index 96a635a6bdcd..5949606c8cad 100644 --- a/browser/components/urlbar/tests/browser/browser_tabMatchesInAwesomebar.js +++ b/browser/components/urlbar/tests/browser/browser_tabMatchesInAwesomebar.js @@ -64,9 +64,8 @@ add_task(async function step_3() { add_task(async function step_4() { info("Running step 4 - ensure we don't register subframes as open pages"); - let tab = BrowserTestUtils.addTab(gBrowser); - BrowserTestUtils.loadURI( - tab.linkedBrowser, + let tab = BrowserTestUtils.addTab( + gBrowser, 'data:text/html,' ); await BrowserTestUtils.browserLoaded(tab.linkedBrowser); @@ -96,8 +95,7 @@ add_task(async function step_6() { "Running step 6 - check swapBrowsersAndCloseOther preserves registered switch-to-tab result" ); let tabToKeep = BrowserTestUtils.addTab(gBrowser); - let tab = BrowserTestUtils.addTab(gBrowser); - BrowserTestUtils.loadURI(tab.linkedBrowser, "about:mozilla"); + let tab = BrowserTestUtils.addTab(gBrowser, "about:mozilla"); await BrowserTestUtils.browserLoaded(tab.linkedBrowser); gBrowser.updateBrowserRemoteness(tabToKeep.linkedBrowser, { diff --git a/devtools/server/tests/browser/browser.ini b/devtools/server/tests/browser/browser.ini index 65ff44068c72..c71d454f55ef 100644 --- a/devtools/server/tests/browser/browser.ini +++ b/devtools/server/tests/browser/browser.ini @@ -110,6 +110,7 @@ skip-if = e10s # Bug 1183605 - devtools/server/tests/browser/ tests are still di [browser_inspector-insert.js] [browser_inspector-mutations-childlist.js] [browser_inspector-mutations-frameload.js] +skip-if = true # Bug 1593562 [browser_inspector-release.js] [browser_inspector-remove.js] [browser_inspector-retain.js] diff --git a/dom/html/test/test_fullscreen-api-race.html b/dom/html/test/test_fullscreen-api-race.html index aeaa07c93b75..d5928ff7ae78 100644 --- a/dom/html/test/test_fullscreen-api-race.html +++ b/dom/html/test/test_fullscreen-api-race.html @@ -63,17 +63,18 @@ const OPEN_WINDOW_FUNCS = [ const ACTION_FUNCS = [ function navigate(win) { info("About to navigate to another page"); - var deferred = new Deferred(); - win.location = "data:text/html,"; - setTimeout(() => { - SimpleTest.waitForFocus(() => { - checkIsChromeFullscreen(win, false).then(() => { - win.close(); - deferred.resolve(); - }); - }, win); - }, 0); - return deferred.promise; + var promise = new Promise(resolve => { + window.addEventListener("message", () => { + SimpleTest.waitForFocus(() => { + checkIsChromeFullscreen(win, false).then(() => { + win.close(); + resolve(); + }); + }, win); + }, { once: true }); + }); + win.location = `data:text/html,`; + return promise; }, function closeWindow(win) { info("About to close the window");