From 88f3145f8ac2816b66e68eaccc50f55c054784c2 Mon Sep 17 00:00:00 2001 From: Tim Ledbetter Date: Sun, 14 Apr 2024 07:38:10 +0100 Subject: [PATCH] LibWeb: Add methods to Window that must do nothing This change adds the `captureEvents()` and `releaseEvents()` methods to the window object. These methods are obsolete, but are still included in the HTML specification, which says they must do nothing. --- .../DOM/Window-methods-that-must-do-nothing.txt | 2 ++ .../DOM/Window-methods-that-must-do-nothing.html | 8 ++++++++ Userland/Libraries/LibWeb/HTML/Window.cpp | 12 ++++++++++++ Userland/Libraries/LibWeb/HTML/Window.h | 3 +++ Userland/Libraries/LibWeb/HTML/Window.idl | 3 +++ 5 files changed, 28 insertions(+) create mode 100644 Tests/LibWeb/Text/expected/DOM/Window-methods-that-must-do-nothing.txt create mode 100644 Tests/LibWeb/Text/input/DOM/Window-methods-that-must-do-nothing.html diff --git a/Tests/LibWeb/Text/expected/DOM/Window-methods-that-must-do-nothing.txt b/Tests/LibWeb/Text/expected/DOM/Window-methods-that-must-do-nothing.txt new file mode 100644 index 00000000000..e33d309bab9 --- /dev/null +++ b/Tests/LibWeb/Text/expected/DOM/Window-methods-that-must-do-nothing.txt @@ -0,0 +1,2 @@ +window.captureEvents() returns undefined: true +window.releaseEvents() returns undefined: true diff --git a/Tests/LibWeb/Text/input/DOM/Window-methods-that-must-do-nothing.html b/Tests/LibWeb/Text/input/DOM/Window-methods-that-must-do-nothing.html new file mode 100644 index 00000000000..3b0ce238d2f --- /dev/null +++ b/Tests/LibWeb/Text/input/DOM/Window-methods-that-must-do-nothing.html @@ -0,0 +1,8 @@ + + + diff --git a/Userland/Libraries/LibWeb/HTML/Window.cpp b/Userland/Libraries/LibWeb/HTML/Window.cpp index 352a49732f6..b61141c5497 100644 --- a/Userland/Libraries/LibWeb/HTML/Window.cpp +++ b/Userland/Libraries/LibWeb/HTML/Window.cpp @@ -1600,6 +1600,18 @@ JS::NonnullGCPtr Window::crypto() return JS::NonnullGCPtr { *m_crypto }; } +// https://html.spec.whatwg.org/multipage/obsolete.html#dom-window-captureevents +void Window::capture_events() +{ + // Do nothing. +} + +// https://html.spec.whatwg.org/multipage/obsolete.html#dom-document-releaseevents +void Window::release_events() +{ + // Do nothing. +} + // https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-navigation JS::NonnullGCPtr Window::navigation() { diff --git a/Userland/Libraries/LibWeb/HTML/Window.h b/Userland/Libraries/LibWeb/HTML/Window.h index 0576d2d8256..dc585854a03 100644 --- a/Userland/Libraries/LibWeb/HTML/Window.h +++ b/Userland/Libraries/LibWeb/HTML/Window.h @@ -202,6 +202,9 @@ public: [[nodiscard]] JS::NonnullGCPtr crypto(); + void capture_events(); + void release_events(); + [[nodiscard]] JS::NonnullGCPtr custom_elements(); HighResolutionTime::DOMHighResTimeStamp get_last_activation_timestamp() const { return m_last_activation_timestamp; } diff --git a/Userland/Libraries/LibWeb/HTML/Window.idl b/Userland/Libraries/LibWeb/HTML/Window.idl index a0202afdcdb..2c754cccae4 100644 --- a/Userland/Libraries/LibWeb/HTML/Window.idl +++ b/Userland/Libraries/LibWeb/HTML/Window.idl @@ -110,6 +110,9 @@ interface Window : EventTarget { // https://w3c.github.io/webcrypto/#crypto-interface [SameObject] readonly attribute Crypto crypto; + + undefined captureEvents(); + undefined releaseEvents(); }; Window includes AnimationFrameProvider; Window includes GlobalEventHandlers;