mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 01:37:35 +00:00
LibJS+LibWeb: Let Realm store a plain Object for [[GlobalObject]]
This removes the requirement of having a global object that actually inherits from JS::GlobalObject, which is now a perfectly valid scenario. With the upcoming removal of wrapper objects in LibWeb, the HTML::Window object will inherit from DOM::EventTarget, which means it cannot also inherit from JS::GlobalObject.
This commit is contained in:
parent
72730422bb
commit
52543fc771
8 changed files with 20 additions and 20 deletions
|
@ -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<void()> steps)
|
||||
void queue_global_task(HTML::Task::Source source, JS::Object& global_object, Function<void()> steps)
|
||||
{
|
||||
// 1. Let event loop be global's relevant agent's event loop.
|
||||
auto& global_custom_data = verify_cast<Bindings::WebEngineCustomData>(*global_object.vm().custom_data());
|
||||
|
|
|
@ -100,7 +100,7 @@ private:
|
|||
|
||||
EventLoop& main_thread_event_loop();
|
||||
void old_queue_global_task_with_document(HTML::Task::Source, DOM::Document&, Function<void()> steps);
|
||||
void queue_global_task(HTML::Task::Source, JS::GlobalObject&, Function<void()> steps);
|
||||
void queue_global_task(HTML::Task::Source, JS::Object&, Function<void()> steps);
|
||||
void queue_a_microtask(DOM::Document*, Function<void()> steps);
|
||||
void perform_a_microtask_checkpoint();
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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&);
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue