-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Explainer: Allow cross-origin script in addModule & align createWorklet #158
Conversation
…orklet` Currently, `addModule` only allows same-origin script. This was for convenience of the initial implementation, however, and is no longer necessary. The [worklet standard](https://html.spec.whatwg.org/multipage/worklets.html#dom-worklet-addmodule) does not contain this restriction. In fact, we have received [feedback](#127) from developers stating they would like to be able to host and run their worklet script on a separate origin---say a CDN---from the origin that owns and writes their shared storage data. So we update the explainer to remove the same-origin restriction for `addModule`. We also note that, when the worklet script is cross-origin to the invoking context, the invoking context's origin is used as the partition origin for accessing shared storage. Since `createWorklet` already allows cross-origin scripts, but currently uses the worklet script's origin as the data partition origin, updating `addModule` as described above without also making a change to `createWorklet` is liable to cause developer confusion in the long term. We have therefore decided to align `createWorklet`'s default data partition origin with `addModule`'s. `createWorklet` will use the invoking context's origin by default. This is a breaking change, but current usage of `createWorklet` is low as it was just introduced in M125. To preserve the ability to create a worklet whose script is cross-origin to the invoking context and then run operations on the worklet script origin's shared storage data, we introduce a new `dataOrigin` option for `createWorklet`. Passing `dataOrigin` with "script-origin" as its value will designate the worklet script origin as the partition origin for shared storage. For now, "script-origin" and "context-origin" will be the only allowed values for `dataOrigin`, when used. We’re considering adding support for separate data and script origins for `createWorklet` in the future. A corresponding specification update will follow.
README.md
Outdated
@@ -455,6 +459,41 @@ register('select-url', URLOperation); | |||
register('report', ReportOperation); | |||
``` | |||
|
|||
### Using cross-origin worklets |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This section is a bit confusing, as it's using cross-origin to mean different things. Use cases 1 and 2 are about cross-origin worklet script. Use case 3 is about a cross-origin data origin.
Can you instead make 2 sections, one titled "Loading cross-origin worklet scripts" and another, "Creating worklets with cross-origin data origins" or some such?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed the section title to "Loading cross-origin worklet scripts" and slightly revised the content.
I think that it would make more sense to wait to add a separate "Creating worklets with cross-origin data origins" section until we decide to allow other values for the dataOrigin
option (if we do).
Anyway, please take a look and see if the revised section looks good. If you would still like it in 2 sections, I can split it then. Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| I think that it would make more sense to wait to add a separate "Creating worklets with cross-origin data origins" section until we decide to allow other values for the dataOrigin option (if we do).
Using script-origin
is a cross-origin data origin from the calling context.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So does the revised section look good for the current proposal? Or are there any changes that we should make in this PR?
If a publisher allows some partner to use SharedStorage via the policy-controlled feature, is there a way to restrict the partner's data access? |
Will the new |
The publisher/embedder can control which origins have access to Shared Storage via the Permissions Policy, yes. The origins allowed to use the policy-controlled feature "shared-storage" are those that will have permission to be used as data origins for the Shared Storage API.
You will be able to detect it if you call
We haven't implemented this yet, and the exact error message/type haven't been determined yet. So the above snippet is subject to change (and I didn't test it), but something along these lines should work. |
We proposed a breaking change to sharedStorage.createWorklet() in WICG/shared-storage#158. We add a use counter for how frequently createWorklet is called in a non-forward-compatible way according to the proposal (i.e. with a cross-origin script but without the option dataOrigin: "script- origin"). This will help us determine what the impact of this change would be. Bug: 348445878 Change-Id: I3b882a9ec859beb5265ba31d3169fb5e1239cac4
We proposed a breaking change to sharedStorage.createWorklet() in WICG/shared-storage#158. We add a use counter for how frequently createWorklet is called in a non-forward-compatible way according to the proposal (i.e. with a cross-origin script but without the option dataOrigin: "script- origin"). This will help us determine what the impact of this change would be. Bug: 348445878 Change-Id: I3b882a9ec859beb5265ba31d3169fb5e1239cac4 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5645568 Reviewed-by: Yao Xiao <[email protected]> Commit-Queue: Cammie Smith Barnes <[email protected]> Cr-Commit-Position: refs/heads/main@{#1318000}
We proposed a breaking change to sharedStorage.createWorklet() in WICG/shared-storage#158. We add a use counter for how frequently createWorklet is called in a non-forward-compatible way according to the proposal (i.e. with a cross-origin script but without the option dataOrigin: "script- origin"). This will help us determine what the impact of this change would be. Bug: 348445878 Change-Id: I3b882a9ec859beb5265ba31d3169fb5e1239cac4 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5645568 Reviewed-by: Yao Xiao <[email protected]> Commit-Queue: Cammie Smith Barnes <[email protected]> Cr-Commit-Position: refs/heads/main@{#1318000}
We proposed a breaking change to sharedStorage.createWorklet() in WICG/shared-storage#158. We add a use counter for how frequently createWorklet is called in a non-forward-compatible way according to the proposal (i.e. with a cross-origin script but without the option dataOrigin: "script- origin"). This will help us determine what the impact of this change would be. Bug: 348445878 Change-Id: I3b882a9ec859beb5265ba31d3169fb5e1239cac4 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5645568 Reviewed-by: Yao Xiao <[email protected]> Commit-Queue: Cammie Smith Barnes <[email protected]> Cr-Commit-Position: refs/heads/main@{#1318000}
…to createWorklet for use counter, a=testonly Automatic update from web-platform-tests Shared Storage: Add non-live dataOption to createWorklet for use counter We proposed a breaking change to sharedStorage.createWorklet() in WICG/shared-storage#158. We add a use counter for how frequently createWorklet is called in a non-forward-compatible way according to the proposal (i.e. with a cross-origin script but without the option dataOrigin: "script- origin"). This will help us determine what the impact of this change would be. Bug: 348445878 Change-Id: I3b882a9ec859beb5265ba31d3169fb5e1239cac4 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5645568 Reviewed-by: Yao Xiao <[email protected]> Commit-Queue: Cammie Smith Barnes <[email protected]> Cr-Commit-Position: refs/heads/main@{#1318000} -- wpt-commits: 25b56c5748119452697daf6903523c3523fbb64a wpt-pr: 46853
…to createWorklet for use counter, a=testonly Automatic update from web-platform-tests Shared Storage: Add non-live dataOption to createWorklet for use counter We proposed a breaking change to sharedStorage.createWorklet() in WICG/shared-storage#158. We add a use counter for how frequently createWorklet is called in a non-forward-compatible way according to the proposal (i.e. with a cross-origin script but without the option dataOrigin: "script- origin"). This will help us determine what the impact of this change would be. Bug: 348445878 Change-Id: I3b882a9ec859beb5265ba31d3169fb5e1239cac4 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5645568 Reviewed-by: Yao Xiao <[email protected]> Commit-Queue: Cammie Smith Barnes <[email protected]> Cr-Commit-Position: refs/heads/main@{#1318000} -- wpt-commits: 25b56c5748119452697daf6903523c3523fbb64a wpt-pr: 46853
…to createWorklet for use counter, a=testonly Automatic update from web-platform-tests Shared Storage: Add non-live dataOption to createWorklet for use counter We proposed a breaking change to sharedStorage.createWorklet() in WICG/shared-storage#158. We add a use counter for how frequently createWorklet is called in a non-forward-compatible way according to the proposal (i.e. with a cross-origin script but without the option dataOrigin: "script- origin"). This will help us determine what the impact of this change would be. Bug: 348445878 Change-Id: I3b882a9ec859beb5265ba31d3169fb5e1239cac4 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5645568 Reviewed-by: Yao Xiao <[email protected]> Commit-Queue: Cammie Smith Barnes <[email protected]> Cr-Commit-Position: refs/heads/main@{#1318000} -- wpt-commits: 25b56c5748119452697daf6903523c3523fbb64a wpt-pr: 46853
…to createWorklet for use counter, a=testonly Automatic update from web-platform-tests Shared Storage: Add non-live dataOption to createWorklet for use counter We proposed a breaking change to sharedStorage.createWorklet() in WICG/shared-storage#158. We add a use counter for how frequently createWorklet is called in a non-forward-compatible way according to the proposal (i.e. with a cross-origin script but without the option dataOrigin: "script- origin"). This will help us determine what the impact of this change would be. Bug: 348445878 Change-Id: I3b882a9ec859beb5265ba31d3169fb5e1239cac4 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5645568 Reviewed-by: Yao Xiao <yaoxiachromium.org> Commit-Queue: Cammie Smith Barnes <cammiechromium.org> Cr-Commit-Position: refs/heads/main{#1318000} -- wpt-commits: 25b56c5748119452697daf6903523c3523fbb64a wpt-pr: 46853 UltraBlame original commit: 9d3e2f74487b035e80c69a330be89ef279bd2862
…to createWorklet for use counter, a=testonly Automatic update from web-platform-tests Shared Storage: Add non-live dataOption to createWorklet for use counter We proposed a breaking change to sharedStorage.createWorklet() in WICG/shared-storage#158. We add a use counter for how frequently createWorklet is called in a non-forward-compatible way according to the proposal (i.e. with a cross-origin script but without the option dataOrigin: "script- origin"). This will help us determine what the impact of this change would be. Bug: 348445878 Change-Id: I3b882a9ec859beb5265ba31d3169fb5e1239cac4 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5645568 Reviewed-by: Yao Xiao <yaoxiachromium.org> Commit-Queue: Cammie Smith Barnes <cammiechromium.org> Cr-Commit-Position: refs/heads/main{#1318000} -- wpt-commits: 25b56c5748119452697daf6903523c3523fbb64a wpt-pr: 46853 UltraBlame original commit: 9d3e2f74487b035e80c69a330be89ef279bd2862
…ss-origin script Why: We proposed a potentially breaking change to addModule() in WICG/shared-storage#158. That is, currently, a website can call addModule() everywhere and expect it to fail when they're not in their own context; however, with cross-origin script support, these calls could unexpectedly succeed. Thus, we track potentially non-forward-compatible addModule() usages to assess the potential impact and guide further decisions. We anticipate this usage to be low. Bug: 350764023 Change-Id: I5da4583ed583baa398bdb2cadf8955d341474050 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5665746 Reviewed-by: Josh Karlin <[email protected]> Commit-Queue: Yao Xiao <[email protected]> Reviewed-by: Sun Yueru <[email protected]> Cr-Commit-Position: refs/heads/main@{#1322541}
We proposed a breaking change to sharedStorage.createWorklet() in WICG/shared-storage#158. We add a use counter for how frequently createWorklet is called in a non-forward-compatible way according to the proposal (i.e. with a cross-origin script but without the option dataOrigin: "script- origin"). This will help us determine what the impact of this change would be. Bug: 348445878 Change-Id: I3b882a9ec859beb5265ba31d3169fb5e1239cac4 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5645568 Reviewed-by: Yao Xiao <[email protected]> Commit-Queue: Cammie Smith Barnes <[email protected]> Cr-Commit-Position: refs/heads/main@{#1318000}
The same-origin restriction for module script loaded by `sharedStorage.worklet.addModule()` is no longer needed, so we remove it. See WICG/shared-storage#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
The same-origin restriction for module script loaded by `sharedStorage.worklet.addModule()` is no longer needed, so we remove it. See WICG/shared-storage#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}
The same-origin restriction for module script loaded by `sharedStorage.worklet.addModule()` is no longer needed, so we remove it. See WICG/shared-storage#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}
We previously added `blink::features::kSharedStorageCrossOriginScript` to gate the Shared Storage API enhancements proposed in WICG/shared-storage#158 and https://groups.google.com/a/chromium.org/g/blink-dev/c/YZ4XGewKVuk. We have since decided, however, to gate the enhancements behind two separate features. We will use the previously added `blink::features::kSharedStorageCrossOriginScript` feature to enable or disable allowing cross-origin scrips in `addModule()`. This CL add a new feature `blink::features:: kSharedStorageCreateWorkletUseContextOriginByDefault` to gate the update to `createWorklet() to use its context origin as its data origin by default, and to hook up the `dataOrigin` option to allow manually selecting "script-origin" instead of "context-origin". Bug: 348660660 Change-Id: I95bf7d263c4e37f80ac04899fcd575c799c5fa38 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5739715 Reviewed-by: Kent Tamura <[email protected]> Commit-Queue: Cammie Smith Barnes <[email protected]> Cr-Commit-Position: refs/heads/main@{#1332972}
The same-origin restriction for module script loaded by `sharedStorage.worklet.addModule()` is no longer needed, so we remove it. See WICG/shared-storage#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}
We align the default data origin for createWorklet with that of addModule to be the invoking context's origin. We also hook up the dataOrigin option in createWorklet's options dictionary, so that the script origin can be manually specified to be used as the data origin instead. See WICG/shared-storage#158, WICG/shared-storage#161, and https://groups.google.com/a/chromium.org/g/blink-dev/c/YZ4XGewKVuk. Bug:353738488 Change-Id: I3578e48f14c9fb1005211b94889ce01ef209162c
We align the default data origin for createWorklet with that of addModule to be the invoking context's origin. We also hook up the dataOrigin option in createWorklet's options dictionary, so that the script origin can be manually specified to be used as the data origin instead. See WICG/shared-storage#158, WICG/shared-storage#161, and https://groups.google.com/a/chromium.org/g/blink-dev/c/YZ4XGewKVuk. Bug: 353738488 Change-Id: I3578e48f14c9fb1005211b94889ce01ef209162c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5716903 Reviewed-by: Yao Xiao <[email protected]> Commit-Queue: Cammie Smith Barnes <[email protected]> Cr-Commit-Position: refs/heads/main@{#1333189}
We align the default data origin for createWorklet with that of addModule to be the invoking context's origin. We also hook up the dataOrigin option in createWorklet's options dictionary, so that the script origin can be manually specified to be used as the data origin instead. See WICG/shared-storage#158, WICG/shared-storage#161, and https://groups.google.com/a/chromium.org/g/blink-dev/c/YZ4XGewKVuk. Bug: 353738488 Change-Id: I3578e48f14c9fb1005211b94889ce01ef209162c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5716903 Reviewed-by: Yao Xiao <[email protected]> Commit-Queue: Cammie Smith Barnes <[email protected]> Cr-Commit-Position: refs/heads/main@{#1333189}
…ript 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 WICG/shared-storage#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
…fault data origin w/addModule's, a=testonly Automatic update from web-platform-tests Shared Storage: Align createWorklet's default data origin w/addModule's We align the default data origin for createWorklet with that of addModule to be the invoking context's origin. We also hook up the dataOrigin option in createWorklet's options dictionary, so that the script origin can be manually specified to be used as the data origin instead. See WICG/shared-storage#158, WICG/shared-storage#161, and https://groups.google.com/a/chromium.org/g/blink-dev/c/YZ4XGewKVuk. Bug: 353738488 Change-Id: I3578e48f14c9fb1005211b94889ce01ef209162c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5716903 Reviewed-by: Yao Xiao <[email protected]> Commit-Queue: Cammie Smith Barnes <[email protected]> Cr-Commit-Position: refs/heads/main@{#1333189} -- wpt-commits: 71b107815a391a469b081cbb9242e1723ede50fb wpt-pr: 47296
…ript 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 WICG/shared-storage#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
…fault data origin w/addModule's, a=testonly Automatic update from web-platform-tests Shared Storage: Align createWorklet's default data origin w/addModule's We align the default data origin for createWorklet with that of addModule to be the invoking context's origin. We also hook up the dataOrigin option in createWorklet's options dictionary, so that the script origin can be manually specified to be used as the data origin instead. See WICG/shared-storage#158, WICG/shared-storage#161, and https://groups.google.com/a/chromium.org/g/blink-dev/c/YZ4XGewKVuk. Bug: 353738488 Change-Id: I3578e48f14c9fb1005211b94889ce01ef209162c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5716903 Reviewed-by: Yao Xiao <[email protected]> Commit-Queue: Cammie Smith Barnes <[email protected]> Cr-Commit-Position: refs/heads/main@{#1333189} -- wpt-commits: 71b107815a391a469b081cbb9242e1723ede50fb wpt-pr: 47296
…ript 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 WICG/shared-storage#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
…fault data origin w/addModule's, a=testonly Automatic update from web-platform-tests Shared Storage: Align createWorklet's default data origin w/addModule's We align the default data origin for createWorklet with that of addModule to be the invoking context's origin. We also hook up the dataOrigin option in createWorklet's options dictionary, so that the script origin can be manually specified to be used as the data origin instead. See WICG/shared-storage#158, WICG/shared-storage#161, and https://groups.google.com/a/chromium.org/g/blink-dev/c/YZ4XGewKVuk. Bug: 353738488 Change-Id: I3578e48f14c9fb1005211b94889ce01ef209162c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5716903 Reviewed-by: Yao Xiao <[email protected]> Commit-Queue: Cammie Smith Barnes <[email protected]> Cr-Commit-Position: refs/heads/main@{#1333189} -- wpt-commits: 71b107815a391a469b081cbb9242e1723ede50fb wpt-pr: 47296
Currently,
addModule
only allows same-origin script. This was for convenience of the initial implementation, however, and is no longer necessary.The worklet standard does not contain this restriction. In fact, we have received feedback from developers stating they would like to be able to host and run their worklet script on a separate origin---say a CDN---from the origin that owns and writes their shared storage data.
So we update the explainer to remove the same-origin restriction for
addModule
. We also note that, when the worklet script is cross-origin to the invoking context, the invoking context's origin is used as the partition origin for accessing shared storage.Since
createWorklet
already allows cross-origin scripts, but currently uses the worklet script's origin as the data partition origin, updatingaddModule
as described above without also making a change tocreateWorklet
is liable to cause developer confusion in the long term.We have therefore decided to align
createWorklet
's default data partition origin withaddModule
's.createWorklet
will use the invoking context's origin by default. This is a breaking change, but current usage ofcreateWorklet
is low as it was just introduced in M125.To preserve the ability to create a worklet whose script is cross-origin to the invoking context and then run operations on the worklet script origin's shared storage data, we introduce a new
dataOrigin
option forcreateWorklet
. PassingdataOrigin
with "script-origin" as its value will designate the worklet script origin as the partition origin for shared storage. For now, "script-origin" and "context-origin" will be the only allowed values fordataOrigin
, when used. We’re considering adding support for separate data and script origins forcreateWorklet
in the future.A corresponding specification update will follow.