Skip to content

[js-api] Handle thenable Module in instantiate(bytes)#2118

Open
backes wants to merge 1 commit intoWebAssembly:mainfrom
backes:fix-thenables
Open

[js-api] Handle thenable Module in instantiate(bytes)#2118
backes wants to merge 1 commit intoWebAssembly:mainfrom
backes:fix-thenables

Conversation

@backes
Copy link
Member

@backes backes commented Mar 17, 2026

Add an explicit check in "instantiate a promise of a module" to ensure the fulfilled value of the compilation promise implements the Module interface. This prevents a modified WebAssembly.Module.prototype.then from subverting the instantiation process with a non-Module value.

Also add regression tests in test/js-api/constructor/instantiate.any.js.

Fixes #2034

Add an explicit check in "instantiate a promise of a module" to ensure
the fulfilled value of the compilation promise implements the Module
interface. This prevents a modified WebAssembly.Module.prototype.then
from subverting the instantiation process with a non-Module value.

Also add regression tests in test/js-api/constructor/instantiate.any.js.

Fixes WebAssembly#2034
@backes backes requested a review from Ms2ger March 17, 2026 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[js-api] Ambiguity in WebAssembly.instantiate(bytes) if WebAssembly.Module is a thenable

1 participant