{{ message }}
BridgeJS: Always provide swift_js_closure_unregister intrinsic in generated bridge-js.js#599
Merged
krodak merged 1 commit intoFeb 6, 2026
Conversation
…erated bridge-js.js
kateinoigakukun
approved these changes
Feb 6, 2026
kateinoigakukun
left a comment
Member
There was a problem hiding this comment.
🙏
Sorry, something went wrong.
Hide details
View details
krodak
merged commit
60b9444
into
swiftwasm:main
Feb 6, 2026
11 checks passed
MaxDesiatov
reviewed
Feb 6, 2026
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
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.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.
Overview
PR #578 added
JSTypedClosureAPI which introduced a newswift_js_closure_unregisterBridgeJS intrinsic. The@_extern(wasm)declaration inBridgeJSIntrinsics.swiftis unconditional, so the WASM binary always imports this symbol from thebjsmodule. However, the generatedbridge-js.jsonly provides it when closure signatures are detected in the API surface.Issue
When a project uses BridgeJS but does not use any closure types, the generated
bridge-js.jsomitsswift_js_closure_unregister. Since the WASM binary unconditionally imports it, instantiation fails with:The
instantiate.jstemplate hasunexpectedBjsCallstubs for all intrinsics (includingswift_js_closure_unregister), but these stubs are only used whenHAS_BRIDGEis false. When BridgeJS IS active, the template imports frombridge-js.jsinstead — which may not include the intrinsic.Fix
swift_js_closure_unregisterinBridgeJSLink.swift, alongside other always-present intrinsics likeswift_js_throw,swift_js_retain,swift_js_release