mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-22 02:09:24 +00:00
LibWeb: Return a WindowProxy from document.defaultView
This aligns our implementation with the most recent specification steps.
This commit is contained in:
parent
74f6dce9e6
commit
089139f09d
Notes:
github-actions[bot]
2024-09-21 08:06:25 +00:00
Author: https://github.com/tcl3
Commit: 089139f09d
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1468
6 changed files with 38 additions and 8 deletions
|
@ -698,6 +698,22 @@ WebIDL::ExceptionOr<void> Document::close()
|
|||
return {};
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-document-defaultview
|
||||
JS::GCPtr<HTML::WindowProxy> Document::default_view()
|
||||
{
|
||||
// If this's browsing context is null, then return null.
|
||||
if (!browsing_context())
|
||||
return {};
|
||||
|
||||
// 2. Return this's browsing context's WindowProxy object.
|
||||
return browsing_context()->window_proxy();
|
||||
}
|
||||
|
||||
JS::GCPtr<HTML::WindowProxy const> Document::default_view() const
|
||||
{
|
||||
return const_cast<Document*>(this)->default_view();
|
||||
}
|
||||
|
||||
HTML::Origin Document::origin() const
|
||||
{
|
||||
return m_origin;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue