1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 08:48:11 +00:00

LibWeb: Implement document-tree child navigable target name property set

This AO allows accessing child navigables by their name as named
properties on the WindowProxy object.
This commit is contained in:
Andrew Kaster 2023-09-18 21:56:11 -06:00 committed by Andrew Kaster
parent 7e277797ad
commit 64899dba44
5 changed files with 63 additions and 4 deletions

View file

@ -113,10 +113,11 @@ JS::ThrowCompletionOr<Optional<JS::PropertyDescriptor>> WindowProxy::internal_ge
if (property.has_value())
return property;
// FIXME: 6. If property is undefined and P is in W's document-tree child browsing context name property set, then:
if (false) {
// FIXME: 1. Let value be the WindowProxy object of the named object of W with the name P.
auto value = JS::js_undefined();
// 6. If property is undefined and P is in W's document-tree child navigable target name property set, then:
auto navigable_property_set = m_window->document_tree_child_navigable_target_name_property_set();
if (auto navigable = navigable_property_set.get(property_key.to_string().view()); navigable.has_value()) {
// 1. Let value be the active WindowProxy of the named object of W with the name P.
auto value = navigable.value()->active_window_proxy();
// 2. Return PropertyDescriptor{ [[Value]]: value, [[Enumerable]]: false, [[Writable]]: false, [[Configurable]]: true }.
// NOTE: The reason the property descriptors are non-enumerable, despite this mismatching the same-origin behavior, is for compatibility with existing web content. See issue #3183 for details.