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
This commit is contained in:
Matt Woodrow 2019-11-06 22:37:07 +00:00
parent 03a47f121f
commit 2704b7ceff
5 changed files with 32 additions and 26 deletions

View File

@ -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 = `<iframe id='iframe1' onload="window.opener.postMessage('ready', '*');" src='data:text/plain,test2'></iframe>`;
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);
});
/**

View File

@ -6,8 +6,5 @@
</head>
<body>
<script type="text/javascript">
var w = window.open();
w.document.body.innerHTML = "<iframe id='iframe1' src='data:text/plain,test2'></iframe>";
</script>
</body>
</html>

View File

@ -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,<body><iframe src=""></iframe></body>'
);
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, {

View File

@ -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]

View File

@ -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,<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,<body onload="window.opener.postMessage('ready', '*');">`;
return promise;
},
function closeWindow(win) {
info("About to close the window");