1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 01:07:35 +00:00

LibJS+LibWeb: Another round of bringing module loading closer to spec

In particular, this patch focuses on:
- Updating the old "import assertions" to the new "import attributes"
- Allowing realms as module import referrer
This commit is contained in:
Andreas Kling 2023-12-02 16:20:01 +01:00
parent 82977ab44b
commit 07f567cd9f
14 changed files with 244 additions and 178 deletions

View file

@ -233,8 +233,9 @@ ThrowCompletionOr<Value> shadow_realm_import_value(VM& vm, DeprecatedString spec
// 5. Push evalContext onto the execution context stack; evalContext is now the running execution context.
TRY(vm.push_execution_context(eval_context, {}));
// 6. Perform HostImportModuleDynamically(null, specifierString, innerCapability).
MUST_OR_THROW_OOM(vm.host_import_module_dynamically(Empty {}, ModuleRequest { move(specifier_string) }, inner_capability));
// 6. Let referrer be the Realm component of evalContext.
// 7. Perform HostImportModuleDynamically(referrer, specifierString, innerCapability).
MUST_OR_THROW_OOM(vm.host_import_module_dynamically(NonnullGCPtr { *eval_context.realm }, ModuleRequest { move(specifier_string) }, inner_capability));
// 7. Suspend evalContext and remove it from the execution context stack.
// NOTE: We don't support this concept yet.