diff --git a/Userland/Libraries/LibJS/Runtime/Realm.cpp b/Userland/Libraries/LibJS/Runtime/Realm.cpp index 10d48b4d8d..1ea3cafae3 100644 --- a/Userland/Libraries/LibJS/Runtime/Realm.cpp +++ b/Userland/Libraries/LibJS/Runtime/Realm.cpp @@ -32,7 +32,7 @@ Realm* Realm::create(VM& vm) } // 9.6 InitializeHostDefinedRealm ( ), https://tc39.es/ecma262/#sec-initializehostdefinedrealm -ThrowCompletionOr> Realm::initialize_host_defined_realm(VM& vm, Function create_global_object, Function create_global_this_value) +ThrowCompletionOr> Realm::initialize_host_defined_realm(VM& vm, Function create_global_object, Function create_global_this_value) { DeferGC defer_gc(vm.heap()); @@ -57,14 +57,14 @@ ThrowCompletionOr> Realm::initialize_host_define // 7. If the host requires use of an exotic object to serve as realm's global object, // let global be such an object created in a host-defined manner. // Otherwise, let global be undefined, indicating that an ordinary object should be created as the global object. - GlobalObject* global = nullptr; + Object* global = nullptr; if (create_global_object) global = create_global_object(*realm); // 8. If the host requires that the this binding in realm's global scope return an object other than the global object, // let thisValue be such an object created in a host-defined manner. // Otherwise, let thisValue be undefined, indicating that realm's global this binding should be the global object. - GlobalObject* this_value = nullptr; + Object* this_value = nullptr; if (create_global_this_value) this_value = create_global_this_value(*realm); @@ -82,7 +82,7 @@ ThrowCompletionOr> Realm::initialize_host_define } // 9.3.3 SetRealmGlobalObject ( realmRec, globalObj, thisValue ), https://tc39.es/ecma262/#sec-setrealmglobalobject -void Realm::set_global_object(GlobalObject* global_object, GlobalObject* this_value) +void Realm::set_global_object(Object* global_object, Object* this_value) { // 1. If globalObj is undefined, then if (global_object == nullptr) { diff --git a/Userland/Libraries/LibJS/Runtime/Realm.h b/Userland/Libraries/LibJS/Runtime/Realm.h index 8a3a043d0b..ff23af8b92 100644 --- a/Userland/Libraries/LibJS/Runtime/Realm.h +++ b/Userland/Libraries/LibJS/Runtime/Realm.h @@ -28,11 +28,11 @@ public: Realm() = default; static Realm* create(VM&); - static ThrowCompletionOr> initialize_host_defined_realm(VM&, Function create_global_object, Function create_global_this_value); + static ThrowCompletionOr> initialize_host_defined_realm(VM&, Function create_global_object, Function create_global_this_value); - void set_global_object(GlobalObject* global_object, GlobalObject* this_value); + void set_global_object(Object* global_object, Object* this_value); - [[nodiscard]] GlobalObject& global_object() const { return *m_global_object; } + [[nodiscard]] Object& global_object() const { return *m_global_object; } [[nodiscard]] GlobalEnvironment& global_environment() const { return *m_global_environment; } [[nodiscard]] Intrinsics const& intrinsics() const { return *m_intrinsics; } @@ -51,7 +51,7 @@ private: virtual void visit_edges(Visitor&) override; Intrinsics* m_intrinsics { nullptr }; // [[Intrinsics]] - GlobalObject* m_global_object { nullptr }; // [[GlobalObject]] + Object* m_global_object { nullptr }; // [[GlobalObject]] GlobalEnvironment* m_global_environment { nullptr }; // [[GlobalEnv]] OwnPtr m_host_defined; // [[HostDefined]] }; diff --git a/Userland/Libraries/LibJS/Runtime/VM.cpp b/Userland/Libraries/LibJS/Runtime/VM.cpp index 8a1c09e906..7a3356a2d7 100644 --- a/Userland/Libraries/LibJS/Runtime/VM.cpp +++ b/Userland/Libraries/LibJS/Runtime/VM.cpp @@ -644,7 +644,7 @@ Value VM::get_new_target() } // 9.4.5 GetGlobalObject ( ), https://tc39.es/ecma262/#sec-getglobalobject -GlobalObject& VM::get_global_object() +Object& VM::get_global_object() { // 1. Let currentRealm be the current Realm Record. auto& current_realm = *this->current_realm(); diff --git a/Userland/Libraries/LibJS/Runtime/VM.h b/Userland/Libraries/LibJS/Runtime/VM.h index b32d708e46..287dd408f4 100644 --- a/Userland/Libraries/LibJS/Runtime/VM.h +++ b/Userland/Libraries/LibJS/Runtime/VM.h @@ -186,7 +186,7 @@ public: Value get_new_target(); - GlobalObject& get_global_object(); + Object& get_global_object(); CommonPropertyNames names; diff --git a/Userland/Libraries/LibWeb/HTML/EventLoop/EventLoop.cpp b/Userland/Libraries/LibWeb/HTML/EventLoop/EventLoop.cpp index 597b7ebdd5..acded61637 100644 --- a/Userland/Libraries/LibWeb/HTML/EventLoop/EventLoop.cpp +++ b/Userland/Libraries/LibWeb/HTML/EventLoop/EventLoop.cpp @@ -240,7 +240,7 @@ void old_queue_global_task_with_document(HTML::Task::Source source, DOM::Documen } // https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-global-task -void queue_global_task(HTML::Task::Source source, JS::GlobalObject& global_object, Function steps) +void queue_global_task(HTML::Task::Source source, JS::Object& global_object, Function steps) { // 1. Let event loop be global's relevant agent's event loop. auto& global_custom_data = verify_cast(*global_object.vm().custom_data()); diff --git a/Userland/Libraries/LibWeb/HTML/EventLoop/EventLoop.h b/Userland/Libraries/LibWeb/HTML/EventLoop/EventLoop.h index 70c806defa..fbe0ec929d 100644 --- a/Userland/Libraries/LibWeb/HTML/EventLoop/EventLoop.h +++ b/Userland/Libraries/LibWeb/HTML/EventLoop/EventLoop.h @@ -100,7 +100,7 @@ private: EventLoop& main_thread_event_loop(); void old_queue_global_task_with_document(HTML::Task::Source, DOM::Document&, Function steps); -void queue_global_task(HTML::Task::Source, JS::GlobalObject&, Function steps); +void queue_global_task(HTML::Task::Source, JS::Object&, Function steps); void queue_a_microtask(DOM::Document*, Function steps); void perform_a_microtask_checkpoint(); diff --git a/Userland/Libraries/LibWeb/HTML/Scripting/Environments.cpp b/Userland/Libraries/LibWeb/HTML/Scripting/Environments.cpp index d554d91526..c407c3d8d2 100644 --- a/Userland/Libraries/LibWeb/HTML/Scripting/Environments.cpp +++ b/Userland/Libraries/LibWeb/HTML/Scripting/Environments.cpp @@ -42,7 +42,7 @@ JS::Realm& EnvironmentSettingsObject::realm() } // https://html.spec.whatwg.org/multipage/webappapis.html#concept-settings-object-global -JS::GlobalObject& EnvironmentSettingsObject::global_object() +JS::Object& EnvironmentSettingsObject::global_object() { // An environment settings object's Realm then has a [[GlobalObject]] field, which contains the environment settings object's global object. return realm().global_object(); @@ -294,7 +294,7 @@ JS::Realm& incumbent_realm() } // https://html.spec.whatwg.org/multipage/webappapis.html#concept-incumbent-global -JS::GlobalObject& incumbent_global_object() +JS::Object& incumbent_global_object() { // Similarly, the incumbent global object is the global object of the incumbent settings object. return incumbent_settings_object().global_object(); @@ -311,7 +311,7 @@ EnvironmentSettingsObject& current_settings_object() } // https://html.spec.whatwg.org/multipage/webappapis.html#current-global-object -JS::GlobalObject& current_global_object() +JS::Object& current_global_object() { auto& event_loop = HTML::main_thread_event_loop(); auto& vm = event_loop.vm(); @@ -341,7 +341,7 @@ EnvironmentSettingsObject& relevant_settings_object(DOM::Node const& node) } // https://html.spec.whatwg.org/multipage/webappapis.html#concept-relevant-global -JS::GlobalObject& relevant_global_object(JS::Object const& object) +JS::Object& relevant_global_object(JS::Object const& object) { // Similarly, the relevant global object for a platform object o is the global object of the relevant Realm for o. return relevant_realm(object).global_object(); diff --git a/Userland/Libraries/LibWeb/HTML/Scripting/Environments.h b/Userland/Libraries/LibWeb/HTML/Scripting/Environments.h index c733ca29bc..ae95542d27 100644 --- a/Userland/Libraries/LibWeb/HTML/Scripting/Environments.h +++ b/Userland/Libraries/LibWeb/HTML/Scripting/Environments.h @@ -79,7 +79,7 @@ struct EnvironmentSettingsObject virtual CanUseCrossOriginIsolatedAPIs cross_origin_isolated_capability() = 0; JS::Realm& realm(); - JS::GlobalObject& global_object(); + JS::Object& global_object(); EventLoop& responsible_event_loop(); RunScriptDecision can_run_script(); @@ -121,12 +121,12 @@ private: EnvironmentSettingsObject& incumbent_settings_object(); JS::Realm& incumbent_realm(); -JS::GlobalObject& incumbent_global_object(); +JS::Object& incumbent_global_object(); EnvironmentSettingsObject& current_settings_object(); -JS::GlobalObject& current_global_object(); +JS::Object& current_global_object(); JS::Realm& relevant_realm(JS::Object const&); EnvironmentSettingsObject& relevant_settings_object(JS::Object const&); EnvironmentSettingsObject& relevant_settings_object(DOM::Node const&); -JS::GlobalObject& relevant_global_object(JS::Object const&); +JS::Object& relevant_global_object(JS::Object const&); }