Files
firefox/testing/web-platform/tests/shared-storage/add-module.tentative.https.sub.html
Camillia Smith Barnes 7b21265e02 Bug 1909902 [wpt PR 47290] - Shared Storage: Allow x-origin module script in addModule, a=testonly
Automatic update from web-platform-tests
Shared Storage: Allow x-origin module script in addModule

The same-origin restriction for module script loaded by
`sharedStorage.worklet.addModule()` is no longer needed, so we remove
it. See https://github.com/WICG/shared-storage/pull/158 and
https://groups.google.com/a/chromium.org/g/blink-dev/c/YZ4XGewKVuk.

Only cross-origin scripts loaded with createWorklet() that use the
script origin as their data origin will need the
"Shared-Storage-Cross-Origin-Worklet-Allowed: ?1" response header,
however. To differentiate between worklets that need to be
checked for this header and ones that don't, we add a new
"Sec-Shared-Storage-Data-Origin" request header with the data origin
used to the requests where the data origin is cross-origin to the
context origin. We then use this information to determine if the
"Shared-Storage-Cross-Origin-Worklet-Allowed" response header is needed.

Bug: 348660660
Change-Id: I55f7f5d6d282b679505be5f23901f26ff7d7d374
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5648386
Commit-Queue: Cammie Smith Barnes <[email protected]>
Reviewed-by: Andrey Kosyakov <[email protected]>
Reviewed-by: Brendon Tiszka <[email protected]>
Reviewed-by: Tsuyoshi Horo <[email protected]>
Reviewed-by: Yao Xiao <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1332965}

--

wpt-commits: c1ba090fe97109f63812fe90a4b612d602f6a87f
wpt-pr: 47290
2024-07-30 06:57:15 +00:00

21 lines
462 B
HTML

<!doctype html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<body>
<script>
'use strict';
promise_test(async t => {
return promise_rejects_dom(t, "DataError",
sharedStorage.worklet.addModule("https://"));
}, 'addModule with invalid url');
promise_test(() => {
return sharedStorage.worklet.addModule(
"/shared-storage/resources/simple-module.js");
}, 'addModule');
</script>
</body>