LibJS: Align spec comments for ShadowRealm for HostInitializeShadowRealm

The proposed changes have been merged into the proposal with:

https://github.com/tc39/proposal-shadowrealm/commit/f20d02
This commit is contained in:
Shannon Booth 2024-11-17 05:55:20 +13:00 committed by Andreas Kling
parent e8c228fb93
commit fd0c63b338
Notes: github-actions[bot] 2024-11-17 21:16:13 +00:00
2 changed files with 7 additions and 8 deletions

View file

@ -40,7 +40,6 @@ ThrowCompletionOr<Value> ShadowRealmConstructor::call()
} }
// 3.2.1 ShadowRealm ( ), https://tc39.es/proposal-shadowrealm/#sec-shadowrealm // 3.2.1 ShadowRealm ( ), https://tc39.es/proposal-shadowrealm/#sec-shadowrealm
// https://github.com/tc39/proposal-shadowrealm/pull/410
ThrowCompletionOr<GC::Ref<Object>> ShadowRealmConstructor::construct(FunctionObject& new_target) ThrowCompletionOr<GC::Ref<Object>> ShadowRealmConstructor::construct(FunctionObject& new_target)
{ {
auto& vm = this->vm(); auto& vm = this->vm();
@ -62,7 +61,7 @@ ThrowCompletionOr<GC::Ref<Object>> ShadowRealmConstructor::construct(FunctionObj
// 8. Set O.[[ShadowRealm]] to realmRec. // 8. Set O.[[ShadowRealm]] to realmRec.
object->set_shadow_realm(realm_record); object->set_shadow_realm(realm_record);
// 9. Perform ? HostInitializeShadowRealm(realmRec). // 9. Perform ? HostInitializeShadowRealm(realmRec, innerContext, O).
TRY(vm.host_initialize_shadow_realm(realm_record, move(inner_context), object)); TRY(vm.host_initialize_shadow_realm(realm_record, move(inner_context), object));
// 10. Return O. // 10. Return O.

View file

@ -169,13 +169,13 @@ VM::VM(OwnPtr<CustomData> custom_data, ErrorMessages error_messages)
return HandledByHost::Handled; return HandledByHost::Handled;
}; };
// 3.6.1 HostInitializeShadowRealm ( realm ), https://tc39.es/proposal-shadowrealm/#sec-hostinitializeshadowrealm // 3.6.1 HostInitializeShadowRealm ( realm, context, O ), https://tc39.es/proposal-shadowrealm/#sec-hostinitializeshadowrealm
// https://github.com/tc39/proposal-shadowrealm/pull/410
host_initialize_shadow_realm = [](Realm&, NonnullOwnPtr<ExecutionContext>, ShadowRealm&) -> ThrowCompletionOr<void> { host_initialize_shadow_realm = [](Realm&, NonnullOwnPtr<ExecutionContext>, ShadowRealm&) -> ThrowCompletionOr<void> {
// The host-defined abstract operation HostInitializeShadowRealm takes argument realm (a Realm Record) and returns // The host-defined abstract operation HostInitializeShadowRealm takes arguments realm (a Realm Record),
// either a normal completion containing unused or a throw completion. It is used to inform the host of any newly // context (an execution context), and O (a ShadowRealm object) and returns either a normal completion
// created realms from the ShadowRealm constructor. The idea of this hook is to initialize host data structures // containing unused or a throw completion. It is used to inform the host of any newly created realms
// related to the ShadowRealm, e.g., for module loading. // from the ShadowRealm constructor. The idea of this hook is to initialize host data structures related
// to the ShadowRealm, e.g., for module loading.
// //
// The host may use this hook to add properties to the ShadowRealm's global object. Those properties must be configurable. // The host may use this hook to add properties to the ShadowRealm's global object. Those properties must be configurable.
return {}; return {};