-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Allow pthread-based programs to be loaded cross-origin #25581
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
Conversation
bbd5887
to
205fbb3
Compare
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 can't say I 100% understand the limitation here, but if the feedback from all the folks on the bug is that this workaround works and that the test represents their use case, then LGTM. I wonder if it's also worth running this change through the internal testing script before landing it.
Actually I guess the internal tester might not test serving in a prod environment, but maybe still worth doing. |
maybe also worth getting a review from one of our CDN-affiliated friends, such as @RReverser ? |
It's a known limitation & workaround, but I suspect we might want to put it behind a separate flag, at least behind Blob URLs can be prohibited by CSP policies, and in fixing the cross-origin usecase we can break the much more common same-origin one if the origin happens to use stricter security policy that prohibits dynamically created JS / resources in general. |
d43946b
to
dd3e9cc
Compare
I mean I was able to repro the exactly failure.. so this change does provably solve a version of this issue for sure. And the folks on the bug talk about this workaround working for them. So I'm pretty confident this is a working fix. |
dd3e9cc
to
e37940f
Compare
Added a new setting. |
3616d98
to
6d39f04
Compare
6d39f04
to
7bb2093
Compare
For some reason creating new workers across origins is not allowed, even when `importScripts` is. Added a test case which was confirmed to fail without this PR. Fixes: emscripten-core#21937
7bb2093
to
0f5c761
Compare
This setting was recently added in emscripten-core#25581 and it only currently has en effect on pthread-based programs. It is also not compatible with `-sNO_DYNAMIC_EXECUTION` because it depends on starting worker based on JS string. These errors look like this: ``` $ emcc -sCROSS_ORIGIN -pthread -sDYNAMIC_EXECUTION=0 hello.c emcc: error: CROSS_ORIGIN is not compatible with DYNAMIC_EXECUTION=0 ```
This setting was recently added in #25581 and it only currently has en effect on pthread-based programs. It is also not compatible with `-sNO_DYNAMIC_EXECUTION` because it depends on starting worker based on JS string. These errors look like this: ``` $ emcc -sCROSS_ORIGIN -pthread -sDYNAMIC_EXECUTION=0 hello.c emcc: error: CROSS_ORIGIN is not compatible with DYNAMIC_EXECUTION=0 ```
For some reason creating new workers across origins is not allowed,
even when
importScripts
is.Added a test case which was confirmed to fail without this PR.
Fixes: #21937