Files
sousa-gecko/testing/web-platform/tests/FileAPI/BlobURL/opaque-origin.html
T
Yoshisto Yanagisawa fa80b9b192 Bug 2031883 [wpt PR 59148] - Disable ALLOW_OPAQUE_ORIGIN_STORAGE_KEY_MISMATCH when flag is on, a=testonly
Automatic update from web-platform-tests
Disable ALLOW_OPAQUE_ORIGIN_STORAGE_KEY_MISMATCH when flag is on

When the kDataUrlWorkerOpaqueOrigin feature is enabled, data: URL
workers use a correct opaque origin for their StorageKey. This
eliminates the mismatch between the Blob URL's opaque origin and the
StorageKey's origin, which means the Blob URL system no longer needs
the ALLOW_OPAQUE_ORIGIN_STORAGE_KEY_MISMATCH workaround.

This CL conditionally passes DEFAULT instead of the workaround to
the Blob URL registry when the feature is enabled. This proves the
workaround is no longer needed and allows it to be removed entirely
once the feature is enabled by default, without modifying the
underlying Blob URL validation logic unconditionally at this stage.

Bug: 40051700
Change-Id: Ie4d2187ad42051aed587da67b01ba7439ba0ba1a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7734490
Auto-Submit: Yoshisato Yanagisawa <yyanagisawa@chromium.org>
Commit-Queue: Andrew Williams <awillia@chromium.org>
Reviewed-by: Andrew Williams <awillia@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1612600}

--

wpt-commits: 455c23b461611ddeb2896cf93a82cdbbc050e94b
wpt-pr: 59148
2026-04-23 10:11:55 +00:00

48 lines
1.5 KiB
HTML

<!doctype html>
<html>
<head>
<meta charset=utf-8>
<title>Opaque origin blob URL created from workers</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
</head>
<body>
<script>
promise_test(t => {
return new Promise((resolve) => {
const worker_code = `
const blob = new Blob([''], {type: 'text/javascript'});
const url = URL.createObjectURL(blob);
self.postMessage(url);
`;
const worker = new Worker("data:text/javascript," + encodeURIComponent(worker_code));
worker.onmessage = t.step_func(e => {
assert_regexp_match(e.data, /^blob:null\//, "Blob URL should have 'null' as serialized origin");
resolve();
});
});
}, "Blob URL created from data URL dedicated worker should have 'null' origin");
promise_test(t => {
return new Promise((resolve) => {
const worker_code = `
self.onconnect = e => {
const blob = new Blob([''], {type: 'text/javascript'});
const url = URL.createObjectURL(blob);
e.ports[0].postMessage(url);
};
`;
const worker = new SharedWorker("data:text/javascript," + encodeURIComponent(worker_code));
worker.port.onmessage = t.step_func(e => {
assert_regexp_match(e.data, /^blob:null\//, "Blob URL should have 'null' as serialized origin");
resolve();
});
worker.port.start();
});
}, "Blob URL created from data URL shared worker should have 'null' origin");
</script>
</body>
</html>