mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-05 07:41:01 +00:00
LibWeb: Add principal settings object helper function
To more clearly represent the host binding which a principal setting realm has.
This commit is contained in:
parent
cc91473f4d
commit
1871b744ff
Notes:
github-actions[bot]
2024-11-02 00:56:31 +00:00
Author: https://github.com/shannonbooth
Commit: 1871b744ff
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1955
Reviewed-by: https://github.com/ADKaster ✅
2 changed files with 9 additions and 1 deletions
|
@ -347,12 +347,19 @@ JS::Realm& principal_realm(JS::Realm& realm)
|
||||||
return realm;
|
return realm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://whatpr.org/html/9893/webappapis.html#concept-realm-settings-object
|
||||||
|
EnvironmentSettingsObject& principal_realm_settings_object(JS::Realm& realm)
|
||||||
|
{
|
||||||
|
// A principal realm has a [[HostDefined]] field, which contains the principal realm's settings object.
|
||||||
|
return Bindings::host_defined_environment_settings_object(realm);
|
||||||
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/webappapis.html#current-settings-object
|
// https://html.spec.whatwg.org/multipage/webappapis.html#current-settings-object
|
||||||
// https://whatpr.org/html/9893/webappapis.html#current-principal-settings-object
|
// https://whatpr.org/html/9893/webappapis.html#current-principal-settings-object
|
||||||
EnvironmentSettingsObject& 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.
|
// 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());
|
return principal_realm_settings_object(current_principal_realm());
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/webappapis.html#current-global-object
|
// https://html.spec.whatwg.org/multipage/webappapis.html#current-global-object
|
||||||
|
|
|
@ -147,6 +147,7 @@ JS::Realm& incumbent_realm();
|
||||||
JS::Object& incumbent_global_object();
|
JS::Object& incumbent_global_object();
|
||||||
|
|
||||||
JS::Realm& current_principal_realm();
|
JS::Realm& current_principal_realm();
|
||||||
|
EnvironmentSettingsObject& principal_realm_settings_object(JS::Realm&);
|
||||||
EnvironmentSettingsObject& current_principal_settings_object();
|
EnvironmentSettingsObject& current_principal_settings_object();
|
||||||
|
|
||||||
JS::Realm& principal_realm(JS::Realm&);
|
JS::Realm& principal_realm(JS::Realm&);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue