From dadf3cb84034f78c22cdb98410281fdf5f2332f5 Mon Sep 17 00:00:00 2001 From: Guy Bedford Date: Thu, 2 Dec 2021 11:11:57 +0200 Subject: [PATCH] Note interaction with import assertions (#45) --- proposals/esm-integration/README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/proposals/esm-integration/README.md b/proposals/esm-integration/README.md index afff4aef..1679327c 100644 --- a/proposals/esm-integration/README.md +++ b/proposals/esm-integration/README.md @@ -105,6 +105,14 @@ The ECMAScript specification holds the module's export in a lexical scope, as po At the end of the link phase, the variables in the module's lexical scope are generally uninitialized. From JavaScript, accessing an uninitialized import causes a ReferenceError. JavaScript function declarations are initialized during the Link phase, as part of function hoisting, but WebAssembly function exports are not initialized until the Evaluation phase. +#### Import Assertions + +[Import assertions](https://github.com/tc39/proposal-import-assertions) specify linking invariants that should be verified before evaluation can proceed. Currently HTML specifies a `"type"` assertion which is a requirement for CSS or JSON module imports due to their having different security privileges over full execution. + +When importing WebAssembly from JavaScript, no assertion should be required since they share the same security privilege level in the ESM integration and in order to ensure transparent interoperability of the formats. + +Future Wasm extensions may include supporting these assertions for imports from WebAssembly modules. + ### Evaluate During evaluation, the code is evaluated to assign values to the exported bindings. In JS, this means running the top-level module code.