1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-30 17:18:11 +00:00

LibWeb/HTML: Port Window.history to IDL

This commit is contained in:
Linus Groh 2023-03-05 20:21:35 +00:00
parent eccc0d90de
commit c42496187b
6 changed files with 17 additions and 9 deletions

View file

@ -1076,7 +1076,6 @@ WebIDL::ExceptionOr<void> Window::initialize_web_interfaces(Badge<WindowEnvironm
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, "frameElement", frame_element_getter, {}, JS::Attribute::Enumerable);
define_native_accessor(realm, "history", history_getter, {}, JS::Attribute::Enumerable);
define_native_accessor(realm, "performance", performance_getter, performance_setter, JS::Attribute::Enumerable | JS::Attribute::Configurable);
define_native_accessor(realm, "crypto", crypto_getter, {}, JS::Attribute::Enumerable);
define_native_accessor(realm, "screen", screen_getter, screen_setter, JS::Attribute::Enumerable | JS::Attribute::Configurable);
@ -1232,6 +1231,13 @@ JS::NonnullGCPtr<Location> Window::location() const
return *m_location;
}
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-history
JS::NonnullGCPtr<History> Window::history() const
{
// The history getter steps are to return this's associated Document's history object.
return associated_document().history();
}
// https://html.spec.whatwg.org/multipage/window-object.html#dom-frames
JS::NonnullGCPtr<WindowProxy> Window::frames() const
{
@ -1825,12 +1831,6 @@ JS_DEFINE_NATIVE_FUNCTION(Window::scroll_by)
return JS::js_undefined();
}
JS_DEFINE_NATIVE_FUNCTION(Window::history_getter)
{
auto* impl = TRY(impl_from(vm));
return impl->associated_document().history();
}
JS_DEFINE_NATIVE_FUNCTION(Window::screen_left_getter)
{
auto* impl = TRY(impl_from(vm));