diff --git a/Tests/LibWeb/Text/expected/HTML/cross-origin-window-properties.txt b/Tests/LibWeb/Text/expected/HTML/cross-origin-window-properties.txt new file mode 100644 index 00000000000..3a2d263b041 --- /dev/null +++ b/Tests/LibWeb/Text/expected/HTML/cross-origin-window-properties.txt @@ -0,0 +1 @@ + PASS (didn't crash) diff --git a/Tests/LibWeb/Text/input/HTML/cross-origin-window-properties.html b/Tests/LibWeb/Text/input/HTML/cross-origin-window-properties.html new file mode 100644 index 00000000000..67a0f10d507 --- /dev/null +++ b/Tests/LibWeb/Text/input/HTML/cross-origin-window-properties.html @@ -0,0 +1,35 @@ + + + + diff --git a/Userland/Libraries/LibWeb/HTML/Window.cpp b/Userland/Libraries/LibWeb/HTML/Window.cpp index d05553c099c..183131131a5 100644 --- a/Userland/Libraries/LibWeb/HTML/Window.cpp +++ b/Userland/Libraries/LibWeb/HTML/Window.cpp @@ -874,6 +874,21 @@ String Window::status() const return m_status; } +// https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-window-close +void Window::close() +{ + // FIXME: Implement this properly + dbgln("(STUBBED) Window::close()"); +} + +// https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-window-closed +bool Window::closed() const +{ + // FIXME: Implement this properly + dbgln("(STUBBED) Window::closed"); + return false; +} + // https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-window-status void Window::set_status(String const& status) { @@ -918,6 +933,12 @@ void Window::focus() // indicate to the user that the page is attempting to gain focus. } +// https://html.spec.whatwg.org/multipage/interaction.html#dom-window-blur +void Window::blur() +{ + // The blur() method steps are to do nothing. +} + // https://html.spec.whatwg.org/multipage/window-object.html#dom-frames JS::NonnullGCPtr Window::frames() const { diff --git a/Userland/Libraries/LibWeb/HTML/Window.h b/Userland/Libraries/LibWeb/HTML/Window.h index ba0a4a1ceed..38213cf7c21 100644 --- a/Userland/Libraries/LibWeb/HTML/Window.h +++ b/Userland/Libraries/LibWeb/HTML/Window.h @@ -135,11 +135,14 @@ public: String name() const; void set_name(String const&); String status() const; + void close(); + bool closed() const; void set_status(String const&); [[nodiscard]] JS::NonnullGCPtr location(); JS::NonnullGCPtr history() const; JS::NonnullGCPtr navigation(); void focus(); + void blur(); JS::NonnullGCPtr frames() const; u32 length(); diff --git a/Userland/Libraries/LibWeb/HTML/Window.idl b/Userland/Libraries/LibWeb/HTML/Window.idl index 9de543783a9..a0202afdcdb 100644 --- a/Userland/Libraries/LibWeb/HTML/Window.idl +++ b/Userland/Libraries/LibWeb/HTML/Window.idl @@ -24,11 +24,14 @@ interface Window : EventTarget { [LegacyUnforgeable] readonly attribute Document document; attribute DOMString name; attribute DOMString status; + undefined close(); + readonly attribute boolean closed; [PutForwards=href, LegacyUnforgeable] readonly attribute Location location; readonly attribute History history; readonly attribute Navigation navigation; readonly attribute CustomElementRegistry customElements; undefined focus(); + undefined blur(); // other browsing contexts [Replaceable] readonly attribute WindowProxy frames;