From acd6aadb5d0d0718182d6661ed9e45c723a1528f Mon Sep 17 00:00:00 2001 From: Domenic Denicola Date: Wed, 15 Jan 2020 15:54:32 -0500 Subject: [PATCH 1/8] Test entry settings object for promise jobs Follows https://github.com/whatwg/html/pull/5212. --- .../promise-job-entry.html | 94 +++++++++++++++++++ .../resources/README.md | 5 + .../resources/current/current.html | 3 + .../current/resources/window-to-open.html | 2 + .../promise-job-entry-incumbent.html | 14 +++ .../resources/relevant/relevant.html | 3 + .../relevant/resources/window-to-open.html | 2 + .../resources/resources/window-to-open.html | 2 + .../resources/window-to-open.html | 2 + 9 files changed, 127 insertions(+) create mode 100644 html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-entry.html create mode 100644 html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/README.md create mode 100644 html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/current/current.html create mode 100644 html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/current/resources/window-to-open.html create mode 100644 html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/promise-job-entry-incumbent.html create mode 100644 html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/relevant/relevant.html create mode 100644 html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/relevant/resources/window-to-open.html create mode 100644 html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/resources/window-to-open.html create mode 100644 html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/window-to-open.html diff --git a/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-entry.html b/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-entry.html new file mode 100644 index 00000000000000..0a8cab13e65ea9 --- /dev/null +++ b/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-entry.html @@ -0,0 +1,94 @@ + + +Entry settings object for promise jobs + + + + + + + + + + diff --git a/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/README.md b/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/README.md new file mode 100644 index 00000000000000..a89258a4e01267 --- /dev/null +++ b/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/README.md @@ -0,0 +1,5 @@ +A couple notes about the files scattered in this `resources/` directory: + +* The nested directory structure is necessary here so that relative URL resolution can be tested; we need different sub-paths for each document. + +* The semi-duplicate `window-to-open.html`s scattered throughout are present because Firefox, at least, does not fire `Window` `load` events for 404s, so we want to ensure that no matter which global is used, `window`'s `load` event is hit and our tests can proceed. diff --git a/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/current/current.html b/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/current/current.html new file mode 100644 index 00000000000000..3986b19a292cbe --- /dev/null +++ b/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/current/current.html @@ -0,0 +1,3 @@ + +Current page used as a test helper + diff --git a/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/current/resources/window-to-open.html b/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/current/resources/window-to-open.html new file mode 100644 index 00000000000000..3500e647ad7a05 --- /dev/null +++ b/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/current/resources/window-to-open.html @@ -0,0 +1,2 @@ + +If the current settings object is used this page will be opened diff --git a/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/promise-job-entry-incumbent.html b/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/promise-job-entry-incumbent.html new file mode 100644 index 00000000000000..18d4f6a68cfd59 --- /dev/null +++ b/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/promise-job-entry-incumbent.html @@ -0,0 +1,14 @@ + +Incumbent page used as a test helper + + + + + diff --git a/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/relevant/relevant.html b/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/relevant/relevant.html new file mode 100644 index 00000000000000..fa701d7fc9035d --- /dev/null +++ b/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/relevant/relevant.html @@ -0,0 +1,3 @@ + +Relevant page used as a test helper + diff --git a/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/relevant/resources/window-to-open.html b/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/relevant/resources/window-to-open.html new file mode 100644 index 00000000000000..1fbef33c594136 --- /dev/null +++ b/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/relevant/resources/window-to-open.html @@ -0,0 +1,2 @@ + +If the relevant settings object is used this page will be opened diff --git a/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/resources/window-to-open.html b/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/resources/window-to-open.html new file mode 100644 index 00000000000000..fa6b8d01267600 --- /dev/null +++ b/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/resources/window-to-open.html @@ -0,0 +1,2 @@ + +If the incumbent settings object is used this page will be opened diff --git a/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/window-to-open.html b/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/window-to-open.html new file mode 100644 index 00000000000000..43bf6ddf546a6e --- /dev/null +++ b/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/window-to-open.html @@ -0,0 +1,2 @@ + +If the entry settings object is used this page will be opened From 7af6209e86fce2b9c92c03e3ca02583e74c3198f Mon Sep 17 00:00:00 2001 From: Domenic Denicola Date: Wed, 15 Jan 2020 16:16:50 -0500 Subject: [PATCH 2/8] Test incumbent settings object for promise jobs too --- .../promise-job-incumbent.html | 103 ++++++++++++++++++ .../promise-job-incumbent-incumbent.html | 14 +++ .../resources/relevant/relevant.html | 10 ++ 3 files changed, 127 insertions(+) create mode 100644 html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-incumbent.html create mode 100644 html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/promise-job-incumbent-incumbent.html diff --git a/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-incumbent.html b/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-incumbent.html new file mode 100644 index 00000000000000..5738b965d6046d --- /dev/null +++ b/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-incumbent.html @@ -0,0 +1,103 @@ + + +Incumbent settings object for promise jobs + + + + + + + + + + diff --git a/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/promise-job-incumbent-incumbent.html b/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/promise-job-incumbent-incumbent.html new file mode 100644 index 00000000000000..6b2550d3ee0396 --- /dev/null +++ b/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/promise-job-incumbent-incumbent.html @@ -0,0 +1,14 @@ + +Incumbent page used as a test helper + + + + + diff --git a/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/relevant/relevant.html b/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/relevant/relevant.html index fa701d7fc9035d..d16951622888cf 100644 --- a/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/relevant/relevant.html +++ b/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/relevant/relevant.html @@ -1,3 +1,13 @@ Relevant page used as a test helper + From 0214e7893c223810dbea579cb86f511a6611e5c7 Mon Sep 17 00:00:00 2001 From: Domenic Denicola Date: Wed, 15 Jan 2020 16:25:55 -0500 Subject: [PATCH 3/8] Test what happens when the resolver is in a different realm --- .../promise-job-incumbent.html | 20 ++++++++++++++----- .../promise-job-incumbent-resolver.html | 8 ++++++++ 2 files changed, 23 insertions(+), 5 deletions(-) create mode 100644 html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/promise-job-incumbent-resolver.html diff --git a/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-incumbent.html b/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-incumbent.html index 5738b965d6046d..3060e10954cb00 100644 --- a/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-incumbent.html +++ b/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-incumbent.html @@ -3,22 +3,24 @@ Incumbent settings object for promise jobs - - - + + From 28e581f5e91b190cf21f79841dac097b72f30d28 Mon Sep 17 00:00:00 2001 From: Domenic Denicola Date: Wed, 15 Jan 2020 16:44:51 -0500 Subject: [PATCH 4/8] Remove step_func, but everyone still passes --- .../promise-job-entry.html | 25 +++++++++++-------- .../promise-job-incumbent.html | 17 ++++++++----- 2 files changed, 26 insertions(+), 16 deletions(-) diff --git a/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-entry.html b/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-entry.html index 0a8cab13e65ea9..596f1bc50253a9 100644 --- a/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-entry.html +++ b/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-entry.html @@ -26,36 +26,39 @@ }, "Sanity check: this all works as expected with no promises involved"); async_test(t => { - Promise.resolve().then(t.step_func(() => { + // No t.step_func because that could change the realms + Promise.resolve().then(() => { const w = frames[0].runWindowOpenVeryIndirectly(relativeURL); w.onload = t.step_func_done(() => { t.add_cleanup(() => w.close()); assert_equals(w.location.href, expectedURL); }); - })); + }); }, "Fulfillment handler on fulfilled promise"); async_test(t => { - Promise.reject().catch(t.step_func(() => { + // No t.step_func because that could change the realms + Promise.reject().catch(() => { const w = frames[0].runWindowOpenVeryIndirectly(relativeURL); w.onload = t.step_func_done(() => { t.add_cleanup(() => w.close()); assert_equals(w.location.href, expectedURL); }); - })); + }); }, "Rejection handler on rejected promise"); async_test(t => { let resolve; const p = new Promise(r => { resolve = r; }); - p.then(t.step_func(() => { + // No t.step_func because that could change the realms + p.then(() => { const w = frames[0].runWindowOpenVeryIndirectly(relativeURL); w.onload = t.step_func_done(() => { t.add_cleanup(() => w.close()); assert_equals(w.location.href, expectedURL); }); - })); + }); t.step_timeout(resolve, 0); }, "Fulfillment handler on pending-then-fulfilled promise"); @@ -64,26 +67,28 @@ let reject; const p = new Promise((_, r) => { reject = r; }); - p.catch(t.step_func(() => { + // No t.step_func because that could change the realms + p.catch(() => { const w = frames[0].runWindowOpenVeryIndirectly(relativeURL); w.onload = t.step_func_done(() => { t.add_cleanup(() => w.close()); assert_equals(w.location.href, expectedURL); }); - })); + }); t.step_timeout(reject, 0); }, "Rejection handler on pending-then-rejected promise"); async_test(t => { const thenable = { - then: t.step_func((f) => { + // No t.step_func because that could change the realms + then(f) { const w = frames[0].runWindowOpenVeryIndirectly(relativeURL); w.onload = t.step_func_done(() => { t.add_cleanup(() => w.close()); assert_equals(w.location.href, expectedURL); }); - }) + } }; Promise.resolve(thenable); diff --git a/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-incumbent.html b/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-incumbent.html index 3060e10954cb00..fc614c63a6d0d1 100644 --- a/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-incumbent.html +++ b/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-incumbent.html @@ -49,6 +49,7 @@ async_test(t => { const thisTestId = setupTest(t); + // No t.step_func because that could change the realms Promise.resolve().then(() => { frames[0].runWindowPostMessageVeryIndirectly(thisTestId, "*"); }); @@ -57,6 +58,7 @@ async_test(t => { const thisTestId = setupTest(t); + // No t.step_func because that could change the realms Promise.reject().catch(() => { frames[0].runWindowPostMessageVeryIndirectly(thisTestId, "*"); }); @@ -72,9 +74,10 @@ let resolve; const p = new Promise(r => { resolve = r; }); - p.then(t.step_func(() => { + // No t.step_func because that could change the realms + p.then(() => { frames[0].runWindowPostMessageVeryIndirectly(thisTestId, "*"); - })); + }); t.step_timeout(() => { runInResolver(resolve); @@ -87,9 +90,10 @@ let reject; const p = new Promise((_, r) => { reject = r; }); - p.catch(t.step_func(() => { + // No t.step_func because that could change the realms + p.catch(() => { frames[0].runWindowPostMessageVeryIndirectly(thisTestId, "*"); - })); + }); t.step_timeout(() => { runInResolver(reject); @@ -100,9 +104,10 @@ const thisTestId = setupTest(t); const thenable = { - then: t.step_func((f) => { + // No t.step_func because that could change the realms + then(f) { frames[0].runWindowPostMessageVeryIndirectly(thisTestId, "*"); - }) + } }; Promise.resolve(thenable); From 332a3f4a9cd31ee4068dae3c038541d16a048ab1 Mon Sep 17 00:00:00 2001 From: Domenic Denicola Date: Wed, 15 Jan 2020 18:01:29 -0500 Subject: [PATCH 5/8] Add backup incumbent settings object stack-dependent tests for incumbent. Finally made Chrome fail. --- .../promise-job-incumbent.html | 48 ++++++++++++++++++- .../promise-job-incumbent-incumbent.html | 12 +++++ 2 files changed, 59 insertions(+), 1 deletion(-) diff --git a/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-incumbent.html b/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-incumbent.html index fc614c63a6d0d1..75146206128612 100644 --- a/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-incumbent.html +++ b/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-incumbent.html @@ -55,6 +55,13 @@ }); }, "Fulfillment handler on fulfilled promise"); + async_test(t => { + const thisTestId = setupTest(t); + + const p = Promise.resolve(); + frames[0].runWindowPostMessageVeryIndirectlyWithNoUserCode(p, "then", thisTestId, "*"); + }, "Fulfillment handler on fulfilled promise, using backup incumbent settings object stack"); + async_test(t => { const thisTestId = setupTest(t); @@ -64,7 +71,14 @@ }); }, "Rejection handler on rejected promise"); - // The following two test that we derive the incumbent settings object at promise-job time from + async_test(t => { + const thisTestId = setupTest(t); + + const p = Promise.reject(); + frames[0].runWindowPostMessageVeryIndirectlyWithNoUserCode(p, "catch", thisTestId, "*"); + }, "Rejection handler on rejected promise, using backup incumbent settings object stack"); + + // The following test that we derive the incumbent settings object at promise-job time from // the incumbent realm at the time the handler was added, not at the time the resolve()/reject() // was done. See https://github.com/whatwg/html/issues/5213 for the spec side of this issue. @@ -84,6 +98,19 @@ }, 0); }, "Fulfillment handler on pending-then-fulfilled promise"); + async_test(t => { + const thisTestId = setupTest(t); + + let resolve; + const p = new Promise(r => { resolve = r; }); + + frames[0].runWindowPostMessageVeryIndirectlyWithNoUserCode(p, "then", thisTestId, "*"); + + t.step_timeout(() => { + runInResolver(resolve); + }, 0); + }, "Fulfillment handler on pending-then-fulfilled promise, using backup incumbent settings object stack"); + async_test(t => { const thisTestId = setupTest(t); @@ -100,6 +127,19 @@ }, 0); }, "Rejection handler on pending-then-rejected promise"); + async_test(t => { + const thisTestId = setupTest(t); + + let reject; + const p = new Promise((_, r) => { reject = r; }); + + frames[0].runWindowPostMessageVeryIndirectlyWithNoUserCode(p, "catch", thisTestId, "*"); + + t.step_timeout(() => { + runInResolver(reject); + }, 0); + }, "Rejection handler on pending-then-rejected promise, using backup incumbent settings object stack"); + async_test(t => { const thisTestId = setupTest(t); @@ -113,6 +153,12 @@ Promise.resolve(thenable); }, "Thenable resolution"); + async_test(t => { + const thisTestId = setupTest(t); + + frames[0].resolveThenableThatRunsWindowPostMessageVeryIndirectlyWithNoUserCode(testId, "*", []); + }, "Thenable resolution, using backup incumbent settings object stack"); + done(); }; diff --git a/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/promise-job-incumbent-incumbent.html b/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/promise-job-incumbent-incumbent.html index 6b2550d3ee0396..00e16cb99678ab 100644 --- a/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/promise-job-incumbent-incumbent.html +++ b/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/promise-job-incumbent-incumbent.html @@ -11,4 +11,16 @@ window.runWindowPostMessageVeryIndirectly = (...args) => { return current.contentWindow.postMessage.call(relevant.contentWindow, ...args); }; + + // This tests the backup incumbent settings object stack scenario, by avoiding putting user code on the stack. + window.runWindowPostMessageVeryIndirectlyWithNoUserCode = (promise, promiseMethod, ...args) => { + const runWindowPostMessage = current.contentWindow.postMessage.bind(relevant.contentWindow, ...args); + promise[promiseMethod](runWindowPostMessage); + }; + + window.resolveThenableThatRunsWindowPostMessageVeryIndirectlyWithNoUserCode = (...args) => { + Promise.resolve({ + then: current.contentWindow.postMessage.bind(relevant.contentWindow, ...args) + }); + }; From 5e9b5b8354a29646d9c601671b076b23531ccf3d Mon Sep 17 00:00:00 2001 From: Domenic Denicola Date: Tue, 11 Feb 2020 16:26:29 -0500 Subject: [PATCH 6/8] Address typos --- .../promise-job-incumbent.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-incumbent.html b/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-incumbent.html index 75146206128612..af00f834c12524 100644 --- a/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-incumbent.html +++ b/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-incumbent.html @@ -27,13 +27,13 @@ const thisTestId = testId; relevantWindow.addEventListener("messagereceived", t.step_func(e => { - const [recievedTestId, recievedSourceURL] = e.detail; + const [receivedTestId, receivedSourceURL] = e.detail; - if (recievedTestId !== thisTestId) { + if (receivedTestId !== thisTestId) { return; } - assert_equals(recievedSourceURL, expectedURL); + assert_equals(receivedSourceURL, expectedURL); t.done(); })); @@ -78,7 +78,7 @@ frames[0].runWindowPostMessageVeryIndirectlyWithNoUserCode(p, "catch", thisTestId, "*"); }, "Rejection handler on rejected promise, using backup incumbent settings object stack"); - // The following test that we derive the incumbent settings object at promise-job time from + // The following tests test that we derive the incumbent settings object at promise-job time from // the incumbent realm at the time the handler was added, not at the time the resolve()/reject() // was done. See https://github.com/whatwg/html/issues/5213 for the spec side of this issue. From 99dce3be322facd78cc4fa1efa29fe3c55c13306 Mon Sep 17 00:00:00 2001 From: Domenic Denicola Date: Tue, 11 Feb 2020 16:52:03 -0500 Subject: [PATCH 7/8] Add meta charsets Firefox is kinda whiny without them --- .../resources/current/current.html | 1 + .../resources/current/resources/window-to-open.html | 1 + .../resources/promise-job-entry-incumbent.html | 1 + .../resources/promise-job-incumbent-incumbent.html | 1 + .../resources/promise-job-incumbent-resolver.html | 1 + .../resources/relevant/relevant.html | 1 + .../resources/relevant/resources/window-to-open.html | 1 + .../resources/resources/window-to-open.html | 1 + .../resources/window-to-open.html | 1 + 9 files changed, 9 insertions(+) diff --git a/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/current/current.html b/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/current/current.html index 3986b19a292cbe..63d9c437fc5683 100644 --- a/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/current/current.html +++ b/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/current/current.html @@ -1,3 +1,4 @@ + Current page used as a test helper diff --git a/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/current/resources/window-to-open.html b/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/current/resources/window-to-open.html index 3500e647ad7a05..1bc4cca9a3920f 100644 --- a/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/current/resources/window-to-open.html +++ b/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/current/resources/window-to-open.html @@ -1,2 +1,3 @@ + If the current settings object is used this page will be opened diff --git a/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/promise-job-entry-incumbent.html b/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/promise-job-entry-incumbent.html index 18d4f6a68cfd59..3740c1467d8724 100644 --- a/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/promise-job-entry-incumbent.html +++ b/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/promise-job-entry-incumbent.html @@ -1,4 +1,5 @@ + Incumbent page used as a test helper diff --git a/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/promise-job-incumbent-incumbent.html b/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/promise-job-incumbent-incumbent.html index 00e16cb99678ab..57dd5dff108ecf 100644 --- a/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/promise-job-incumbent-incumbent.html +++ b/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/promise-job-incumbent-incumbent.html @@ -1,4 +1,5 @@ + Incumbent page used as a test helper diff --git a/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/promise-job-incumbent-resolver.html b/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/promise-job-incumbent-resolver.html index fc8a82255d1eca..a730b9c3cedf5b 100644 --- a/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/promise-job-incumbent-resolver.html +++ b/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/promise-job-incumbent-resolver.html @@ -1,4 +1,5 @@ + Incumbent page used as a test helper + + + + + + + + + + diff --git a/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-entry.html b/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-entry.html index 596f1bc50253a9..6d075d674c7a0b 100644 --- a/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-entry.html +++ b/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-entry.html @@ -16,9 +16,11 @@ const relativeURL = "resources/window-to-open.html"; const expectedURL = (new URL(relativeURL, location.href)).href; +const incumbentWindow = frames[0]; + window.onload = () => { async_test(t => { - const w = frames[0].runWindowOpenVeryIndirectly(relativeURL); + const w = incumbentWindow.runWindowOpenVeryIndirectly(relativeURL); w.onload = t.step_func_done(() => { t.add_cleanup(() => w.close()); assert_equals(w.location.href, expectedURL); @@ -28,7 +30,7 @@ async_test(t => { // No t.step_func because that could change the realms Promise.resolve().then(() => { - const w = frames[0].runWindowOpenVeryIndirectly(relativeURL); + const w = incumbentWindow.runWindowOpenVeryIndirectly(relativeURL); w.onload = t.step_func_done(() => { t.add_cleanup(() => w.close()); assert_equals(w.location.href, expectedURL); @@ -39,7 +41,7 @@ async_test(t => { // No t.step_func because that could change the realms Promise.reject().catch(() => { - const w = frames[0].runWindowOpenVeryIndirectly(relativeURL); + const w = incumbentWindow.runWindowOpenVeryIndirectly(relativeURL); w.onload = t.step_func_done(() => { t.add_cleanup(() => w.close()); assert_equals(w.location.href, expectedURL); @@ -53,7 +55,7 @@ // No t.step_func because that could change the realms p.then(() => { - const w = frames[0].runWindowOpenVeryIndirectly(relativeURL); + const w = incumbentWindow.runWindowOpenVeryIndirectly(relativeURL); w.onload = t.step_func_done(() => { t.add_cleanup(() => w.close()); assert_equals(w.location.href, expectedURL); @@ -69,7 +71,7 @@ // No t.step_func because that could change the realms p.catch(() => { - const w = frames[0].runWindowOpenVeryIndirectly(relativeURL); + const w = incumbentWindow.runWindowOpenVeryIndirectly(relativeURL); w.onload = t.step_func_done(() => { t.add_cleanup(() => w.close()); assert_equals(w.location.href, expectedURL); @@ -83,7 +85,7 @@ const thenable = { // No t.step_func because that could change the realms then(f) { - const w = frames[0].runWindowOpenVeryIndirectly(relativeURL); + const w = incumbentWindow.runWindowOpenVeryIndirectly(relativeURL); w.onload = t.step_func_done(() => { t.add_cleanup(() => w.close()); assert_equals(w.location.href, expectedURL); diff --git a/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/function/function.html b/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/function/function.html new file mode 100644 index 00000000000000..15841d387da75b --- /dev/null +++ b/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/function/function.html @@ -0,0 +1,3 @@ + + +Realm for a "then" function used as a test helper diff --git a/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/function/resources/window-to-open.html b/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/function/resources/window-to-open.html new file mode 100644 index 00000000000000..3928c1f8aa9e96 --- /dev/null +++ b/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/function/resources/window-to-open.html @@ -0,0 +1,3 @@ + + +If the function's settings object is used this page will be opened