Files
firefox/testing/web-platform/tests/shared-storage/same-origin-add-module-credentials-include.tentative.https.sub.html
Yao Xiao fb121d73fd Bug 1879195 [wpt PR 44451] - [shared storage] Introduce WorkletOptions param, a=testonly
Automatic update from web-platform-tests
[shared storage] Introduce WorkletOptions param

Introduce WorkletOptions param for both addModule() and
createWorklet(). For the resource request, use the provided
credentials and use the SiteForCookies derived from the RFHI. This
aligns with the worklet standard [1], and aligns with the
implementation for other workers (e.g. for dedicated workers [2]).

Note that the new param for addModule() isn't gated by
kSharedStorageAPIM123. This is intentional: we have been deviating
from the worklet standard, so we consider this change as a bugfix.

[1] https://html.spec.whatwg.org/multipage/worklets.html#dom-worklet-addmodule
[2] https://source.chromium.org/chromium/chromium/src/+/main:content/browser/worker_host/dedicated_worker_host.cc?q=WorkerScriptFetcher::CreateAndStart

Bug: 1218540
Change-Id: I82bb7f7509e904f1d9e2ff26c9c8eb1b90ad5828
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5273828
Reviewed-by: Avi Drissman <[email protected]>
Reviewed-by: Dominic Farolino <[email protected]>
Reviewed-by: Cammie Smith Barnes <[email protected]>
Commit-Queue: Yao Xiao <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1259477}

--

wpt-commits: f02fb3cd6328b73b3a7839fa6da9230ca1de82fe
wpt-pr: 44451
2024-02-15 09:43:08 +00:00

31 lines
958 B
HTML

<!doctype html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/utils.js"></script>
<script src="/shared-storage/resources/util.js"></script>
<script src="/fenced-frame/resources/utils.js"></script>
<body>
<script>
'use strict';
promise_test(async () => {
const ancestor_key = token();
document.cookie = "key0=value0";
const helper_url = `/shared-storage/resources/credentials-test-helper.py`;
await sharedStorage.worklet.addModule(
helper_url + `?action=store-cookie&token=${ancestor_key}`,
{ credentials: "include" });
const request_cookie_fetch_response =
await fetch(helper_url + `?action=get-cookie&token=${ancestor_key}`);
const request_cookie_text = await request_cookie_fetch_response.text();
assert_equals(request_cookie_text, "key0=value0");
}, 'addModule() with same-origin module script and credentials "include"');
</script>
</body>