mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-24 09:52:31 +00:00
LibWeb: Rename current settings object to 'current principal'
Aligning the name with the the PR implementing the javascript shadow realm proposal into the web platform. This commit simply performs the rename before implementing the behaviour change. The actual change to the behaviour of the AO is not implemented in this commit to support 'synthetic' shadow realms as the surrounding infrastructure is not in place yet. Not all specs have a MR open to align with this proposed change to the HTML standard. But in this case we can just apply the same mechanical change everywhere.
This commit is contained in:
parent
72f5fac2ff
commit
b2f3ed8b5a
Notes:
github-actions[bot]
2024-11-01 19:17:08 +00:00
Author: https://github.com/shannonbooth
Commit: b2f3ed8b5a
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1932
Reviewed-by: https://github.com/ADKaster ✅
16 changed files with 50 additions and 39 deletions
|
@ -81,23 +81,25 @@ JS::ThrowCompletionOr<JS::PropertyDescriptor> cross_origin_property_fallback(JS:
|
|||
return throw_completion(WebIDL::SecurityError::create(*vm.current_realm(), MUST(String::formatted("Can't access property '{}' on cross-origin object", property_key))));
|
||||
}
|
||||
|
||||
// 7.2.3.3 IsPlatformObjectSameOrigin ( O ), https://html.spec.whatwg.org/multipage/browsers.html#isplatformobjectsameorigin-(-o-)
|
||||
// 7.2.3.3 IsPlatformObjectSameOrigin ( O ), https://html.spec.whatwg.org/multipage/nav-history-apis.html#isplatformobjectsameorigin-(-o-)
|
||||
// https://whatpr.org/html/9893/nav-history-apis.html#isplatformobjectsameorigin-(-o-)
|
||||
bool is_platform_object_same_origin(JS::Object const& object)
|
||||
{
|
||||
// 1. Return true if the current settings object's origin is same origin-domain with O's relevant settings object's origin, and false otherwise.
|
||||
return HTML::current_settings_object().origin().is_same_origin_domain(HTML::relevant_settings_object(object).origin());
|
||||
// 1. Return true if the current principal settings object's origin is same origin-domain with O's relevant settings object's origin, and false otherwise.
|
||||
return HTML::current_principal_settings_object().origin().is_same_origin_domain(HTML::relevant_settings_object(object).origin());
|
||||
}
|
||||
|
||||
// 7.2.3.4 CrossOriginGetOwnPropertyHelper ( O, P ), https://html.spec.whatwg.org/multipage/browsers.html#crossorigingetownpropertyhelper-(-o,-p-)
|
||||
// 7.2.3.4 CrossOriginGetOwnPropertyHelper ( O, P ), https://html.spec.whatwg.org/multipage/nav-history-apis.html#crossorigingetownpropertyhelper-(-o,-p-)
|
||||
// https://whatpr.org/html/9893/nav-history-apis.html#crossorigingetownpropertyhelper-(-o,-p-)
|
||||
Optional<JS::PropertyDescriptor> cross_origin_get_own_property_helper(Variant<HTML::Location*, HTML::Window*> const& object, JS::PropertyKey const& property_key)
|
||||
{
|
||||
auto& realm = *Bindings::main_thread_vm().current_realm();
|
||||
auto const* object_ptr = object.visit([](auto* o) { return static_cast<JS::Object const*>(o); });
|
||||
auto const object_const_variant = object.visit([](auto* o) { return Variant<HTML::Location const*, HTML::Window const*> { o }; });
|
||||
|
||||
// 1. Let crossOriginKey be a tuple consisting of the current settings object, O's relevant settings object, and P.
|
||||
// 1. Let crossOriginKey be a tuple consisting of the current principal settings object, O's relevant settings object, and P.
|
||||
auto cross_origin_key = CrossOriginKey {
|
||||
.current_settings_object = (FlatPtr)&HTML::current_settings_object(),
|
||||
.current_principal_settings_object = (FlatPtr)&HTML::current_principal_settings_object(),
|
||||
.relevant_settings_object = (FlatPtr)&HTML::relevant_settings_object(*object_ptr),
|
||||
.property_key = property_key,
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue