diff --git a/third_party/blink/web_tests/external/wpt/service-workers/service-worker/resources/form-poster.html b/third_party/blink/web_tests/external/wpt/service-workers/service-worker/resources/form-poster.html index 6c5e85fef2fcad..cd11a30a5e85fe 100644 --- a/third_party/blink/web_tests/external/wpt/service-workers/service-worker/resources/form-poster.html +++ b/third_party/blink/web_tests/external/wpt/service-workers/service-worker/resources/form-poster.html @@ -1,4 +1,5 @@ +
diff --git a/third_party/blink/web_tests/external/wpt/service-workers/service-worker/resources/same-site-cookies-register.html b/third_party/blink/web_tests/external/wpt/service-workers/service-worker/resources/same-site-cookies-register.html index 084f0a08a8e64c..3060fc16a28ad9 100644 --- a/third_party/blink/web_tests/external/wpt/service-workers/service-worker/resources/same-site-cookies-register.html +++ b/third_party/blink/web_tests/external/wpt/service-workers/service-worker/resources/same-site-cookies-register.html @@ -5,18 +5,27 @@ const scope = self.origin + '/cookies/resources/postToParent.py?with-sw'; const script = './fetch-rewrite-worker.js'; const reg = await navigator.serviceWorker.register(script, { scope: scope }); - await new Promise(resolve => { - const worker = reg.installing; - worker.addEventListener('statechange', evt => { - if (worker.state === 'activated') { - resolve(); - } + // In nested cases we may be impacted by partitioning or not depending on + // the browser. With partitioning we will be installing a new worker here, + // but without partitioning the worker will already exist. Handle both cases. + if (reg.installing) { + await new Promise(resolve => { + const worker = reg.installing; + worker.addEventListener('statechange', evt => { + if (worker.state === 'activated') { + resolve(); + } + }); }); - }); - if (reg.navigationPreload) { - await reg.navigationPreload.enable(); + if (reg.navigationPreload) { + await reg.navigationPreload.enable(); + } + } + if (window.opener) { + window.opener.postMessage({ type: 'SW-REGISTERED' }, '*'); + } else { + window.top.postMessage({ type: 'SW-REGISTERED' }, '*'); } - window.opener.postMessage({ type: 'SW-REGISTERED' }, '*'); } self.addEventListener('load', onLoad); diff --git a/third_party/blink/web_tests/external/wpt/service-workers/service-worker/resources/same-site-cookies-unregister.html b/third_party/blink/web_tests/external/wpt/service-workers/service-worker/resources/same-site-cookies-unregister.html index cca3620b61e73c..3a8c04d8d345a5 100644 --- a/third_party/blink/web_tests/external/wpt/service-workers/service-worker/resources/same-site-cookies-unregister.html +++ b/third_party/blink/web_tests/external/wpt/service-workers/service-worker/resources/same-site-cookies-unregister.html @@ -4,8 +4,14 @@ async function onLoad() { const scope = self.origin + '/cookies/resources/postToParent.py?with-sw'; const reg = await navigator.serviceWorker.getRegistration(scope); - await reg.unregister(); - window.opener.postMessage({ type: 'SW-UNREGISTERED' }, '*'); + if (reg) { + await reg.unregister(); + } + if (window.opener) { + window.opener.postMessage({ type: 'SW-UNREGISTERED' }, '*'); + } else { + window.top.postMessage({ type: 'SW-UNREGISTERED' }, '*'); + } } self.addEventListener('load', onLoad); diff --git a/third_party/blink/web_tests/external/wpt/service-workers/service-worker/resources/window-opener.html b/third_party/blink/web_tests/external/wpt/service-workers/service-worker/resources/window-opener.html new file mode 100644 index 00000000000000..32d07446467986 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/service-workers/service-worker/resources/window-opener.html @@ -0,0 +1,17 @@ + + + + diff --git a/third_party/blink/web_tests/external/wpt/service-workers/service-worker/same-site-cookies.https-expected.txt b/third_party/blink/web_tests/external/wpt/service-workers/service-worker/same-site-cookies.https-expected.txt index c908d43fdeb823..3dd2cd7dbde935 100644 --- a/third_party/blink/web_tests/external/wpt/service-workers/service-worker/same-site-cookies.https-expected.txt +++ b/third_party/blink/web_tests/external/wpt/service-workers/service-worker/same-site-cookies.https-expected.txt @@ -1,5 +1,5 @@ This is a testharness.js-based test. -Found 56 tests; 47 PASS, 9 FAIL, 0 TIMEOUT, 0 NOTRUN. +Found 66 tests; 55 PASS, 11 FAIL, 0 TIMEOUT, 0 NOTRUN. PASS Setup service workers PASS same-origin, window.open with no service worker PASS same-origin, window.open with fallback @@ -31,6 +31,16 @@ PASS same-origin, window.open with fallback, cross-site redirect, and same-origi PASS same-origin, window.open with passthrough, cross-site redirect, and same-origin redirect PASS same-origin, window.open with change-request, cross-site redirect, and same-origin redirect PASS same-origin, window.open with navpreload, cross-site redirect, and same-origin redirect +PASS same-origin, nested window.open with cross-site middle frame and no service worker +PASS same-origin, nested window.open with cross-site middle frame and fallback service worker +PASS same-origin, nested window.open with cross-site middle frame and passthrough service worker +PASS same-origin, nested window.open with cross-site middle frame and change-request service worker +PASS same-origin, nested window.open with cross-site middle frame and navpreload service worker +PASS same-origin, nested set location with cross-site middle frame and no service worker +PASS same-origin, nested set location with cross-site middle frame and fallback service worker +FAIL same-origin, nested set location with cross-site middle frame and passthrough service worker assert_not_equals: SameSite=Strict cookies are not sent with cross-site requests. got disallowed value "COOKIE_VALUE" +FAIL same-origin, nested set location with cross-site middle frame and change-request service worker assert_not_equals: SameSite=Strict cookies are not sent with cross-site requests. got disallowed value "COOKIE_VALUE" +PASS same-origin, nested set location with cross-site middle frame and navpreload service worker PASS same-origin, form post with no service worker PASS same-origin, form post with fallback PASS same-origin, form post with passthrough diff --git a/third_party/blink/web_tests/external/wpt/service-workers/service-worker/same-site-cookies.https.html b/third_party/blink/web_tests/external/wpt/service-workers/service-worker/same-site-cookies.https.html index caeadcfcae9d98..6075dc83ec7027 100644 --- a/third_party/blink/web_tests/external/wpt/service-workers/service-worker/same-site-cookies.https.html +++ b/third_party/blink/web_tests/external/wpt/service-workers/service-worker/same-site-cookies.https.html @@ -10,9 +10,21 @@