1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-12 02:30:30 +09:00

LibWeb: Fill out implementation of current_principal_settings_object

In terms of the 'current principal realm' definition.

No functional impact, as we still need to implement current principal
realm once the surrounding infrastructure is in place. But it is one
less place which needs to be updated when that is all in place :^)
This commit is contained in:
Shannon Booth 2024-10-21 13:42:32 +13:00 committed by Andrew Kaster
parent b2f3ed8b5a
commit 0c2400641e
Notes: github-actions[bot] 2024-11-01 19:17:03 +00:00
2 changed files with 15 additions and 4 deletions

View file

@ -300,14 +300,22 @@ JS::Object& incumbent_global_object()
return incumbent_settings_object().global_object();
}
// https://html.spec.whatwg.org/multipage/webappapis.html#current-settings-object
EnvironmentSettingsObject& current_principal_settings_object()
// https://whatpr.org/html/9893/webappapis.html#current-principal-realm
JS::Realm& current_principal_realm()
{
// FIXME: The current principal realm is the principal realm of the current realm.
auto& event_loop = HTML::main_thread_event_loop();
auto& vm = event_loop.vm();
// Then, the current settings object is the environment settings object of the current Realm Record.
return Bindings::host_defined_environment_settings_object(*vm.current_realm());
return *vm.current_realm();
}
// https://html.spec.whatwg.org/multipage/webappapis.html#current-settings-object
// https://whatpr.org/html/9893/webappapis.html#current-principal-settings-object
EnvironmentSettingsObject& current_principal_settings_object()
{
// Then, the current principal settings object is the environment settings object of the current principal realm.
return Bindings::host_defined_environment_settings_object(current_principal_realm());
}
// https://html.spec.whatwg.org/multipage/webappapis.html#current-global-object