浏览代码

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
Shannon Booth 7 月之前
父节点
当前提交
fd0c63b338
共有 2 个文件被更改,包括 7 次插入8 次删除
  1. 1 2
      Libraries/LibJS/Runtime/ShadowRealmConstructor.cpp
  2. 6 6
      Libraries/LibJS/Runtime/VM.cpp

+ 1 - 2
Libraries/LibJS/Runtime/ShadowRealmConstructor.cpp

@@ -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.

+ 6 - 6
Libraries/LibJS/Runtime/VM.cpp

@@ -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
-    // https://github.com/tc39/proposal-shadowrealm/pull/410
+    // 3.6.1 HostInitializeShadowRealm ( realm, context, O ), https://tc39.es/proposal-shadowrealm/#sec-hostinitializeshadowrealm
     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
-        // either a normal completion containing unused or a throw completion. It is used to inform the host of any newly
-        // created realms 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-defined abstract operation HostInitializeShadowRealm takes arguments realm (a Realm Record),
+        // context (an execution context), and O (a ShadowRealm object) and returns either a normal completion
+        // containing unused or a throw completion. It is used to inform the host of any newly created realms
+        // 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 {};