src: add a flag to keep the embedder's wasm streaming callback - #65690
Open
codebytere wants to merge 1 commit into
Open
src: add a flag to keep the embedder's wasm streaming callback#65690codebytere wants to merge 1 commit into
codebytere wants to merge 1 commit into
Conversation
`SetIsolateMiscHandlers()` always installs Node.js's `WebAssembly.compileStreaming()` implementation, which is backed by the Environment's fetch-based handler. An embedder that provides its own streaming callback (for example one wired to its own network stack) has to re-install it after every `SetIsolateUpForNode()` or `NewIsolate()` call. Add `SHOULD_NOT_SET_WASM_STREAMING_CALLBACK` next to the existing `SHOULD_NOT_SET_PROMISE_REJECTION_CALLBACK` and `SHOULD_NOT_SET_PREPARE_STACK_TRACE_CALLBACK` flags so it can opt out the same way. Refs: nodejs#36447 Signed-off-by: Shelley Vohr <shelley.vohr@gmail.com>
Collaborator
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #65690 +/- ##
==========================================
- Coverage 90.07% 90.04% -0.03%
==========================================
Files 754 754
Lines 256395 256397 +2
Branches 48499 48494 -5
==========================================
- Hits 230937 230883 -54
- Misses 16569 16630 +61
+ Partials 8889 8884 -5
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SetIsolateMiscHandlers()always installs Node.js'sWebAssembly.compileStreaming()handler, which goes through the Environment's fetch-based implementation. An embedder that supplies its own streaming callback has to put it back after everyNewIsolate()/SetIsolateUpForNode()call.This adds
SHOULD_NOT_SET_WASM_STREAMING_CALLBACKtoIsolateSettingsFlags, followingSHOULD_NOT_SET_PROMISE_REJECTION_CALLBACKandSHOULD_NOT_SET_PREPARE_STACK_TRACE_CALLBACK(#36447), so the embedder's callback is left alone when the flag is set. Default behavior is unchanged.Tests: new cctest
EnvironmentTest.KeepsEmbedderWasmStreamingCallbackWhenAskedinstalls a callback, callsSetIsolateUpForNode()with and without the flag, and checks which oneWebAssembly.compileStreaming()reaches; it fails onmainand passes here.Refs: #36447
Disclosure: the code, test and this description were written by Claude Code, directed and reviewed by @codebytere.