1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-24 20:27:35 +00:00

LibWeb: Update Window::top() to use navigables

This commit is contained in:
Aliaksandr Kalenik 2023-09-07 12:51:34 +02:00 committed by Andreas Kling
parent 05cbc448b6
commit 8d82dc3a9f

View file

@ -890,12 +890,12 @@ u32 Window::length()
JS::GCPtr<WindowProxy const> Window::top() const JS::GCPtr<WindowProxy const> Window::top() const
{ {
// 1. If this's navigable is null, then return null. // 1. If this's navigable is null, then return null.
auto const* browsing_context = this->browsing_context(); auto navigable = this->navigable();
if (!browsing_context) if (!navigable)
return {}; return {};
// 2. Return this's navigable's top-level traversable's active WindowProxy. // 2. Return this's navigable's top-level traversable's active WindowProxy.
return browsing_context->top_level_browsing_context()->window_proxy(); return navigable->top_level_traversable()->active_window_proxy();
} }
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-parent // https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-parent