1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-15 07:04:59 +00:00

LibWeb: Bring browsing context creation closer to spec

This patch implements the "create a new browsing context" function from
the HTML spec and replaces our existing logic with it.

The big difference is that browsing contexts now initially navigate to
"about:blank" instead of starting out in a strange "empty" state.
This makes it possible for websites to create a new iframe and start
scripting inside it right away, without having to load an URL into it.
This commit is contained in:
Andreas Kling 2022-08-05 10:55:47 +02:00
parent 73f77969a6
commit 2a7924f96c
8 changed files with 242 additions and 5 deletions

View file

@ -334,6 +334,12 @@ EnvironmentSettingsObject& relevant_settings_object(JS::Object const& object)
return verify_cast<EnvironmentSettingsObject>(*relevant_realm(object).host_defined());
}
EnvironmentSettingsObject& relevant_settings_object(DOM::Node const& node)
{
// Then, the relevant settings object for a platform object o is the environment settings object of the relevant Realm for o.
return const_cast<DOM::Document&>(node.document()).relevant_settings_object();
}
// https://html.spec.whatwg.org/multipage/webappapis.html#concept-relevant-global
JS::GlobalObject& relevant_global_object(JS::Object const& object)
{