Repository navigation
Fix SharedWorker partitioned reuse - #45741
Conversation
Signed-off-by: Taym Haddadi <[email protected]>
There was a problem hiding this comment.
I think the change itself is wrong, because shared workers should be shared per origin; regarding the passing test, I don't understand what is actually making it pass.
The test in question seems to pass a worker as the url, and expects a range error, so I'm guessing to make it pass we need to add some validation of the url that fails in such as case. This might be something to do at the bindings layer actually.
| } | ||
|
|
||
| impl SharedWorkerSite { | ||
| /// <https://html.spec.whatwg.org/multipage/#obtain-a-site> |
There was a problem hiding this comment.
do we not have something like that already? If not, I think it belongs somewhere as a function for other parts of script to use as well.
|
|
||
| impl SharedWorkerStorageKey { | ||
| /// <https://storage.spec.whatwg.org/#storage-key> | ||
| fn for_window(global: &GlobalScope, window: &Window) -> Self { |
| prefs: [dom_sharedworker_enabled: true] | ||
|
|
||
| [SharedWorker-constructor.html] | ||
| [Test recursive worker creation results in exception.] |
There was a problem hiding this comment.
So the tests wants an exception thrown, and I don't understand what in the current changes makes it pass.
| // A `SharedWorkerGlobalScope` object has associated constructor origin (an origin), constructor URL (a URL record), and credentials (a credentials mode), and extended lifetime (a boolean). | ||
| #[no_trace] | ||
| storage_key: ImmutableOrigin, | ||
| storage_key: SharedWorkerStorageKey, |
There was a problem hiding this comment.
So I think this is wrong, because a shared worker should be shared between different top-level sites, if those have the same origin, see https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker
The spec also uses https://storage.spec.whatwg.org/#obtain-a-storage-key-for-non-storage-purposes, which clearly is per origin.
@gterzian The change is correct, I just committed the wrong test metadata. It should be shared-worker-partitioned.tentative.html, not SharedWorker-constructor.html. I’m working on all remaining failing SharedWorker tests locally and committed the wrong one by mistake. The test checks that SharedWorkers are separated by top-level site. |
gterzian
left a comment
There was a problem hiding this comment.
Ok thanks for clarifying; since every browser is passing it we should do the same (even thought the spec hasn't been updated and still only partitions by origin).
yezhizhen
left a comment
There was a problem hiding this comment.
Seems shared-worker-partitioned.tentative.html still fail, or is it intermittent now?
SharedWorker is not defined, means SharedWorker is not enabled. |
Signed-off-by: Taym Haddadi <[email protected]>
1a5a4a3 to
a238070
Compare
|
🔨 Triggering try run (#27751831813) for Linux (WPT) |
|
Test results for linux-wpt from try job (#27751831813): Flaky unexpected result (21)
Stable unexpected results that are known to be intermittent (15)
|
|
✨ Try run (#27751831813) succeeded. |
SharedWorkers from different top-level sites should not share the same worker,
even when they use the same URL and name.
Testing: shared-worker-partitioned.tentative.html pass..
part of #7458