mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-27 01:50:24 +00:00
LibWeb: Implement the IsPlatformObjectSameOrigin AO
This commit is contained in:
parent
34fed7bfcc
commit
bccbad003f
Notes:
sideshowbarker
2024-07-17 17:51:47 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/bccbad003f Pull-request: https://github.com/SerenityOS/serenity/pull/12919 Reviewed-by: https://github.com/awesomekling ✅
2 changed files with 8 additions and 0 deletions
|
@ -71,4 +71,11 @@ JS::ThrowCompletionOr<JS::PropertyDescriptor> cross_origin_property_fallback(JS:
|
|||
return vm.throw_completion<DOMExceptionWrapper>(global_object, DOM::SecurityError::create(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-)
|
||||
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());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ using CrossOriginPropertyDescriptorMap = HashMap<CrossOriginKey, JS::PropertyDes
|
|||
|
||||
Vector<CrossOriginProperty> cross_origin_properties(Variant<LocationObject const*, WindowObject const*> const&);
|
||||
JS::ThrowCompletionOr<JS::PropertyDescriptor> cross_origin_property_fallback(JS::GlobalObject&, JS::PropertyKey const&);
|
||||
bool is_platform_object_same_origin(JS::Object const&);
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue