浏览代码

LibWeb: Implement current_principal_global_object to shadow realm spec

No functional change, as it is using the yet to be fully implemented
'current_principal_realm'.
Shannon Booth 9 月之前
父节点
当前提交
738e603c2f
共有 1 个文件被更改,包括 3 次插入5 次删除
  1. 3 5
      Userland/Libraries/LibWeb/HTML/Scripting/Environments.cpp

+ 3 - 5
Userland/Libraries/LibWeb/HTML/Scripting/Environments.cpp

@@ -319,13 +319,11 @@ EnvironmentSettingsObject& current_principal_settings_object()
 }
 }
 
 
 // https://html.spec.whatwg.org/multipage/webappapis.html#current-global-object
 // https://html.spec.whatwg.org/multipage/webappapis.html#current-global-object
+// https://whatpr.org/html/9893/webappapis.html#current-principal-global-object
 JS::Object& current_principal_global_object()
 JS::Object& current_principal_global_object()
 {
 {
-    auto& event_loop = HTML::main_thread_event_loop();
-    auto& vm = event_loop.vm();
-
-    // Similarly, the current global object is the global object of the current Realm Record.
-    return vm.current_realm()->global_object();
+    // Similarly, the current principal global object is the global object of the current principal realm.
+    return current_principal_realm().global_object();
 }
 }
 
 
 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-relevant-realm
 // https://html.spec.whatwg.org/multipage/webappapis.html#concept-relevant-realm