mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-28 10:37:17 +02:00
LibWeb: Start implementing "create and initialize a Document" from HTML
The way we've been creating DOM::Document has been pretty far from what the spec tells us to do, and this is a first big step towards getting us closer to spec. The new Document::create_and_initialize() is called by FrameLoader after loading a "text/html" resource. We create the JS Realm and the Window object when creating the Document (previously, we'd do it on first access to Document::interpreter().) The realm execution context is owned by the Environment Settings Object.
This commit is contained in:
Notes:
sideshowbarker
2024-07-18 05:01:22 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/602f927982
@@ -16,8 +16,8 @@
|
||||
|
||||
namespace Web::HTML {
|
||||
|
||||
EnvironmentSettingsObject::EnvironmentSettingsObject(JS::ExecutionContext& realm_execution_context)
|
||||
: m_realm_execution_context(realm_execution_context)
|
||||
EnvironmentSettingsObject::EnvironmentSettingsObject(NonnullOwnPtr<JS::ExecutionContext> realm_execution_context)
|
||||
: m_realm_execution_context(move(realm_execution_context))
|
||||
{
|
||||
// Register with the responsible event loop so we can perform step 4 of "perform a microtask checkpoint".
|
||||
responsible_event_loop().register_environment_settings_object({}, *this);
|
||||
@@ -31,7 +31,7 @@ EnvironmentSettingsObject::~EnvironmentSettingsObject()
|
||||
JS::ExecutionContext& EnvironmentSettingsObject::realm_execution_context()
|
||||
{
|
||||
// NOTE: All environment settings objects are created with a realm execution context, so it's stored and returned here in the base class.
|
||||
return m_realm_execution_context;
|
||||
return *m_realm_execution_context;
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/webappapis.html#environment-settings-object%27s-realm
|
||||
|
||||
Reference in New Issue
Block a user