mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-20 09:49:15 +03:00
LibWeb: Make factory method of DOM::DOMTokenList fallible
This commit is contained in:
parent
1e03aa0ece
commit
251c063897
Notes:
sideshowbarker
2024-07-17 05:23:40 +09:00
Author: https://github.com/kennethmyhra Commit: https://github.com/SerenityOS/serenity/commit/251c063897 Pull-request: https://github.com/SerenityOS/serenity/pull/17491 Reviewed-by: https://github.com/linusg ✅
@ -52,10 +52,10 @@ inline void replace_in_ordered_set(Vector<DeprecatedString>& set, StringView ite
|
||||
|
||||
namespace Web::DOM {
|
||||
|
||||
DOMTokenList* DOMTokenList::create(Element const& associated_element, DeprecatedFlyString associated_attribute)
|
||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<DOMTokenList>> DOMTokenList::create(Element const& associated_element, DeprecatedFlyString associated_attribute)
|
||||
{
|
||||
auto& realm = associated_element.realm();
|
||||
return realm.heap().allocate<DOMTokenList>(realm, associated_element, move(associated_attribute)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
return MUST_OR_THROW_OOM(realm.heap().allocate<DOMTokenList>(realm, associated_element, move(associated_attribute)));
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#ref-for-domtokenlist%E2%91%A0%E2%91%A2
|
||||
|
@ -23,7 +23,7 @@ class DOMTokenList final : public Bindings::LegacyPlatformObject {
|
||||
WEB_PLATFORM_OBJECT(DOMTokenList, Bindings::LegacyPlatformObject);
|
||||
|
||||
public:
|
||||
static DOMTokenList* create(Element const& associated_element, DeprecatedFlyString associated_attribute);
|
||||
static WebIDL::ExceptionOr<JS::NonnullGCPtr<DOMTokenList>> create(Element const& associated_element, DeprecatedFlyString associated_attribute);
|
||||
~DOMTokenList() = default;
|
||||
|
||||
void associated_attribute_changed(StringView value);
|
||||
|
@ -455,7 +455,7 @@ NonnullRefPtr<CSS::StyleProperties> Element::resolved_css_values()
|
||||
DOMTokenList* Element::class_list()
|
||||
{
|
||||
if (!m_class_list)
|
||||
m_class_list = DOMTokenList::create(*this, HTML::AttributeNames::class_);
|
||||
m_class_list = DOMTokenList::create(*this, HTML::AttributeNames::class_).release_value_but_fixme_should_propagate_errors();
|
||||
return m_class_list;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user