-
Notifications
You must be signed in to change notification settings - Fork 5.3k
[wasm] JS interop without JS code gen - CSP friendly #74441
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
|
Tagging subscribers to 'arch-wasm': @lewing Issue DetailsImplements interpreted JS interop instead of generating JS code and Fixes #68374 TODO
|
|
/azp run runtime-wasm |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
Did you evaluate the alternative of pre-generating all the JS at build time and shipping a dictionary of it? The interpreter performance is a mild concern for me. |
I want to measure the difference of this approach first, to see if it's worth it.
We could also do it on link-time, when wasm-tools are installed on dev machine. But this is the simplest thing to try. |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
|
For context: Blazor in Net7 is using legacy interop, which is not CSP safe. It's too late/risky to do anything about it now. We have following options: For the new interop in Net8 For new interop in Net7, we could back-port this PR or not. For legacy interop, we could eventually implement the same trick. But I would rather not invest into it and get rid of it soon. We will get rid of it from Blazor codebase in Net8 I hope. |
|
Chrome on Windows, Release+AOT
|
|
/azp run runtime-wasm |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run runtime-wasm |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run runtime-wasm |
|
Azure Pipelines successfully started running 1 pipeline(s). |
...nteropServices.JavaScript/src/System/Runtime/InteropServices/JavaScript/JSFunctionBinding.cs
Show resolved
Hide resolved
...vices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/JavaScriptTestHelper.cs
Show resolved
Hide resolved
|
Please do a basic test in a couple browsers (Chrome + Safari or Chrome + Firefox would be fine) running interop invokes in a loop with this new implementation to make sure it doesn't end up causing frequent GCs, since we know that the type info for the bound functions will now be bad (vs before where each generated wrapper was statically typed). As long as it doesn't produce a bunch of allocations, I'm OK with removing the codegen since you did some perf benchmarks and the numbers looked OK |



Implements interpreted new JS interop
instead of generating JS code and
new Functionwhich is not CSP compliantFixes #68374
(this doesn't fix eval in legacy interop, which is used in Blazor in Net7)