bug 1585630: remote: load frameNavigated test resources from Data URL; r=remote-protocol-reviewers,whimboo

In order to get the browser_page_frameNavigated.js and
browser_page_frameNavigated_iframe.js tests passing under Fission
we can load the test resources from the same site origin as the
initial test document.  This avoids a content browser remoteness
change, which strictly speaking is not what the tests are testing.

Differential Revision: https://phabricator.services.mozilla.com/D47897

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andreas Tolfsen 2019-10-02 13:21:07 +00:00
parent a2523ef212
commit dada1b17df
5 changed files with 15 additions and 33 deletions

View File

@ -6,8 +6,6 @@ support-files =
chrome-remote-interface.js
doc_input_dispatchKeyEvent_race.html
doc_network_requestWillBeSent.html
doc_page_frameNavigated.html
doc_page_frameNavigated_iframe.html
file_network_requestWillBeSent.js
head.js
@ -19,9 +17,7 @@ support-files =
[browser_network_requestWillBeSent.js]
[browser_page_bringToFront.js]
[browser_page_frameNavigated.js]
skip-if = fission
[browser_page_frameNavigated_iframe.js]
skip-if = fission
[browser_page_javascriptDialog_alert.js]
[browser_page_javascriptDialog_beforeunload.js]
[browser_page_javascriptDialog_confirm.js]

View File

@ -5,13 +5,16 @@
// Test the Page navigation events
const TEST_DOC = toDataURL("default-test-page");
const INITIAL_DOC = toDataURL("default-test-page");
const RANDOM_ID_DOC = toDataURL(
`<script>window.randomId = Math.random() + "-" + Date.now();</script>`
);
const promises = new Set();
const resolutions = new Map();
add_task(async function() {
const { client } = await setupForURL(TEST_DOC);
const { client } = await setupForURL(INITIAL_DOC);
const { Page } = client;
@ -23,7 +26,11 @@ add_task(async function() {
ok(!!frameTree.frame, "getFrameTree exposes one frame");
is(frameTree.childFrames.length, 0, "getFrameTree reports no child frame");
ok(frameTree.frame.id, "getFrameTree's frame has an id");
is(frameTree.frame.url, TEST_DOC, "getFrameTree's frame has the right url");
is(
frameTree.frame.url,
INITIAL_DOC,
"getFrameTree's frame has the right url"
);
// Save the given `promise` resolution into the `promises` global Set
function recordPromise(name, promise) {
@ -45,8 +52,7 @@ add_task(async function() {
info("Test Page.navigate");
recordPromises();
const url =
"http://example.com/browser/remote/test/browser/doc_page_frameNavigated.html";
const url = RANDOM_ID_DOC;
const { frameId } = await Page.navigate({ url });
ok(true, "A new page has been loaded");

View File

@ -5,8 +5,9 @@
// Test that frameNavigated is not fired for iframes embedded in the page.
const PAGE_URL =
"http://example.com/browser/remote/test/browser/doc_page_frameNavigated_iframe.html";
const IFRAME_DOC = toDataURL(
`<iframe src="data:text/html,somecontent"></iframe>`
);
const promises = new Set();
const resolutions = new Map();
@ -23,7 +24,7 @@ add_task(async function() {
info("Navigate to a page containing an iframe");
const onStoppedLoading = Page.frameStoppedLoading();
const { frameId } = await Page.navigate({ url: PAGE_URL });
const { frameId } = await Page.navigate({ url: IFRAME_DOC });
await onStoppedLoading;
is(frameNavigatedEvents.length, 1, "Received only 1 frameNavigated event");

View File

@ -1,12 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>Test page for frameNavigated</title>
</head>
<body>
<script type="text/javascript">
// Create a random string that should be unique after each reload.
window.randomId = Math.random() + "-" + Date.now();
</script>
</body>
</html>

View File

@ -1,9 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>Test page for frameNavigated_iframe</title>
</head>
<body>
<iframe src="data:text/html,somecontent"></iframe>
</body>
</html>