From a07d25f92a3402c5d4b27014b353bff565873ddb Mon Sep 17 00:00:00 2001 From: arthursonzogni Date: Fri, 7 May 2021 17:01:02 +0000 Subject: [PATCH] [Credentialless]: WPT vs CacheStorage. Add tentative WPT tests about COEP and CacheStorage. Issues: - COEP:require-corp: https://github.com/w3c/ServiceWorker/issues/1490 - COEP:credentialless: https://github.com/w3c/ServiceWorker/issues/1592 Bug: 1175099 Change-Id: I857adbd134443b17b9689c314307bb1e3888235b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2876191 Commit-Queue: Arthur Sonzogni Reviewed-by: Antonio Sartori Reviewed-by: Camille Lamy Cr-Commit-Position: refs/heads/master@{#880447} --- ...cache-storage.tentative.https-expected.txt | 51 +++++++++++ .../cache-storage.tentative.https.html | 86 +++++++++++++++++++ .../credentialless/resources/common.js | 38 +++++++- ...cache-storage.tentative.https-expected.txt | 51 +++++++++++ 4 files changed, 225 insertions(+), 1 deletion(-) create mode 100644 third_party/blink/web_tests/external/wpt/html/cross-origin-embedder-policy/credentialless/cache-storage.tentative.https-expected.txt create mode 100644 third_party/blink/web_tests/external/wpt/html/cross-origin-embedder-policy/credentialless/cache-storage.tentative.https.html create mode 100644 third_party/blink/web_tests/virtual/plz-dedicated-worker/external/wpt/html/cross-origin-embedder-policy/credentialless/cache-storage.tentative.https-expected.txt diff --git a/third_party/blink/web_tests/external/wpt/html/cross-origin-embedder-policy/credentialless/cache-storage.tentative.https-expected.txt b/third_party/blink/web_tests/external/wpt/html/cross-origin-embedder-policy/credentialless/cache-storage.tentative.https-expected.txt new file mode 100644 index 00000000000000..2be4b1efe8314d --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/html/cross-origin-embedder-policy/credentialless/cache-storage.tentative.https-expected.txt @@ -0,0 +1,51 @@ +This is a testharness.js-based test. +PASS [document] unsafe-none => unsafe-none +FAIL [document] unsafe-none => credentialless assert_equals: expected "error" but got "retrieved" +PASS [document] unsafe-none => credentialless + CORP +PASS [document] unsafe-none => require-corp +PASS [document] unsafe-none => require-corp + CORP +PASS [document] credentialless => unsafe-none +PASS [document] credentialless => credentialless +PASS [document] credentialless => require-corp +PASS [document] credentialless => require-corp + CORP +PASS [document] require_corp => unsafe-none +PASS [document] require_corp => credentialless +PASS [document] require_corp => require-corp +PASS [dedicated_worker] unsafe-none => unsafe-none +FAIL [dedicated_worker] unsafe-none => credentialless assert_equals: expected "error" but got "retrieved" +PASS [dedicated_worker] unsafe-none => credentialless + CORP +FAIL [dedicated_worker] unsafe-none => require-corp assert_equals: expected "error" but got "retrieved" +PASS [dedicated_worker] unsafe-none => require-corp + CORP +PASS [dedicated_worker] credentialless => unsafe-none +PASS [dedicated_worker] credentialless => credentialless +FAIL [dedicated_worker] credentialless => require-corp assert_equals: expected "error" but got "retrieved" +PASS [dedicated_worker] credentialless => require-corp + CORP +PASS [dedicated_worker] require_corp => unsafe-none +PASS [dedicated_worker] require_corp => credentialless +PASS [dedicated_worker] require_corp => require-corp +PASS [shared_worker] unsafe-none => unsafe-none +FAIL [shared_worker] unsafe-none => credentialless assert_equals: expected "error" but got "retrieved" +PASS [shared_worker] unsafe-none => credentialless + CORP +FAIL [shared_worker] unsafe-none => require-corp assert_equals: expected "error" but got "retrieved" +PASS [shared_worker] unsafe-none => require-corp + CORP +PASS [shared_worker] credentialless => unsafe-none +PASS [shared_worker] credentialless => credentialless +FAIL [shared_worker] credentialless => require-corp assert_equals: expected "error" but got "retrieved" +PASS [shared_worker] credentialless => require-corp + CORP +PASS [shared_worker] require_corp => unsafe-none +PASS [shared_worker] require_corp => credentialless +PASS [shared_worker] require_corp => require-corp +PASS [service_worker] unsafe-none => unsafe-none +FAIL [service_worker] unsafe-none => credentialless assert_equals: expected "error" but got "retrieved" +PASS [service_worker] unsafe-none => credentialless + CORP +PASS [service_worker] unsafe-none => require-corp +PASS [service_worker] unsafe-none => require-corp + CORP +PASS [service_worker] credentialless => unsafe-none +PASS [service_worker] credentialless => credentialless +PASS [service_worker] credentialless => require-corp +PASS [service_worker] credentialless => require-corp + CORP +PASS [service_worker] require_corp => unsafe-none +PASS [service_worker] require_corp => credentialless +PASS [service_worker] require_corp => require-corp +Harness: the test ran to completion. + diff --git a/third_party/blink/web_tests/external/wpt/html/cross-origin-embedder-policy/credentialless/cache-storage.tentative.https.html b/third_party/blink/web_tests/external/wpt/html/cross-origin-embedder-policy/credentialless/cache-storage.tentative.https.html new file mode 100644 index 00000000000000..00b3696bd4ab9d --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/html/cross-origin-embedder-policy/credentialless/cache-storage.tentative.https.html @@ -0,0 +1,86 @@ + + + + + + + + diff --git a/third_party/blink/web_tests/external/wpt/html/cross-origin-embedder-policy/credentialless/resources/common.js b/third_party/blink/web_tests/external/wpt/html/cross-origin-embedder-policy/credentialless/resources/common.js index f203a82b01e0a6..0e7816d339010b 100644 --- a/third_party/blink/web_tests/external/wpt/html/cross-origin-embedder-policy/credentialless/resources/common.js +++ b/third_party/blink/web_tests/external/wpt/html/cross-origin-embedder-policy/credentialless/resources/common.js @@ -70,7 +70,7 @@ const newCredentiallessWindow = (origin) => { const main_document_token = token(); const url = origin + executor_path + coep_credentialless + `&uuid=${main_document_token}`; - const w = window.open(url); + const context = window.open(url); add_completion_callback(() => w.close()); return main_document_token; }; @@ -89,3 +89,39 @@ const newCredentiallessIframe = (parent_token, child_origin) => { return sub_document_token; }; +const environments = { + document: headers => { + const tok = token(); + const url = window.origin + executor_path + headers + `&uuid=${tok}`; + const context = window.open(url); + add_completion_callback(() => context.close()); + return tok; + }, + + dedicated_worker: headers => { + const tok = token(); + const url = window.origin + executor_js_path + headers + `&uuid=${tok}`; + const context = new Worker(url); + return tok; + }, + + shared_worker: headers => { + const tok = token(); + const url = window.origin + executor_js_path + headers + `&uuid=${tok}`; + const context = new SharedWorker(url); + return tok; + }, + + service_worker: headers => { + const tok = token(); + const url = window.origin + executor_js_path + headers + `&uuid=${tok}`; + const scope = url; // Generate a one-time scope for service worker. + navigator.serviceWorker.register(url, {scope: scope}) + .then(registration => { + add_completion_callback(() => registration.unregister()); + }); + return tok; + }, +}; + + diff --git a/third_party/blink/web_tests/virtual/plz-dedicated-worker/external/wpt/html/cross-origin-embedder-policy/credentialless/cache-storage.tentative.https-expected.txt b/third_party/blink/web_tests/virtual/plz-dedicated-worker/external/wpt/html/cross-origin-embedder-policy/credentialless/cache-storage.tentative.https-expected.txt new file mode 100644 index 00000000000000..7c00cef8a91f35 --- /dev/null +++ b/third_party/blink/web_tests/virtual/plz-dedicated-worker/external/wpt/html/cross-origin-embedder-policy/credentialless/cache-storage.tentative.https-expected.txt @@ -0,0 +1,51 @@ +This is a testharness.js-based test. +PASS [document] unsafe-none => unsafe-none +FAIL [document] unsafe-none => credentialless assert_equals: expected "error" but got "retrieved" +PASS [document] unsafe-none => credentialless + CORP +PASS [document] unsafe-none => require-corp +PASS [document] unsafe-none => require-corp + CORP +PASS [document] credentialless => unsafe-none +PASS [document] credentialless => credentialless +PASS [document] credentialless => require-corp +PASS [document] credentialless => require-corp + CORP +PASS [document] require_corp => unsafe-none +PASS [document] require_corp => credentialless +PASS [document] require_corp => require-corp +PASS [dedicated_worker] unsafe-none => unsafe-none +FAIL [dedicated_worker] unsafe-none => credentialless assert_equals: expected "error" but got "retrieved" +PASS [dedicated_worker] unsafe-none => credentialless + CORP +PASS [dedicated_worker] unsafe-none => require-corp +PASS [dedicated_worker] unsafe-none => require-corp + CORP +PASS [dedicated_worker] credentialless => unsafe-none +PASS [dedicated_worker] credentialless => credentialless +PASS [dedicated_worker] credentialless => require-corp +PASS [dedicated_worker] credentialless => require-corp + CORP +PASS [dedicated_worker] require_corp => unsafe-none +PASS [dedicated_worker] require_corp => credentialless +PASS [dedicated_worker] require_corp => require-corp +PASS [shared_worker] unsafe-none => unsafe-none +FAIL [shared_worker] unsafe-none => credentialless assert_equals: expected "error" but got "retrieved" +PASS [shared_worker] unsafe-none => credentialless + CORP +FAIL [shared_worker] unsafe-none => require-corp assert_equals: expected "error" but got "retrieved" +PASS [shared_worker] unsafe-none => require-corp + CORP +PASS [shared_worker] credentialless => unsafe-none +PASS [shared_worker] credentialless => credentialless +FAIL [shared_worker] credentialless => require-corp assert_equals: expected "error" but got "retrieved" +PASS [shared_worker] credentialless => require-corp + CORP +PASS [shared_worker] require_corp => unsafe-none +PASS [shared_worker] require_corp => credentialless +PASS [shared_worker] require_corp => require-corp +PASS [service_worker] unsafe-none => unsafe-none +FAIL [service_worker] unsafe-none => credentialless assert_equals: expected "error" but got "retrieved" +PASS [service_worker] unsafe-none => credentialless + CORP +PASS [service_worker] unsafe-none => require-corp +PASS [service_worker] unsafe-none => require-corp + CORP +PASS [service_worker] credentialless => unsafe-none +PASS [service_worker] credentialless => credentialless +PASS [service_worker] credentialless => require-corp +PASS [service_worker] credentialless => require-corp + CORP +PASS [service_worker] require_corp => unsafe-none +PASS [service_worker] require_corp => credentialless +PASS [service_worker] require_corp => require-corp +Harness: the test ran to completion. +