summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/workers/same-site-cookies/third-party.default.tentative.sub.https.window.js
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/workers/same-site-cookies/third-party.default.tentative.sub.https.window.js')
-rw-r--r--testing/web-platform/tests/workers/same-site-cookies/third-party.default.tentative.sub.https.window.js38
1 files changed, 24 insertions, 14 deletions
diff --git a/testing/web-platform/tests/workers/same-site-cookies/third-party.default.tentative.sub.https.window.js b/testing/web-platform/tests/workers/same-site-cookies/third-party.default.tentative.sub.https.window.js
index 194df38390..bf499c1992 100644
--- a/testing/web-platform/tests/workers/same-site-cookies/third-party.default.tentative.sub.https.window.js
+++ b/testing/web-platform/tests/workers/same-site-cookies/third-party.default.tentative.sub.https.window.js
@@ -1,24 +1,34 @@
// META: script=/resources/testdriver.js
// META: script=/resources/testdriver-vendor.js
+// META: script=/workers/same-site-cookies/resources/util.js
'use strict';
// Here's the set-up for this test:
-// Step 1 (top-frame) Set up listener for "DidStart" message and open cross-site iframe.
-// Step 2 (sub-frame) Open iframe same-site to top-frame.
-// Step 3 (sub-sub-frame) Set up listener for message and start worker.
-// Step 4 (worker) Send "DidStart" message to iframe.
-// Step 5 (sub-sub-frame) Receive message and pass on to window.
-// Step 6 (top-frame) Receive "DidStart" message and cleanup.
+// Step 1 (window) Set cookies.
+// Step 2 (top-frame) Set up listener for cookie message and open cross-site iframe.
+// Step 3 (sub-frame) Open iframe same-site to top-frame.
+// Step 4 (sub-sub-frame) Set up listener for message and start worker.
+// Step 5 (redirect) Redirect to worker script.
+// Step 6 (worker) Send cookie message to iframe.
+// Step 7 (sub-sub-frame) Receive message and pass on to window.
+// Step 8 (top-frame) Receive cookie message and cleanup.
async_test(t => {
// Step 1
- window.addEventListener("message", t.step_func(e => {
- // Step 6
- assert_equals(e.data, "DidStart", "Worker should have started");
- t.done();
- }));
- let iframe = document.createElement("iframe");
- iframe.src = "https://{{hosts[alt][]}}:{{ports[https][0]}}/workers/same-site-cookies/resources/iframe.sub.html?type=default";
- document.body.appendChild(iframe);
+ const cookie_set_window = window.open("/workers/same-site-cookies/resources/set_cookies.py");
+ cookie_set_window.onload = t.step_func(_ => {
+ // Step 2
+ window.addEventListener("message", t.step_func(e => {
+ // Step 8
+ getCookieNames().then(t.step_func((cookies) => {
+ assert_equals(e.data + cookies, "ReadOnLoad:None,ReadOnFetch:None,SetOnRedirectLoad:None,SetOnLoad:None,SetOnRedirectFetch:None,SetOnFetch:None", "Worker should get/set SameSite=None cookies only");
+ cookie_set_window.close();
+ t.done();
+ }));
+ }));
+ let iframe = document.createElement("iframe");
+ iframe.src = "https://{{hosts[alt][]}}:{{ports[https][0]}}/workers/same-site-cookies/resources/iframe.sub.html?type=default";
+ document.body.appendChild(iframe);
+ });
}, "Check SharedWorker sameSiteCookies option default for third-party");