LibWeb: Add Window::navigable()

This commit is contained in:
Aliaksandr Kalenik 2023-08-22 15:50:49 +02:00 committed by Andreas Kling
parent 343c709566
commit 5f21285337
Notes: sideshowbarker 2024-07-17 04:49:48 +09:00
2 changed files with 10 additions and 0 deletions

View file

@ -703,6 +703,13 @@ BrowsingContext* Window::browsing_context()
return m_associated_document->browsing_context();
}
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#window-navigable
JS::GCPtr<Navigable> Window::navigable() const
{
// A Window's navigable is the navigable whose active document is the Window's associated Document's, or null if there is no such navigable.
return Navigable::navigable_with_active_document(*m_associated_document);
}
// https://html.spec.whatwg.org/multipage/system-state.html#pdf-viewer-plugin-objects
Vector<JS::NonnullGCPtr<Plugin>> Window::pdf_viewer_plugin_objects()
{

View file

@ -20,6 +20,7 @@
#include <LibWeb/HTML/CrossOrigin/CrossOriginPropertyDescriptorMap.h>
#include <LibWeb/HTML/GlobalEventHandlers.h>
#include <LibWeb/HTML/MimeType.h>
#include <LibWeb/HTML/Navigable.h>
#include <LibWeb/HTML/Plugin.h>
#include <LibWeb/HTML/Scripting/ImportMap.h>
#include <LibWeb/HTML/ScrollOptions.h>
@ -82,6 +83,8 @@ public:
BrowsingContext const* browsing_context() const;
BrowsingContext* browsing_context();
JS::GCPtr<Navigable> navigable() const;
size_t document_tree_child_browsing_context_count() const;
ImportMap const& import_map() const { return m_import_map; }