From 2a55ab13ef9c735a16674006a518c0e5acf7c88f Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Mon, 29 Jul 2024 11:11:52 +0100 Subject: [PATCH] LibWeb: Update DOMStringList to match PlatformObject changes - is_supported_property_index() no longer needs to be overridden - item_value() now returns Optional --- Userland/Libraries/LibWeb/HTML/DOMStringList.cpp | 11 ++--------- Userland/Libraries/LibWeb/HTML/DOMStringList.h | 3 +-- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/Userland/Libraries/LibWeb/HTML/DOMStringList.cpp b/Userland/Libraries/LibWeb/HTML/DOMStringList.cpp index 7427c45934ec..e10b95cb4932 100644 --- a/Userland/Libraries/LibWeb/HTML/DOMStringList.cpp +++ b/Userland/Libraries/LibWeb/HTML/DOMStringList.cpp @@ -56,17 +56,10 @@ bool DOMStringList::contains(StringView string) return m_list.contains_slow(string); } -bool DOMStringList::is_supported_property_index(u32 index) const -{ - // The DOMStringList interface supports indexed properties. The supported property indices are the indices of this's - // associated list. - return index < m_list.size(); -} - -WebIDL::ExceptionOr DOMStringList::item_value(size_t index) const +Optional DOMStringList::item_value(size_t index) const { if (index + 1 > m_list.size()) - return JS::js_undefined(); + return {}; return JS::PrimitiveString::create(vm(), m_list.at(index)); } diff --git a/Userland/Libraries/LibWeb/HTML/DOMStringList.h b/Userland/Libraries/LibWeb/HTML/DOMStringList.h index 6da66cf514fe..38551d7b3a7b 100644 --- a/Userland/Libraries/LibWeb/HTML/DOMStringList.h +++ b/Userland/Libraries/LibWeb/HTML/DOMStringList.h @@ -22,8 +22,7 @@ class DOMStringList final : public Bindings::PlatformObject { Optional item(u32 index) const; bool contains(StringView string); - virtual bool is_supported_property_index(u32) const override; - virtual WebIDL::ExceptionOr item_value(size_t index) const override; + virtual Optional item_value(size_t index) const override; private: explicit DOMStringList(JS::Realm&, Vector);