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

LibWeb/HTML: Port Window.document to IDL

This commit is contained in:
Linus Groh 2023-03-05 18:54:33 +00:00
parent dcff775ab1
commit 0e587420a8
3 changed files with 10 additions and 9 deletions

View file

@ -1093,7 +1093,6 @@ WebIDL::ExceptionOr<void> Window::initialize_web_interfaces(Badge<WindowEnvironm
// FIXME: These should be native accessors, not properties
define_native_accessor(realm, "top", top_getter, nullptr, JS::Attribute::Enumerable);
define_native_accessor(realm, "parent", parent_getter, {}, JS::Attribute::Enumerable);
define_native_accessor(realm, "document", document_getter, {}, JS::Attribute::Enumerable);
define_native_accessor(realm, "frameElement", frame_element_getter, {}, JS::Attribute::Enumerable);
define_native_accessor(realm, "name", name_getter, name_setter, JS::Attribute::Enumerable);
define_native_accessor(realm, "history", history_getter, {}, JS::Attribute::Enumerable);
@ -1215,6 +1214,13 @@ JS::NonnullGCPtr<WindowProxy> Window::self() const
return verify_cast<WindowProxy>(relevant_realm(*this).global_environment().global_this_value());
}
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-document-2
JS::NonnullGCPtr<DOM::Document const> Window::document() const
{
// The document getter steps are to return this's associated Document.
return associated_document();
}
// https://html.spec.whatwg.org/multipage/window-object.html#dom-frames
JS::NonnullGCPtr<WindowProxy> Window::frames() const
{
@ -1551,12 +1557,6 @@ JS_DEFINE_NATIVE_FUNCTION(Window::parent_getter)
return parent;
}
JS_DEFINE_NATIVE_FUNCTION(Window::document_getter)
{
auto* impl = TRY(impl_from(vm));
return &impl->associated_document();
}
// https://html.spec.whatwg.org/multipage/browsers.html#dom-frameelement
JS_DEFINE_NATIVE_FUNCTION(Window::frame_element_getter)
{