From 8f1cec74cadcc71dacf593c57cd11efcaad78942 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Wang=20N=C3=A9lar?= Date: Thu, 16 Jul 2026 13:17:20 -0700 Subject: [PATCH] [compression-dictionary] Align crossorigin handling with the spec PR. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Per https://github.com/whatwg/html/pull/11620, if crossorigin is "No Cors" we should default to Anonymous. Currently, Chromium departs from the spec and always forces request's mode to "cors" and request's credentials to "omit". This CL aligns Chromium's behavior on the spec PR under a runtime flag and adds corresponding WPT test. Bug: 522338661, 40255884 Change-Id: I30835aebc9df79b59e74747b0729efbc6df69457 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/8098207 Reviewed-by: Patrick Meenan Commit-Queue: Frédéric Wang Nélar Cr-Commit-Position: refs/heads/main@{#1663435} --- ...k-element-crossorigin.tentative.https.html | 74 +++++++++++++++++++ fetch/compression-dictionary/resources/dummy | 0 .../resources/empty.https.html | 1 + .../resources/fetch-options-worker.js | 13 ++++ 4 files changed, 88 insertions(+) create mode 100644 fetch/compression-dictionary/dictionary-fetch-with-link-element-crossorigin.tentative.https.html create mode 100644 fetch/compression-dictionary/resources/dummy create mode 100644 fetch/compression-dictionary/resources/empty.https.html create mode 100644 fetch/compression-dictionary/resources/fetch-options-worker.js diff --git a/fetch/compression-dictionary/dictionary-fetch-with-link-element-crossorigin.tentative.https.html b/fetch/compression-dictionary/dictionary-fetch-with-link-element-crossorigin.tentative.https.html new file mode 100644 index 00000000000000..fcc321840bace4 --- /dev/null +++ b/fetch/compression-dictionary/dictionary-fetch-with-link-element-crossorigin.tentative.https.html @@ -0,0 +1,74 @@ + +compression-dictionary + + + + + + + diff --git a/fetch/compression-dictionary/resources/dummy b/fetch/compression-dictionary/resources/dummy new file mode 100644 index 00000000000000..e69de29bb2d1d6 diff --git a/fetch/compression-dictionary/resources/empty.https.html b/fetch/compression-dictionary/resources/empty.https.html new file mode 100644 index 00000000000000..0e76edd65b7baf --- /dev/null +++ b/fetch/compression-dictionary/resources/empty.https.html @@ -0,0 +1 @@ + diff --git a/fetch/compression-dictionary/resources/fetch-options-worker.js b/fetch/compression-dictionary/resources/fetch-options-worker.js new file mode 100644 index 00000000000000..01ee48f982615c --- /dev/null +++ b/fetch/compression-dictionary/resources/fetch-options-worker.js @@ -0,0 +1,13 @@ +self.addEventListener('fetch', function(event) { + if (event.request.url.includes('dummy')) { + const params = new URL(event.request.url).searchParams; + const credentials = params.get("credentials"); + const mode = params.get("mode"); + if ((!mode || mode == event.request.mode) && + (!credentials || credentials == event.request.credentials)) { + event.respondWith(fetch(event.request)); + } else { + event.respondWith(Response.error()); + } + } +});