You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[wasm] proper startup sequence in dotnet.worker.js #70891
make worker long lived that that we could schedule mono jobs in worker and use promises
We compile dotnet.worker.js with -s EXPORT_ES6, so it used import(uri).then(callback) dynamic imports to bring in scripts.
There is still a polyfill for Node in the worker JS file that uses require and eval. It could be compiled out if we change the threaded build to not set node as an environment when we build for threading, see
the dotnet.worker.js has require in it, which makes it not ES6 ready
the dotnet.worker.js has eval in it which makes it CSP issue
We could implement some post-link build step, which would append and prepend code to the emscripten's code in dotnet.worker.js4
Or we could just have our own version, which we would have to keep in sync with upstream.
Just want to add now that the #70746 ES6 PR is merged that dotnet.worker.js is able to load the ES6 dotnet.js module, the node code at the beginning that uses require is skipped.
So the things left to address are to make sure we initialize Module with all the values that our code receives when we load dotnet.js on the main browser thread.
Activity
lambdageek commentedon Jun 23, 2022
Couple of things:
If you compile with
-s EXPORT_ES6, theworker.jsis built differently. it does thishttps://github.com/emscripten-core/emscripten/blob/25591f37aa77c415af9c54bc74d073f4653d22d7/src/worker.js#L154-L160
We might still need our own version of worker.js since we may need to customize
Modulebefore it's passed tocreateDotnetRuntime, as we noted here [wasm-mt] Add MessageChannel between browser thread and new pthreads #70908 (comment)lambdageek commentedon Jun 23, 2022
worker.js seems to only add
requireifENVIRONMENT_MAY_BE_NODEis true, which seems like it is set herehttps://github.com/emscripten-core/emscripten/blob/2391bfcacbd0396a1cda21843cf3c6a216e6a142/emcc.py#L294
so we could omit
nodefrom-s ENVIRONMENTS=...when we build with threadinglambdageek commentedon Jun 24, 2022
Just want to add now that the #70746 ES6 PR is merged that
dotnet.worker.jsis able to load the ES6dotnet.jsmodule, the node code at the beginning that usesrequireis skipped.So the things left to address are to make sure we initialize
Modulewith all the values that our code receives when we loaddotnet.json the main browser thread.[-][wasm] fix dotnet.worker.js[/-][+][wasm] fix `require` in dotnet.worker.js[/+]pavelsavara commentedon Aug 10, 2022
@lambdageek I moved this to 8, please let me know if you think we need it in net7
[-][wasm] fix `require` in dotnet.worker.js[/-][+][wasm] proper startup sequence in `dotnet.worker.js`[/+]