Skip to content

[wasm] proper startup sequence in dotnet.worker.js #70891

@pavelsavara

Description

@pavelsavara
  • pass configuration from main thread
  • run relevant parts of startup sequence
  • 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

https://github.com/emscripten-core/emscripten/blob/6577be0d782368893b8d0c2dbaac3908fc425ef6/src/settings.js#L615-L640


Original issue

  • 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.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions