From 724adfa80ff4e42cc8e2881a39c7aec825c53ee2 Mon Sep 17 00:00:00 2001 From: Guy Bedford Date: Fri, 15 Jan 2021 13:46:04 -0500 Subject: [PATCH 1/4] note interaction with import assertions --- proposals/esm-integration/README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/proposals/esm-integration/README.md b/proposals/esm-integration/README.md index afff4aef..be9a8ab5 100644 --- a/proposals/esm-integration/README.md +++ b/proposals/esm-integration/README.md @@ -122,6 +122,12 @@ Some impacts of reading the imports up-front: See the FAQ for more explanation of the rationale for this design decision, and what features it enables which would be difficult or impossible otherwise. +### Import Assertions + +When integrating with import assertions, it is important to note that `assert { type: 'wasm' }` will not be supported, because there is no privilege escalation between ESM imports or Wasm imports. + +Instead, the ESM integration may take advantage of [evaluator attributes](https://github.com/tc39/proposal-import-assertions#follow-up-proposal-evaluator-attributes) in future in order to potentially permit features instance constructors or private Wasm imports. + ## FAQ ### How would this work, in some concrete examples? From 2b996b6948e2e542853bd5ebe9a5344116b05327 Mon Sep 17 00:00:00 2001 From: Guy Bedford Date: Fri, 15 Jan 2021 13:47:57 -0500 Subject: [PATCH 2/4] include import assertions link --- proposals/esm-integration/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proposals/esm-integration/README.md b/proposals/esm-integration/README.md index be9a8ab5..733e5c12 100644 --- a/proposals/esm-integration/README.md +++ b/proposals/esm-integration/README.md @@ -124,7 +124,7 @@ See the FAQ for more explanation of the rationale for this design decision, and ### Import Assertions -When integrating with import assertions, it is important to note that `assert { type: 'wasm' }` will not be supported, because there is no privilege escalation between ESM imports or Wasm imports. +When integrating with the [Import Assertions proposal](https://github.com/tc39/proposal-import-assertions), it is important to note that `assert { type: 'wasm' }` will not be supported, because there is no privilege escalation between ESM imports or Wasm imports. Instead, the ESM integration may take advantage of [evaluator attributes](https://github.com/tc39/proposal-import-assertions#follow-up-proposal-evaluator-attributes) in future in order to potentially permit features instance constructors or private Wasm imports. From 7eb8b02085c302ba042dbe5941ea3f8c909ac1cf Mon Sep 17 00:00:00 2001 From: Guy Bedford Date: Fri, 15 Jan 2021 13:55:58 -0500 Subject: [PATCH 3/4] wording --- proposals/esm-integration/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proposals/esm-integration/README.md b/proposals/esm-integration/README.md index 733e5c12..a0f540e5 100644 --- a/proposals/esm-integration/README.md +++ b/proposals/esm-integration/README.md @@ -126,7 +126,7 @@ See the FAQ for more explanation of the rationale for this design decision, and When integrating with the [Import Assertions proposal](https://github.com/tc39/proposal-import-assertions), it is important to note that `assert { type: 'wasm' }` will not be supported, because there is no privilege escalation between ESM imports or Wasm imports. -Instead, the ESM integration may take advantage of [evaluator attributes](https://github.com/tc39/proposal-import-assertions#follow-up-proposal-evaluator-attributes) in future in order to potentially permit features instance constructors or private Wasm imports. +Instead, the ESM integration may take advantage of [evaluator attributes](https://github.com/tc39/proposal-import-assertions#follow-up-proposal-evaluator-attributes) in future in order to potentially permit features such as instance constructors or private Wasm imports. ## FAQ From ae2ad8e340c6de6a73c61d399be57a3395e38536 Mon Sep 17 00:00:00 2001 From: Guy Bedford Date: Fri, 19 Nov 2021 14:42:24 -0800 Subject: [PATCH 4/4] move to linking, clarify current status --- proposals/esm-integration/README.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/proposals/esm-integration/README.md b/proposals/esm-integration/README.md index a0f540e5..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. @@ -122,12 +130,6 @@ Some impacts of reading the imports up-front: See the FAQ for more explanation of the rationale for this design decision, and what features it enables which would be difficult or impossible otherwise. -### Import Assertions - -When integrating with the [Import Assertions proposal](https://github.com/tc39/proposal-import-assertions), it is important to note that `assert { type: 'wasm' }` will not be supported, because there is no privilege escalation between ESM imports or Wasm imports. - -Instead, the ESM integration may take advantage of [evaluator attributes](https://github.com/tc39/proposal-import-assertions#follow-up-proposal-evaluator-attributes) in future in order to potentially permit features such as instance constructors or private Wasm imports. - ## FAQ ### How would this work, in some concrete examples?