Files
sousa-gecko/testing/web-platform/tests/fetch/compression-dictionary/dictionary-fetch-with-link-element-crossorigin.tentative.https.html
Frédéric Wang Nélar 34154a5852 Bug 2055740 [wpt PR 61352] - [compression-dictionary] Align crossorigin handling with the spec PR., a=testonly
Automatic update from web-platform-tests
[compression-dictionary] Align crossorigin handling with the spec PR.

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 <pmeenan@chromium.org>
Commit-Queue: Frédéric Wang Nélar <fwang@igalia.com>
Cr-Commit-Position: refs/heads/main@{#1663435}

--

wpt-commits: babeec89975126bd1a6d29b75f6285dc23ae64fd
wpt-pr: 61352
2026-07-22 04:28:53 +00:00

75 lines
2.7 KiB
HTML

<!DOCTYPE html>
<title>compression-dictionary</title>
<meta name="timeout" content="long"/>
<link rel="help" href="http://github.com/whatwg/html/pull/11620">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/service-workers/service-worker/resources/test-helpers.sub.js"></script>
<script src="./resources/compression-dictionary-util.sub.js"></script>
<script>
let frame;
// Set up the service worker and the frame.
promise_test(t => {
const kScope = 'resources/empty.https.html';
const kScript = 'resources/fetch-options-worker.js';
return service_worker_unregister_and_register(t, kScript, kScope)
.then(registration => {
add_completion_callback(() => {
registration.unregister();
});
return wait_for_state(t, registration.installing, 'activated');
})
.then(() => {
return with_iframe(kScope);
})
.then(f => {
frame = f;
add_completion_callback(() => { f.remove(); });
});
}, 'Initialize global state');
compression_dictionary_promise_test(async t => {
await new Promise((resolve, reject) => {
let node = frame.contentWindow.document.createElement("link");
node.rel = "compression-dictionary";
node.onload = resolve;
node.onerror = reject;
node.href = "dummy?mode=cors&credentials=same-origin";
frame.contentWindow.document.body.appendChild(node);
}).catch(() => {
assert_unreached("Fetch errored.");
});
}, 'HTMLLinkElement rel=compression-dictionary');
compression_dictionary_promise_test(async t => {
await new Promise((resolve, reject) => {
let node = frame.contentWindow.document.createElement("link");
node.rel = "compression-dictionary";
node.onload = resolve;
node.onerror = reject;
node.crossOrigin = "anonymous";
node.href = "dummy?mode=cors&credentials=same-origin";
frame.contentWindow.document.body.appendChild(node);
}).catch(() => {
assert_unreached("Fetch errored.");
});
}, 'HTMLLinkElement rel=compression-dictionary crossorigin=anonymous');
compression_dictionary_promise_test(async t => {
await new Promise((resolve, reject) => {
let node = frame.contentWindow.document.createElement("link");
node.rel = "compression-dictionary";
node.onload = resolve;
node.onerror = reject;
node.crossOrigin = "use-credentials";
node.href = "dummy?mode=cors&credentials=include";
frame.contentWindow.document.body.appendChild(node);
}).catch(() => {
assert_unreached("Fetch errored.");
});
}, 'HTMLLinkElement rel=compression-dictionary crossorigin=use-credentials');
</script>