diff options
Diffstat (limited to 'Userland/Libraries/LibWeb/HTML')
188 files changed, 470 insertions, 282 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/CanvasGradient.cpp b/Userland/Libraries/LibWeb/HTML/CanvasGradient.cpp index 0c9a431430..c7d07f7849 100644 --- a/Userland/Libraries/LibWeb/HTML/CanvasGradient.cpp +++ b/Userland/Libraries/LibWeb/HTML/CanvasGradient.cpp @@ -47,10 +47,12 @@ CanvasGradient::CanvasGradient(JS::Realm& realm, Gfx::GradientPaintStyle& gradie CanvasGradient::~CanvasGradient() = default; -void CanvasGradient::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> CanvasGradient::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::CanvasGradientPrototype>(realm, "CanvasGradient")); + + return {}; } // https://html.spec.whatwg.org/multipage/canvas.html#dom-canvasgradient-addcolorstop diff --git a/Userland/Libraries/LibWeb/HTML/CanvasGradient.h b/Userland/Libraries/LibWeb/HTML/CanvasGradient.h index c0ad7a78af..e9f23636ac 100644 --- a/Userland/Libraries/LibWeb/HTML/CanvasGradient.h +++ b/Userland/Libraries/LibWeb/HTML/CanvasGradient.h @@ -29,7 +29,7 @@ public: private: CanvasGradient(JS::Realm&, Gfx::GradientPaintStyle& gradient); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; NonnullRefPtr<Gfx::GradientPaintStyle> m_gradient; }; diff --git a/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp b/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp index 662df94c8b..ae0018375c 100644 --- a/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp +++ b/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp @@ -38,10 +38,12 @@ CanvasRenderingContext2D::CanvasRenderingContext2D(JS::Realm& realm, HTMLCanvasE CanvasRenderingContext2D::~CanvasRenderingContext2D() = default; -void CanvasRenderingContext2D::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> CanvasRenderingContext2D::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::CanvasRenderingContext2DPrototype>(realm, "CanvasRenderingContext2D")); + + return {}; } void CanvasRenderingContext2D::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.h b/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.h index 66fe651176..4567b4e451 100644 --- a/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.h +++ b/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.h @@ -86,7 +86,7 @@ public: private: explicit CanvasRenderingContext2D(JS::Realm&, HTMLCanvasElement&); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; struct PreparedTextGlyph { diff --git a/Userland/Libraries/LibWeb/HTML/CloseEvent.cpp b/Userland/Libraries/LibWeb/HTML/CloseEvent.cpp index d74105da24..866fd6cf9f 100644 --- a/Userland/Libraries/LibWeb/HTML/CloseEvent.cpp +++ b/Userland/Libraries/LibWeb/HTML/CloseEvent.cpp @@ -29,10 +29,12 @@ CloseEvent::CloseEvent(JS::Realm& realm, DeprecatedFlyString const& event_name, CloseEvent::~CloseEvent() = default; -void CloseEvent::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> CloseEvent::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::CloseEventPrototype>(realm, "CloseEvent")); + + return {}; } } diff --git a/Userland/Libraries/LibWeb/HTML/CloseEvent.h b/Userland/Libraries/LibWeb/HTML/CloseEvent.h index 548f4d489d..fb2886bc8b 100644 --- a/Userland/Libraries/LibWeb/HTML/CloseEvent.h +++ b/Userland/Libraries/LibWeb/HTML/CloseEvent.h @@ -33,7 +33,7 @@ public: private: CloseEvent(JS::Realm&, DeprecatedFlyString const& event_name, CloseEventInit const& event_init); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; bool m_was_clean { false }; u16 m_code { 0 }; diff --git a/Userland/Libraries/LibWeb/HTML/DOMParser.cpp b/Userland/Libraries/LibWeb/HTML/DOMParser.cpp index bb40b3574c..a89e927b11 100644 --- a/Userland/Libraries/LibWeb/HTML/DOMParser.cpp +++ b/Userland/Libraries/LibWeb/HTML/DOMParser.cpp @@ -25,10 +25,12 @@ DOMParser::DOMParser(JS::Realm& realm) DOMParser::~DOMParser() = default; -void DOMParser::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> DOMParser::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::DOMParserPrototype>(realm, "DOMParser")); + + return {}; } // https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-domparser-parsefromstring diff --git a/Userland/Libraries/LibWeb/HTML/DOMParser.h b/Userland/Libraries/LibWeb/HTML/DOMParser.h index 85f696e46b..ff03c9d710 100644 --- a/Userland/Libraries/LibWeb/HTML/DOMParser.h +++ b/Userland/Libraries/LibWeb/HTML/DOMParser.h @@ -28,7 +28,7 @@ public: private: explicit DOMParser(JS::Realm&); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/DOMStringMap.cpp b/Userland/Libraries/LibWeb/HTML/DOMStringMap.cpp index 271ba6160a..19729c5d66 100644 --- a/Userland/Libraries/LibWeb/HTML/DOMStringMap.cpp +++ b/Userland/Libraries/LibWeb/HTML/DOMStringMap.cpp @@ -26,10 +26,12 @@ DOMStringMap::DOMStringMap(DOM::Element& element) DOMStringMap::~DOMStringMap() = default; -void DOMStringMap::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> DOMStringMap::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::DOMStringMapPrototype>(realm, "DOMStringMap")); + + return {}; } void DOMStringMap::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/HTML/DOMStringMap.h b/Userland/Libraries/LibWeb/HTML/DOMStringMap.h index 5b77c072f0..9752706283 100644 --- a/Userland/Libraries/LibWeb/HTML/DOMStringMap.h +++ b/Userland/Libraries/LibWeb/HTML/DOMStringMap.h @@ -31,7 +31,7 @@ public: private: explicit DOMStringMap(DOM::Element&); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; // ^LegacyPlatformObject diff --git a/Userland/Libraries/LibWeb/HTML/ErrorEvent.cpp b/Userland/Libraries/LibWeb/HTML/ErrorEvent.cpp index 2e83004d95..8e2f4669df 100644 --- a/Userland/Libraries/LibWeb/HTML/ErrorEvent.cpp +++ b/Userland/Libraries/LibWeb/HTML/ErrorEvent.cpp @@ -31,10 +31,12 @@ ErrorEvent::ErrorEvent(JS::Realm& realm, DeprecatedFlyString const& event_name, ErrorEvent::~ErrorEvent() = default; -void ErrorEvent::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> ErrorEvent::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::ErrorEventPrototype>(realm, "ErrorEvent")); + + return {}; } void ErrorEvent::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/HTML/ErrorEvent.h b/Userland/Libraries/LibWeb/HTML/ErrorEvent.h index c34b6cf430..ef8d2d6cdc 100644 --- a/Userland/Libraries/LibWeb/HTML/ErrorEvent.h +++ b/Userland/Libraries/LibWeb/HTML/ErrorEvent.h @@ -47,7 +47,7 @@ public: private: ErrorEvent(JS::Realm&, DeprecatedFlyString const& event_name, ErrorEventInit const& event_init); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; DeprecatedString m_message { "" }; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.cpp index 3a62420849..3ad875c00d 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.cpp @@ -20,10 +20,12 @@ HTMLAnchorElement::HTMLAnchorElement(DOM::Document& document, DOM::QualifiedName HTMLAnchorElement::~HTMLAnchorElement() = default; -void HTMLAnchorElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLAnchorElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLAnchorElementPrototype>(realm, "HTMLAnchorElement")); + + return {}; } void HTMLAnchorElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) diff --git a/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.h b/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.h index 2f01af5187..0f6d9d864b 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.h @@ -32,7 +32,7 @@ public: private: HTMLAnchorElement(DOM::Document&, DOM::QualifiedName); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; void run_activation_behavior(Web::DOM::Event const&); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLAreaElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLAreaElement.cpp index 9618a11f6f..accb0eb3ee 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLAreaElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLAreaElement.cpp @@ -17,10 +17,12 @@ HTMLAreaElement::HTMLAreaElement(DOM::Document& document, DOM::QualifiedName qua HTMLAreaElement::~HTMLAreaElement() = default; -void HTMLAreaElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLAreaElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLAreaElementPrototype>(realm, "HTMLAreaElement")); + + return {}; } void HTMLAreaElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) diff --git a/Userland/Libraries/LibWeb/HTML/HTMLAreaElement.h b/Userland/Libraries/LibWeb/HTML/HTMLAreaElement.h index b12b7df404..2f52e7d8e7 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLAreaElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLAreaElement.h @@ -23,7 +23,7 @@ public: private: HTMLAreaElement(DOM::Document&, DOM::QualifiedName); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; // ^DOM::Element virtual void parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) override; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLAudioElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLAudioElement.cpp index f480581aa2..ea3e83e1e8 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLAudioElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLAudioElement.cpp @@ -16,10 +16,12 @@ HTMLAudioElement::HTMLAudioElement(DOM::Document& document, DOM::QualifiedName q HTMLAudioElement::~HTMLAudioElement() = default; -void HTMLAudioElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLAudioElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLAudioElementPrototype>(realm, "HTMLAudioElement")); + + return {}; } } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLAudioElement.h b/Userland/Libraries/LibWeb/HTML/HTMLAudioElement.h index 4d32b7e9b3..4dadc6c15e 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLAudioElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLAudioElement.h @@ -19,7 +19,7 @@ public: private: HTMLAudioElement(DOM::Document&, DOM::QualifiedName); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLBRElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLBRElement.cpp index a13ae96957..8499debff0 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLBRElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLBRElement.cpp @@ -17,10 +17,12 @@ HTMLBRElement::HTMLBRElement(DOM::Document& document, DOM::QualifiedName qualifi HTMLBRElement::~HTMLBRElement() = default; -void HTMLBRElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLBRElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLBRElementPrototype>(realm, "HTMLBRElement")); + + return {}; } JS::GCPtr<Layout::Node> HTMLBRElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style) diff --git a/Userland/Libraries/LibWeb/HTML/HTMLBRElement.h b/Userland/Libraries/LibWeb/HTML/HTMLBRElement.h index f6b1cf2f7e..9a70829cdb 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLBRElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLBRElement.h @@ -21,7 +21,7 @@ public: private: HTMLBRElement(DOM::Document&, DOM::QualifiedName); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLBaseElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLBaseElement.cpp index 7b515c87b1..08a40b5cb0 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLBaseElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLBaseElement.cpp @@ -16,10 +16,12 @@ HTMLBaseElement::HTMLBaseElement(DOM::Document& document, DOM::QualifiedName qua HTMLBaseElement::~HTMLBaseElement() = default; -void HTMLBaseElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLBaseElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLBaseElementPrototype>(realm, "HTMLBaseElement")); + + return {}; } void HTMLBaseElement::inserted() diff --git a/Userland/Libraries/LibWeb/HTML/HTMLBaseElement.h b/Userland/Libraries/LibWeb/HTML/HTMLBaseElement.h index 2a69da35ef..986c2a810e 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLBaseElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLBaseElement.h @@ -28,7 +28,7 @@ public: private: HTMLBaseElement(DOM::Document&, DOM::QualifiedName); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; virtual bool is_html_base_element() const override { return true; } // https://html.spec.whatwg.org/multipage/semantics.html#frozen-base-url diff --git a/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.cpp index 4edc01ca4c..817fe91dd3 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.cpp @@ -19,10 +19,12 @@ HTMLBodyElement::HTMLBodyElement(DOM::Document& document, DOM::QualifiedName qua HTMLBodyElement::~HTMLBodyElement() = default; -void HTMLBodyElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLBodyElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLBodyElementPrototype>(realm, "HTMLBodyElement")); + + return {}; } void HTMLBodyElement::apply_presentational_hints(CSS::StyleProperties& style) const diff --git a/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.h b/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.h index 4b437268fb..39bf51605f 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.h @@ -29,7 +29,7 @@ public: private: HTMLBodyElement(DOM::Document&, DOM::QualifiedName); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; // ^HTML::GlobalEventHandlers virtual EventTarget& global_event_handlers_to_event_target(DeprecatedFlyString const& event_name) override; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.cpp index 6705b3e5fb..6dacc24ac6 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.cpp @@ -51,10 +51,12 @@ HTMLButtonElement::HTMLButtonElement(DOM::Document& document, DOM::QualifiedName HTMLButtonElement::~HTMLButtonElement() = default; -void HTMLButtonElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLButtonElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLButtonElementPrototype>(realm, "HTMLButtonElement")); + + return {}; } DeprecatedString HTMLButtonElement::type() const diff --git a/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.h b/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.h index 8e49feba52..3cd9499f86 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.h @@ -26,7 +26,7 @@ class HTMLButtonElement final public: virtual ~HTMLButtonElement() override; - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; enum class TypeAttributeState { #define __ENUMERATE_HTML_BUTTON_TYPE_ATTRIBUTE(_, state) state, diff --git a/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp index cc373053a3..360ecfd79e 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp @@ -25,10 +25,12 @@ HTMLCanvasElement::HTMLCanvasElement(DOM::Document& document, DOM::QualifiedName HTMLCanvasElement::~HTMLCanvasElement() = default; -void HTMLCanvasElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLCanvasElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLCanvasElementPrototype>(realm, "HTMLCanvasElement")); + + return {}; } void HTMLCanvasElement::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.h b/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.h index 51a0f11292..f723162843 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.h @@ -40,7 +40,7 @@ public: private: HTMLCanvasElement(DOM::Document&, DOM::QualifiedName); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDListElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLDListElement.cpp index eed2efc709..26aad40aa1 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLDListElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLDListElement.cpp @@ -16,10 +16,12 @@ HTMLDListElement::HTMLDListElement(DOM::Document& document, DOM::QualifiedName q HTMLDListElement::~HTMLDListElement() = default; -void HTMLDListElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLDListElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLDListElementPrototype>(realm, "HTMLDListElement")); + + return {}; } } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDListElement.h b/Userland/Libraries/LibWeb/HTML/HTMLDListElement.h index d0c1dbdd8e..3dc20a0008 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLDListElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLDListElement.h @@ -19,7 +19,7 @@ public: private: HTMLDListElement(DOM::Document&, DOM::QualifiedName); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDataElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLDataElement.cpp index 0ec6a42b80..bfcb8d483a 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLDataElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLDataElement.cpp @@ -16,10 +16,12 @@ HTMLDataElement::HTMLDataElement(DOM::Document& document, DOM::QualifiedName qua HTMLDataElement::~HTMLDataElement() = default; -void HTMLDataElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLDataElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLDataElementPrototype>(realm, "HTMLDataElement")); + + return {}; } } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDataElement.h b/Userland/Libraries/LibWeb/HTML/HTMLDataElement.h index 5708963291..3266bfc9a1 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLDataElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLDataElement.h @@ -23,7 +23,7 @@ public: private: HTMLDataElement(DOM::Document&, DOM::QualifiedName); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDataListElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLDataListElement.cpp index 7c3f9619ca..62fba41c78 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLDataListElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLDataListElement.cpp @@ -16,10 +16,12 @@ HTMLDataListElement::HTMLDataListElement(DOM::Document& document, DOM::Qualified HTMLDataListElement::~HTMLDataListElement() = default; -void HTMLDataListElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLDataListElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLDataListElementPrototype>(realm, "HTMLDataListElement")); + + return {}; } } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDataListElement.h b/Userland/Libraries/LibWeb/HTML/HTMLDataListElement.h index d71383912e..db0cf827ae 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLDataListElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLDataListElement.h @@ -22,7 +22,7 @@ public: private: HTMLDataListElement(DOM::Document&, DOM::QualifiedName); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDetailsElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLDetailsElement.cpp index a6f6401ae3..fceef86285 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLDetailsElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLDetailsElement.cpp @@ -16,10 +16,12 @@ HTMLDetailsElement::HTMLDetailsElement(DOM::Document& document, DOM::QualifiedNa HTMLDetailsElement::~HTMLDetailsElement() = default; -void HTMLDetailsElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLDetailsElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLDetailsElementPrototype>(realm, "HTMLDetailsElement")); + + return {}; } } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDetailsElement.h b/Userland/Libraries/LibWeb/HTML/HTMLDetailsElement.h index 2a09a57b64..112e362ed3 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLDetailsElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLDetailsElement.h @@ -23,7 +23,7 @@ public: private: HTMLDetailsElement(DOM::Document&, DOM::QualifiedName); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDialogElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLDialogElement.cpp index f283602cc6..6791fb1ae9 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLDialogElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLDialogElement.cpp @@ -16,10 +16,12 @@ HTMLDialogElement::HTMLDialogElement(DOM::Document& document, DOM::QualifiedName HTMLDialogElement::~HTMLDialogElement() = default; -void HTMLDialogElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLDialogElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLDialogElementPrototype>(realm, "HTMLDialogElement")); + + return {}; } } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDialogElement.h b/Userland/Libraries/LibWeb/HTML/HTMLDialogElement.h index d54332c872..78a24fd469 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLDialogElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLDialogElement.h @@ -23,7 +23,7 @@ public: private: HTMLDialogElement(DOM::Document&, DOM::QualifiedName); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDirectoryElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLDirectoryElement.cpp index 7e76c9ee3c..1ea6e17034 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLDirectoryElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLDirectoryElement.cpp @@ -16,10 +16,12 @@ HTMLDirectoryElement::HTMLDirectoryElement(DOM::Document& document, DOM::Qualifi HTMLDirectoryElement::~HTMLDirectoryElement() = default; -void HTMLDirectoryElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLDirectoryElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLDirectoryElementPrototype>(realm, "HTMLDirectoryElement")); + + return {}; } } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDirectoryElement.h b/Userland/Libraries/LibWeb/HTML/HTMLDirectoryElement.h index fd53d1dc37..0bd8337a55 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLDirectoryElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLDirectoryElement.h @@ -20,7 +20,7 @@ public: private: HTMLDirectoryElement(DOM::Document&, DOM::QualifiedName); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDivElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLDivElement.cpp index 050187c916..3ebd7580b6 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLDivElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLDivElement.cpp @@ -16,10 +16,12 @@ HTMLDivElement::HTMLDivElement(DOM::Document& document, DOM::QualifiedName quali HTMLDivElement::~HTMLDivElement() = default; -void HTMLDivElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLDivElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLDivElementPrototype>(realm, "HTMLDivElement")); + + return {}; } } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDivElement.h b/Userland/Libraries/LibWeb/HTML/HTMLDivElement.h index a94635fe1a..37348a32e2 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLDivElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLDivElement.h @@ -23,7 +23,7 @@ public: private: HTMLDivElement(DOM::Document&, DOM::QualifiedName); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp index 1fdc7a5e77..3924eff662 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp @@ -40,12 +40,14 @@ HTMLElement::HTMLElement(DOM::Document& document, DOM::QualifiedName qualified_n HTMLElement::~HTMLElement() = default; -void HTMLElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLElementPrototype>(realm, "HTMLElement")); m_dataset = DOMStringMap::create(*this); + + return {}; } void HTMLElement::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/HTML/HTMLElement.h b/Userland/Libraries/LibWeb/HTML/HTMLElement.h index 6f8e774f74..24808802aa 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLElement.h @@ -64,7 +64,7 @@ public: protected: HTMLElement(DOM::Document&, DOM::QualifiedName); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; virtual void parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) override; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLEmbedElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLEmbedElement.cpp index 7ba220f5c1..d6242daef2 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLEmbedElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLEmbedElement.cpp @@ -16,10 +16,12 @@ HTMLEmbedElement::HTMLEmbedElement(DOM::Document& document, DOM::QualifiedName q HTMLEmbedElement::~HTMLEmbedElement() = default; -void HTMLEmbedElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLEmbedElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLEmbedElementPrototype>(realm, "HTMLEmbedElement")); + + return {}; } } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLEmbedElement.h b/Userland/Libraries/LibWeb/HTML/HTMLEmbedElement.h index 311ad16d3a..1e67977b1e 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLEmbedElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLEmbedElement.h @@ -19,7 +19,7 @@ public: private: HTMLEmbedElement(DOM::Document&, DOM::QualifiedName); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFieldSetElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLFieldSetElement.cpp index 59297ca6cc..cf6423d3d5 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLFieldSetElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLFieldSetElement.cpp @@ -17,10 +17,12 @@ HTMLFieldSetElement::HTMLFieldSetElement(DOM::Document& document, DOM::Qualified HTMLFieldSetElement::~HTMLFieldSetElement() = default; -void HTMLFieldSetElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLFieldSetElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLFieldSetElementPrototype>(realm, "HTMLFieldSetElement")); + + return {}; } // https://html.spec.whatwg.org/multipage/form-elements.html#concept-fieldset-disabled diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFieldSetElement.h b/Userland/Libraries/LibWeb/HTML/HTMLFieldSetElement.h index ecb9eb522b..2c3af63ed5 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLFieldSetElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLFieldSetElement.h @@ -41,7 +41,7 @@ public: private: HTMLFieldSetElement(DOM::Document&, DOM::QualifiedName); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFontElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLFontElement.cpp index 75243d89c4..ad8fad5fb7 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLFontElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLFontElement.cpp @@ -18,10 +18,12 @@ HTMLFontElement::HTMLFontElement(DOM::Document& document, DOM::QualifiedName qua HTMLFontElement::~HTMLFontElement() = default; -void HTMLFontElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLFontElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLFontElementPrototype>(realm, "HTMLFontElement")); + + return {}; } void HTMLFontElement::apply_presentational_hints(CSS::StyleProperties& style) const diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFontElement.h b/Userland/Libraries/LibWeb/HTML/HTMLFontElement.h index 89a3b0783d..13c5bd3c04 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLFontElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLFontElement.h @@ -21,7 +21,7 @@ public: private: HTMLFontElement(DOM::Document&, DOM::QualifiedName); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp index 54c13cbea7..a40da14126 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp @@ -30,10 +30,12 @@ HTMLFormElement::HTMLFormElement(DOM::Document& document, DOM::QualifiedName qua HTMLFormElement::~HTMLFormElement() = default; -void HTMLFormElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLFormElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLFormElementPrototype>(realm, "HTMLFormElement")); + + return {}; } void HTMLFormElement::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFormElement.h b/Userland/Libraries/LibWeb/HTML/HTMLFormElement.h index 41ec186c01..de93f3629d 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLFormElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLFormElement.h @@ -43,7 +43,7 @@ public: private: HTMLFormElement(DOM::Document&, DOM::QualifiedName); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; bool m_firing_submission_events { false }; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFrameElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLFrameElement.cpp index 3256104e30..e5d2099e79 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLFrameElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLFrameElement.cpp @@ -16,10 +16,12 @@ HTMLFrameElement::HTMLFrameElement(DOM::Document& document, DOM::QualifiedName q HTMLFrameElement::~HTMLFrameElement() = default; -void HTMLFrameElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLFrameElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLFrameElementPrototype>(realm, "HTMLFrameElement")); + + return {}; } // https://html.spec.whatwg.org/multipage/interaction.html#dom-tabindex diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFrameElement.h b/Userland/Libraries/LibWeb/HTML/HTMLFrameElement.h index ab36507102..f0cbfeb0ab 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLFrameElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLFrameElement.h @@ -20,7 +20,7 @@ public: private: HTMLFrameElement(DOM::Document&, DOM::QualifiedName); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; // ^DOM::Element virtual i32 default_tab_index_value() const override; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFrameSetElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLFrameSetElement.cpp index b36b77f494..7a5c11644d 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLFrameSetElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLFrameSetElement.cpp @@ -17,10 +17,12 @@ HTMLFrameSetElement::HTMLFrameSetElement(DOM::Document& document, DOM::Qualified HTMLFrameSetElement::~HTMLFrameSetElement() = default; -void HTMLFrameSetElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLFrameSetElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLFrameSetElementPrototype>(realm, "HTMLFrameSetElement")); + + return {}; } void HTMLFrameSetElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFrameSetElement.h b/Userland/Libraries/LibWeb/HTML/HTMLFrameSetElement.h index 24a4c295c9..60dc9ae5e4 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLFrameSetElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLFrameSetElement.h @@ -23,7 +23,7 @@ public: private: HTMLFrameSetElement(DOM::Document&, DOM::QualifiedName); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; virtual void parse_attribute(DeprecatedFlyString const&, DeprecatedString const&) override; // ^HTML::GlobalEventHandlers diff --git a/Userland/Libraries/LibWeb/HTML/HTMLHRElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLHRElement.cpp index f97a7814f8..0286bdf7a2 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLHRElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLHRElement.cpp @@ -16,10 +16,12 @@ HTMLHRElement::HTMLHRElement(DOM::Document& document, DOM::QualifiedName qualifi HTMLHRElement::~HTMLHRElement() = default; -void HTMLHRElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLHRElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLHRElementPrototype>(realm, "HTMLHRElement")); + + return {}; } } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLHRElement.h b/Userland/Libraries/LibWeb/HTML/HTMLHRElement.h index 97827985ea..ad58320baa 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLHRElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLHRElement.h @@ -23,7 +23,7 @@ public: private: HTMLHRElement(DOM::Document&, DOM::QualifiedName); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLHeadElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLHeadElement.cpp index ff17191036..d961e7a72a 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLHeadElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLHeadElement.cpp @@ -16,10 +16,12 @@ HTMLHeadElement::HTMLHeadElement(DOM::Document& document, DOM::QualifiedName qua HTMLHeadElement::~HTMLHeadElement() = default; -void HTMLHeadElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLHeadElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLHeadElementPrototype>(realm, "HTMLHeadElement")); + + return {}; } } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLHeadElement.h b/Userland/Libraries/LibWeb/HTML/HTMLHeadElement.h index 6d88ab8034..be4ab44aa7 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLHeadElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLHeadElement.h @@ -19,7 +19,7 @@ public: private: HTMLHeadElement(DOM::Document&, DOM::QualifiedName); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLHeadingElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLHeadingElement.cpp index e6fe3dddfc..83b2b7f90a 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLHeadingElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLHeadingElement.cpp @@ -16,10 +16,12 @@ HTMLHeadingElement::HTMLHeadingElement(DOM::Document& document, DOM::QualifiedNa HTMLHeadingElement::~HTMLHeadingElement() = default; -void HTMLHeadingElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLHeadingElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLHeadingElementPrototype>(realm, "HTMLHeadingElement")); + + return {}; } // https://html.spec.whatwg.org/multipage/rendering.html#tables-2 diff --git a/Userland/Libraries/LibWeb/HTML/HTMLHeadingElement.h b/Userland/Libraries/LibWeb/HTML/HTMLHeadingElement.h index 599975c046..9f02839b29 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLHeadingElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLHeadingElement.h @@ -31,7 +31,7 @@ public: private: HTMLHeadingElement(DOM::Document&, DOM::QualifiedName); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLHtmlElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLHtmlElement.cpp index f2758c9c67..606519ac02 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLHtmlElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLHtmlElement.cpp @@ -16,10 +16,12 @@ HTMLHtmlElement::HTMLHtmlElement(DOM::Document& document, DOM::QualifiedName qua HTMLHtmlElement::~HTMLHtmlElement() = default; -void HTMLHtmlElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLHtmlElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLHtmlElementPrototype>(realm, "HTMLHtmlElement")); + + return {}; } bool HTMLHtmlElement::should_use_body_background_properties() const diff --git a/Userland/Libraries/LibWeb/HTML/HTMLHtmlElement.h b/Userland/Libraries/LibWeb/HTML/HTMLHtmlElement.h index 454d260a29..a11c54da5e 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLHtmlElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLHtmlElement.h @@ -25,7 +25,7 @@ public: private: HTMLHtmlElement(DOM::Document&, DOM::QualifiedName); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; virtual bool is_html_html_element() const override { return true; } }; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp index 98131a22a1..1b7f15ea83 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp @@ -21,10 +21,12 @@ HTMLIFrameElement::HTMLIFrameElement(DOM::Document& document, DOM::QualifiedName HTMLIFrameElement::~HTMLIFrameElement() = default; -void HTMLIFrameElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLIFrameElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLIFrameElementPrototype>(realm, "HTMLIFrameElement")); + + return {}; } JS::GCPtr<Layout::Node> HTMLIFrameElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style) diff --git a/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.h b/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.h index e0a5f897e1..cc194cc369 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.h @@ -28,7 +28,7 @@ public: private: HTMLIFrameElement(DOM::Document&, DOM::QualifiedName); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; // ^DOM::Element virtual void inserted() override; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp index fd992c48ec..aadcf6b51d 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp @@ -48,10 +48,12 @@ HTMLImageElement::HTMLImageElement(DOM::Document& document, DOM::QualifiedName q HTMLImageElement::~HTMLImageElement() = default; -void HTMLImageElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLImageElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLImageElementPrototype>(realm, "HTMLImageElement")); + + return {}; } void HTMLImageElement::apply_presentational_hints(CSS::StyleProperties& style) const diff --git a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.h b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.h index 9c79421a4d..d300fb4291 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.h @@ -48,7 +48,7 @@ public: private: HTMLImageElement(DOM::Document&, DOM::QualifiedName); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; virtual void apply_presentational_hints(CSS::StyleProperties&) const override; virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp index 4592b97a29..4cbcf333c4 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp @@ -41,10 +41,12 @@ HTMLInputElement::HTMLInputElement(DOM::Document& document, DOM::QualifiedName q HTMLInputElement::~HTMLInputElement() = default; -void HTMLInputElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLInputElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLInputElementPrototype>(realm, "HTMLInputElement")); + + return {}; } void HTMLInputElement::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h index 893696a0fb..cc1dd564e4 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h @@ -134,7 +134,7 @@ private: // ^DOM::Element virtual i32 default_tab_index_value() const override; - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; static TypeAttributeState parse_type_attribute(StringView); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLLIElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLLIElement.cpp index 41cf0533e6..980775cf8b 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLLIElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLLIElement.cpp @@ -16,10 +16,12 @@ HTMLLIElement::HTMLLIElement(DOM::Document& document, DOM::QualifiedName qualifi HTMLLIElement::~HTMLLIElement() = default; -void HTMLLIElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLLIElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLLIElementPrototype>(realm, "HTMLLIElement")); + + return {}; } } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLLIElement.h b/Userland/Libraries/LibWeb/HTML/HTMLLIElement.h index 491001b714..1295619c3e 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLLIElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLLIElement.h @@ -23,7 +23,7 @@ public: private: HTMLLIElement(DOM::Document&, DOM::QualifiedName); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLLabelElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLLabelElement.cpp index 6d8372bf23..94f9e56454 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLLabelElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLLabelElement.cpp @@ -17,10 +17,12 @@ HTMLLabelElement::HTMLLabelElement(DOM::Document& document, DOM::QualifiedName q HTMLLabelElement::~HTMLLabelElement() = default; -void HTMLLabelElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLLabelElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLLabelElementPrototype>(realm, "HTMLLabelElement")); + + return {}; } JS::GCPtr<Layout::Node> HTMLLabelElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style) diff --git a/Userland/Libraries/LibWeb/HTML/HTMLLabelElement.h b/Userland/Libraries/LibWeb/HTML/HTMLLabelElement.h index 489ab4db4b..44f28e9aa9 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLLabelElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLLabelElement.h @@ -23,7 +23,7 @@ public: private: HTMLLabelElement(DOM::Document&, DOM::QualifiedName); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLLegendElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLLegendElement.cpp index dd004bc08d..8313f82dcd 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLLegendElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLLegendElement.cpp @@ -16,10 +16,12 @@ HTMLLegendElement::HTMLLegendElement(DOM::Document& document, DOM::QualifiedName HTMLLegendElement::~HTMLLegendElement() = default; -void HTMLLegendElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLLegendElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLLegendElementPrototype>(realm, "HTMLLegendElement")); + + return {}; } } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLLegendElement.h b/Userland/Libraries/LibWeb/HTML/HTMLLegendElement.h index dc10820eda..23c5cd8173 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLLegendElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLLegendElement.h @@ -19,7 +19,7 @@ public: private: HTMLLegendElement(DOM::Document&, DOM::QualifiedName); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.cpp index 7787da4572..294f5ee67b 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.cpp @@ -26,10 +26,12 @@ HTMLLinkElement::HTMLLinkElement(DOM::Document& document, DOM::QualifiedName qua HTMLLinkElement::~HTMLLinkElement() = default; -void HTMLLinkElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLLinkElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLLinkElementPrototype>(realm, "HTMLLinkElement")); + + return {}; } void HTMLLinkElement::inserted() diff --git a/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.h b/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.h index bb8cdfbc34..ee78861ec6 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.h @@ -33,7 +33,7 @@ public: private: HTMLLinkElement(DOM::Document&, DOM::QualifiedName); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; void parse_attribute(DeprecatedFlyString const&, DeprecatedString const&) override; // ^ResourceClient diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMapElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLMapElement.cpp index ebcfa407b3..318c5658a4 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLMapElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLMapElement.cpp @@ -16,10 +16,12 @@ HTMLMapElement::HTMLMapElement(DOM::Document& document, DOM::QualifiedName quali HTMLMapElement::~HTMLMapElement() = default; -void HTMLMapElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLMapElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLMapElementPrototype>(realm, "HTMLMapElement")); + + return {}; } } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMapElement.h b/Userland/Libraries/LibWeb/HTML/HTMLMapElement.h index c862ba7cc1..30b2a0df26 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLMapElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLMapElement.h @@ -19,7 +19,7 @@ public: private: HTMLMapElement(DOM::Document&, DOM::QualifiedName); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.cpp index 194f9e9cb7..31f6e8df48 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.cpp @@ -16,10 +16,12 @@ HTMLMarqueeElement::HTMLMarqueeElement(DOM::Document& document, DOM::QualifiedNa HTMLMarqueeElement::~HTMLMarqueeElement() = default; -void HTMLMarqueeElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLMarqueeElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLMarqueeElementPrototype>(realm, "HTMLMarqueeElement")); + + return {}; } void HTMLMarqueeElement::apply_presentational_hints(CSS::StyleProperties& style) const diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.h b/Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.h index 3c85d41bc2..cb345a54c6 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.h @@ -20,7 +20,7 @@ public: private: HTMLMarqueeElement(DOM::Document&, DOM::QualifiedName); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; virtual void apply_presentational_hints(CSS::StyleProperties&) const override; }; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.cpp index a1325ce359..2fea46c39a 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.cpp @@ -17,10 +17,12 @@ HTMLMediaElement::HTMLMediaElement(DOM::Document& document, DOM::QualifiedName q HTMLMediaElement::~HTMLMediaElement() = default; -void HTMLMediaElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLMediaElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLMediaElementPrototype>(realm, "HTMLMediaElement")); + + return {}; } // https://html.spec.whatwg.org/multipage/media.html#dom-navigator-canplaytype diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.h b/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.h index d1f3139bb6..126c24299c 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.h @@ -24,7 +24,7 @@ public: protected: HTMLMediaElement(DOM::Document&, DOM::QualifiedName); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMenuElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLMenuElement.cpp index b4b7575005..6507d52179 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLMenuElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLMenuElement.cpp @@ -16,10 +16,12 @@ HTMLMenuElement::HTMLMenuElement(DOM::Document& document, DOM::QualifiedName qua HTMLMenuElement::~HTMLMenuElement() = default; -void HTMLMenuElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLMenuElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLMenuElementPrototype>(realm, "HTMLMenuElement")); + + return {}; } } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMenuElement.h b/Userland/Libraries/LibWeb/HTML/HTMLMenuElement.h index 2af2ebff78..feb831fd67 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLMenuElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLMenuElement.h @@ -23,7 +23,7 @@ public: private: HTMLMenuElement(DOM::Document&, DOM::QualifiedName); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMetaElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLMetaElement.cpp index b40bb5507e..c32581290d 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLMetaElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLMetaElement.cpp @@ -16,10 +16,12 @@ HTMLMetaElement::HTMLMetaElement(DOM::Document& document, DOM::QualifiedName qua HTMLMetaElement::~HTMLMetaElement() = default; -void HTMLMetaElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLMetaElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLMetaElementPrototype>(realm, "HTMLMetaElement")); + + return {}; } } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMetaElement.h b/Userland/Libraries/LibWeb/HTML/HTMLMetaElement.h index bd21f42c14..dc81eaff21 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLMetaElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLMetaElement.h @@ -19,7 +19,7 @@ public: private: HTMLMetaElement(DOM::Document&, DOM::QualifiedName); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMeterElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLMeterElement.cpp index 6f8ce5e8fa..61c2245ab7 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLMeterElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLMeterElement.cpp @@ -16,10 +16,12 @@ HTMLMeterElement::HTMLMeterElement(DOM::Document& document, DOM::QualifiedName q HTMLMeterElement::~HTMLMeterElement() = default; -void HTMLMeterElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLMeterElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLMeterElementPrototype>(realm, "HTMLMeterElement")); + + return {}; } } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMeterElement.h b/Userland/Libraries/LibWeb/HTML/HTMLMeterElement.h index 5040a5589a..50d5c0613f 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLMeterElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLMeterElement.h @@ -28,7 +28,7 @@ public: private: HTMLMeterElement(DOM::Document&, DOM::QualifiedName); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLModElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLModElement.cpp index a1a4778828..98f2f967f6 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLModElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLModElement.cpp @@ -17,10 +17,12 @@ HTMLModElement::HTMLModElement(DOM::Document& document, DOM::QualifiedName quali HTMLModElement::~HTMLModElement() = default; -void HTMLModElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLModElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLModElementPrototype>(realm, "HTMLModElement")); + + return {}; } Optional<DOM::ARIARoles::Role> HTMLModElement::default_role() const diff --git a/Userland/Libraries/LibWeb/HTML/HTMLModElement.h b/Userland/Libraries/LibWeb/HTML/HTMLModElement.h index 47aa99d641..b710d0936c 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLModElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLModElement.h @@ -22,7 +22,7 @@ public: private: HTMLModElement(DOM::Document&, DOM::QualifiedName); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLOListElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLOListElement.cpp index 74de79aa2b..ae12c71934 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLOListElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLOListElement.cpp @@ -16,10 +16,12 @@ HTMLOListElement::HTMLOListElement(DOM::Document& document, DOM::QualifiedName q HTMLOListElement::~HTMLOListElement() = default; -void HTMLOListElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLOListElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLOListElementPrototype>(realm, "HTMLOListElement")); + + return {}; } } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLOListElement.h b/Userland/Libraries/LibWeb/HTML/HTMLOListElement.h index 7df7b0b08b..423251be5d 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLOListElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLOListElement.h @@ -23,7 +23,7 @@ public: private: HTMLOListElement(DOM::Document&, DOM::QualifiedName); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.cpp index dbbfada928..77662c57c7 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.cpp @@ -30,10 +30,12 @@ HTMLObjectElement::HTMLObjectElement(DOM::Document& document, DOM::QualifiedName HTMLObjectElement::~HTMLObjectElement() = default; -void HTMLObjectElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLObjectElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLObjectElementPrototype>(realm, "HTMLObjectElement")); + + return {}; } void HTMLObjectElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) diff --git a/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.h b/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.h index 46567c275e..e3fff897bf 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.h @@ -46,7 +46,7 @@ public: private: HTMLObjectElement(DOM::Document&, DOM::QualifiedName); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLOptGroupElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLOptGroupElement.cpp index 77c433c961..0acb8d000e 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLOptGroupElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLOptGroupElement.cpp @@ -16,10 +16,12 @@ HTMLOptGroupElement::HTMLOptGroupElement(DOM::Document& document, DOM::Qualified HTMLOptGroupElement::~HTMLOptGroupElement() = default; -void HTMLOptGroupElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLOptGroupElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLOptGroupElementPrototype>(realm, "HTMLOptGroupElement")); + + return {}; } } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLOptGroupElement.h b/Userland/Libraries/LibWeb/HTML/HTMLOptGroupElement.h index 3b3971442d..7e78eb6811 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLOptGroupElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLOptGroupElement.h @@ -23,7 +23,7 @@ public: private: HTMLOptGroupElement(DOM::Document&, DOM::QualifiedName); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLOptionElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLOptionElement.cpp index f70d7dffb9..1f4f64b0f1 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLOptionElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLOptionElement.cpp @@ -25,10 +25,12 @@ HTMLOptionElement::HTMLOptionElement(DOM::Document& document, DOM::QualifiedName HTMLOptionElement::~HTMLOptionElement() = default; -void HTMLOptionElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLOptionElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLOptionElementPrototype>(realm, "HTMLOptionElement")); + + return {}; } void HTMLOptionElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) diff --git a/Userland/Libraries/LibWeb/HTML/HTMLOptionElement.h b/Userland/Libraries/LibWeb/HTML/HTMLOptionElement.h index c6d8228c92..fd71690c33 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLOptionElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLOptionElement.h @@ -38,7 +38,7 @@ private: HTMLOptionElement(DOM::Document&, DOM::QualifiedName); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; void parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) override; void did_remove_attribute(DeprecatedFlyString const& name) override; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLOptionsCollection.cpp b/Userland/Libraries/LibWeb/HTML/HTMLOptionsCollection.cpp index 61fd922053..c832827131 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLOptionsCollection.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLOptionsCollection.cpp @@ -25,10 +25,12 @@ HTMLOptionsCollection::HTMLOptionsCollection(DOM::ParentNode& root, Function<boo HTMLOptionsCollection::~HTMLOptionsCollection() = default; -void HTMLOptionsCollection::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLOptionsCollection::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLOptionsCollectionPrototype>(realm, "HTMLOptionsCollection")); + + return {}; } // https://html.spec.whatwg.org/multipage/common-dom-interfaces.html#dom-htmloptionscollection-add diff --git a/Userland/Libraries/LibWeb/HTML/HTMLOptionsCollection.h b/Userland/Libraries/LibWeb/HTML/HTMLOptionsCollection.h index ee3d7ff5a0..46686fd223 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLOptionsCollection.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLOptionsCollection.h @@ -27,7 +27,7 @@ public: private: HTMLOptionsCollection(DOM::ParentNode& root, Function<bool(DOM::Element const&)> filter); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLOutputElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLOutputElement.cpp index 99a9d89ba9..1d5063c1d5 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLOutputElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLOutputElement.cpp @@ -16,10 +16,12 @@ HTMLOutputElement::HTMLOutputElement(DOM::Document& document, DOM::QualifiedName HTMLOutputElement::~HTMLOutputElement() = default; -void HTMLOutputElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLOutputElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLOutputElementPrototype>(realm, "HTMLOutputElement")); + + return {}; } // https://html.spec.whatwg.org/multipage/form-elements.html#the-output-element:concept-form-reset-control diff --git a/Userland/Libraries/LibWeb/HTML/HTMLOutputElement.h b/Userland/Libraries/LibWeb/HTML/HTMLOutputElement.h index d8c22cb5c6..12a19e8820 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLOutputElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLOutputElement.h @@ -50,7 +50,7 @@ public: private: HTMLOutputElement(DOM::Document&, DOM::QualifiedName); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLParagraphElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLParagraphElement.cpp index 72a77736ef..6010a77800 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLParagraphElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLParagraphElement.cpp @@ -16,10 +16,12 @@ HTMLParagraphElement::HTMLParagraphElement(DOM::Document& document, DOM::Qualifi HTMLParagraphElement::~HTMLParagraphElement() = default; -void HTMLParagraphElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLParagraphElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLParagraphElementPrototype>(realm, "HTMLParagraphElement")); + + return {}; } // https://html.spec.whatwg.org/multipage/rendering.html#tables-2 diff --git a/Userland/Libraries/LibWeb/HTML/HTMLParagraphElement.h b/Userland/Libraries/LibWeb/HTML/HTMLParagraphElement.h index e0f4153047..519dd7cd83 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLParagraphElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLParagraphElement.h @@ -25,7 +25,7 @@ public: private: HTMLParagraphElement(DOM::Document&, DOM::QualifiedName); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLParamElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLParamElement.cpp index b71bdbaed9..1dd89c3c17 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLParamElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLParamElement.cpp @@ -16,10 +16,12 @@ HTMLParamElement::HTMLParamElement(DOM::Document& document, DOM::QualifiedName q HTMLParamElement::~HTMLParamElement() = default; -void HTMLParamElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLParamElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLParamElementPrototype>(realm, "HTMLParamElement")); + + return {}; } } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLParamElement.h b/Userland/Libraries/LibWeb/HTML/HTMLParamElement.h index 8ae224061a..f32fc146fe 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLParamElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLParamElement.h @@ -19,7 +19,7 @@ public: private: HTMLParamElement(DOM::Document&, DOM::QualifiedName); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLPictureElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLPictureElement.cpp index d9e4bb99a5..f6f5d1abec 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLPictureElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLPictureElement.cpp @@ -16,10 +16,12 @@ HTMLPictureElement::HTMLPictureElement(DOM::Document& document, DOM::QualifiedNa HTMLPictureElement::~HTMLPictureElement() = default; -void HTMLPictureElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLPictureElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLPictureElementPrototype>(realm, "HTMLPictureElement")); + + return {}; } } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLPictureElement.h b/Userland/Libraries/LibWeb/HTML/HTMLPictureElement.h index c27e99ee34..33d9d3d02f 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLPictureElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLPictureElement.h @@ -19,7 +19,7 @@ public: private: HTMLPictureElement(DOM::Document&, DOM::QualifiedName); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLPreElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLPreElement.cpp index 684e4e49f1..15feeca06a 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLPreElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLPreElement.cpp @@ -16,10 +16,12 @@ HTMLPreElement::HTMLPreElement(DOM::Document& document, DOM::QualifiedName quali HTMLPreElement::~HTMLPreElement() = default; -void HTMLPreElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLPreElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLPreElementPrototype>(realm, "HTMLPreElement")); + + return {}; } void HTMLPreElement::apply_presentational_hints(CSS::StyleProperties& style) const diff --git a/Userland/Libraries/LibWeb/HTML/HTMLPreElement.h b/Userland/Libraries/LibWeb/HTML/HTMLPreElement.h index b1caeff7f6..db7fd5c8da 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLPreElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLPreElement.h @@ -23,7 +23,7 @@ public: private: HTMLPreElement(DOM::Document&, DOM::QualifiedName); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; virtual void apply_presentational_hints(CSS::StyleProperties&) const override; }; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.cpp index cde41d2594..a92512aaeb 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.cpp @@ -21,10 +21,12 @@ HTMLProgressElement::HTMLProgressElement(DOM::Document& document, DOM::Qualified HTMLProgressElement::~HTMLProgressElement() = default; -void HTMLProgressElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLProgressElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLProgressElementPrototype>(realm, "HTMLProgressElement")); + + return {}; } JS::GCPtr<Layout::Node> HTMLProgressElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style) diff --git a/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.h b/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.h index e8bac3b42d..9ff233211c 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.h @@ -39,7 +39,7 @@ public: private: HTMLProgressElement(DOM::Document&, DOM::QualifiedName); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; void progress_position_updated(); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLQuoteElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLQuoteElement.cpp index a1113a00a7..21dad595a1 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLQuoteElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLQuoteElement.cpp @@ -18,10 +18,12 @@ HTMLQuoteElement::HTMLQuoteElement(DOM::Document& document, DOM::QualifiedName q HTMLQuoteElement::~HTMLQuoteElement() = default; -void HTMLQuoteElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLQuoteElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLQuoteElementPrototype>(realm, "HTMLQuoteElement")); + + return {}; } Optional<DOM::ARIARoles::Role> HTMLQuoteElement::default_role() const diff --git a/Userland/Libraries/LibWeb/HTML/HTMLQuoteElement.h b/Userland/Libraries/LibWeb/HTML/HTMLQuoteElement.h index 9791dda4d7..ccc80188f9 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLQuoteElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLQuoteElement.h @@ -21,7 +21,7 @@ public: private: HTMLQuoteElement(DOM::Document&, DOM::QualifiedName); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp index 0af9dd888d..2438d1da96 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp @@ -30,10 +30,12 @@ HTMLScriptElement::HTMLScriptElement(DOM::Document& document, DOM::QualifiedName HTMLScriptElement::~HTMLScriptElement() = default; -void HTMLScriptElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLScriptElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLScriptElementPrototype>(realm, "HTMLScriptElement")); + + return {}; } void HTMLScriptElement::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.h b/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.h index 049e5aa994..df06764ac2 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.h @@ -57,7 +57,7 @@ public: virtual void resource_did_load() override; virtual void resource_did_fail() override; - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; // https://html.spec.whatwg.org/multipage/scripting.html#prepare-the-script-element diff --git a/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.cpp index bef9062115..60d11670f8 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.cpp @@ -20,10 +20,12 @@ HTMLSelectElement::HTMLSelectElement(DOM::Document& document, DOM::QualifiedName HTMLSelectElement::~HTMLSelectElement() = default; -void HTMLSelectElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLSelectElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLSelectElementPrototype>(realm, "HTMLSelectElement")); + + return {}; } void HTMLSelectElement::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.h b/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.h index 29996d74d4..2746422ec5 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.h @@ -65,7 +65,7 @@ public: private: HTMLSelectElement(DOM::Document&, DOM::QualifiedName); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; // ^DOM::Element diff --git a/Userland/Libraries/LibWeb/HTML/HTMLSlotElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLSlotElement.cpp index 7a43cb4ee1..e1570f44e1 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLSlotElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLSlotElement.cpp @@ -16,10 +16,12 @@ HTMLSlotElement::HTMLSlotElement(DOM::Document& document, DOM::QualifiedName qua HTMLSlotElement::~HTMLSlotElement() = default; -void HTMLSlotElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLSlotElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLSlotElementPrototype>(realm, "HTMLSlotElement")); + + return {}; } } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLSlotElement.h b/Userland/Libraries/LibWeb/HTML/HTMLSlotElement.h index 9f7cc04950..3167f98f2a 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLSlotElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLSlotElement.h @@ -19,7 +19,7 @@ public: private: HTMLSlotElement(DOM::Document&, DOM::QualifiedName); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLSourceElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLSourceElement.cpp index 5031b6b25b..afb877a308 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLSourceElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLSourceElement.cpp @@ -16,10 +16,12 @@ HTMLSourceElement::HTMLSourceElement(DOM::Document& document, DOM::QualifiedName HTMLSourceElement::~HTMLSourceElement() = default; -void HTMLSourceElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLSourceElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLSourceElementPrototype>(realm, "HTMLSourceElement")); + + return {}; } } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLSourceElement.h b/Userland/Libraries/LibWeb/HTML/HTMLSourceElement.h index 98c98a4e05..d3673f6a68 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLSourceElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLSourceElement.h @@ -19,7 +19,7 @@ public: private: HTMLSourceElement(DOM::Document&, DOM::QualifiedName); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLSpanElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLSpanElement.cpp index dd5559e20c..db14bb9402 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLSpanElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLSpanElement.cpp @@ -16,10 +16,12 @@ HTMLSpanElement::HTMLSpanElement(DOM::Document& document, DOM::QualifiedName qua HTMLSpanElement::~HTMLSpanElement() = default; -void HTMLSpanElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLSpanElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLSpanElementPrototype>(realm, "HTMLSpanElement")); + + return {}; } } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLSpanElement.h b/Userland/Libraries/LibWeb/HTML/HTMLSpanElement.h index 493e2effe6..97d7e7f023 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLSpanElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLSpanElement.h @@ -23,7 +23,7 @@ public: private: HTMLSpanElement(DOM::Document&, DOM::QualifiedName); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLStyleElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLStyleElement.cpp index cf42ecc56a..457e33c913 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLStyleElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLStyleElement.cpp @@ -18,10 +18,12 @@ HTMLStyleElement::HTMLStyleElement(DOM::Document& document, DOM::QualifiedName q HTMLStyleElement::~HTMLStyleElement() = default; -void HTMLStyleElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLStyleElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLStyleElementPrototype>(realm, "HTMLStyleElement")); + + return {}; } void HTMLStyleElement::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/HTML/HTMLStyleElement.h b/Userland/Libraries/LibWeb/HTML/HTMLStyleElement.h index 522390128b..2b9d2e871c 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLStyleElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLStyleElement.h @@ -29,7 +29,7 @@ public: private: HTMLStyleElement(DOM::Document&, DOM::QualifiedName); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; // https://www.w3.org/TR/cssom/#associated-css-style-sheet diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableCaptionElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTableCaptionElement.cpp index 25354fdb42..3b24428da8 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTableCaptionElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLTableCaptionElement.cpp @@ -16,10 +16,12 @@ HTMLTableCaptionElement::HTMLTableCaptionElement(DOM::Document& document, DOM::Q HTMLTableCaptionElement::~HTMLTableCaptionElement() = default; -void HTMLTableCaptionElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLTableCaptionElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLTableCaptionElementPrototype>(realm, "HTMLTableCaptionElement")); + + return {}; } // https://html.spec.whatwg.org/multipage/rendering.html#tables-2 diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableCaptionElement.h b/Userland/Libraries/LibWeb/HTML/HTMLTableCaptionElement.h index 4de44131a4..e8e24d1e6c 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTableCaptionElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLTableCaptionElement.h @@ -25,7 +25,7 @@ public: private: HTMLTableCaptionElement(DOM::Document&, DOM::QualifiedName); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.cpp index dbfbe9b62e..1204a56f9c 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.cpp @@ -18,10 +18,12 @@ HTMLTableCellElement::HTMLTableCellElement(DOM::Document& document, DOM::Qualifi HTMLTableCellElement::~HTMLTableCellElement() = default; -void HTMLTableCellElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLTableCellElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLTableCellElementPrototype>(realm, "HTMLTableCellElement")); + + return {}; } void HTMLTableCellElement::apply_presentational_hints(CSS::StyleProperties& style) const diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.h b/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.h index b30c0900f0..b671a7e29b 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.h @@ -27,7 +27,7 @@ public: private: HTMLTableCellElement(DOM::Document&, DOM::QualifiedName); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; virtual void apply_presentational_hints(CSS::StyleProperties&) const override; }; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableColElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTableColElement.cpp index 06e94dd8b6..35e8dab791 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTableColElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLTableColElement.cpp @@ -16,10 +16,12 @@ HTMLTableColElement::HTMLTableColElement(DOM::Document& document, DOM::Qualified HTMLTableColElement::~HTMLTableColElement() = default; -void HTMLTableColElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLTableColElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLTableColElementPrototype>(realm, "HTMLTableColElement")); + + return {}; } } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableColElement.h b/Userland/Libraries/LibWeb/HTML/HTMLTableColElement.h index 6b4a0f1da9..4a69c978bd 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTableColElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLTableColElement.h @@ -19,7 +19,7 @@ public: private: HTMLTableColElement(DOM::Document&, DOM::QualifiedName); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTableElement.cpp index 821d0e684f..a6747dcd13 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTableElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLTableElement.cpp @@ -24,10 +24,12 @@ HTMLTableElement::HTMLTableElement(DOM::Document& document, DOM::QualifiedName q HTMLTableElement::~HTMLTableElement() = default; -void HTMLTableElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLTableElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLTableElementPrototype>(realm, "HTMLTableElement")); + + return {}; } void HTMLTableElement::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableElement.h b/Userland/Libraries/LibWeb/HTML/HTMLTableElement.h index 6f897b41d4..2120927207 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTableElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLTableElement.h @@ -48,7 +48,7 @@ public: private: HTMLTableElement(DOM::Document&, DOM::QualifiedName); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; virtual void apply_presentational_hints(CSS::StyleProperties&) const override; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.cpp index 16be11e4b2..db02190d93 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.cpp @@ -22,10 +22,12 @@ HTMLTableRowElement::HTMLTableRowElement(DOM::Document& document, DOM::Qualified HTMLTableRowElement::~HTMLTableRowElement() = default; -void HTMLTableRowElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLTableRowElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLTableRowElementPrototype>(realm, "HTMLTableRowElement")); + + return {}; } void HTMLTableRowElement::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.h b/Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.h index 9332f86d38..f5cf0b9320 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.h @@ -30,7 +30,7 @@ public: private: HTMLTableRowElement(DOM::Document&, DOM::QualifiedName); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; JS::GCPtr<DOM::HTMLCollection> mutable m_cells; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableSectionElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTableSectionElement.cpp index 146a0197b8..5c469839c3 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTableSectionElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLTableSectionElement.cpp @@ -21,10 +21,12 @@ HTMLTableSectionElement::HTMLTableSectionElement(DOM::Document& document, DOM::Q HTMLTableSectionElement::~HTMLTableSectionElement() = default; -void HTMLTableSectionElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLTableSectionElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLTableSectionElementPrototype>(realm, "HTMLTableSectionElement")); + + return {}; } void HTMLTableSectionElement::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableSectionElement.h b/Userland/Libraries/LibWeb/HTML/HTMLTableSectionElement.h index a09fb90123..a695de1f61 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTableSectionElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLTableSectionElement.h @@ -30,7 +30,7 @@ public: private: HTMLTableSectionElement(DOM::Document&, DOM::QualifiedName); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; JS::GCPtr<DOM::HTMLCollection> mutable m_rows; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTemplateElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTemplateElement.cpp index 9712909d70..47df82e552 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTemplateElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLTemplateElement.cpp @@ -17,13 +17,15 @@ HTMLTemplateElement::HTMLTemplateElement(DOM::Document& document, DOM::Qualified HTMLTemplateElement::~HTMLTemplateElement() = default; -void HTMLTemplateElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLTemplateElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLTemplateElementPrototype>(realm, "HTMLTemplateElement")); m_content = heap().allocate<DOM::DocumentFragment>(realm, m_document->appropriate_template_contents_owner_document()); m_content->set_host(this); + + return {}; } void HTMLTemplateElement::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTemplateElement.h b/Userland/Libraries/LibWeb/HTML/HTMLTemplateElement.h index 2c22e19480..6a6a0a42bd 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTemplateElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLTemplateElement.h @@ -28,7 +28,7 @@ private: virtual bool is_html_template_element() const final { return true; } - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; JS::GCPtr<DOM::DocumentFragment> m_content; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.cpp index ac1443b100..3e49ad145d 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.cpp @@ -16,10 +16,12 @@ HTMLTextAreaElement::HTMLTextAreaElement(DOM::Document& document, DOM::Qualified HTMLTextAreaElement::~HTMLTextAreaElement() = default; -void HTMLTextAreaElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLTextAreaElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLTextAreaElementPrototype>(realm, "HTMLTextAreaElement")); + + return {}; } // https://html.spec.whatwg.org/multipage/interaction.html#dom-tabindex diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.h b/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.h index e7e323cfa7..dccef8e876 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.h @@ -57,7 +57,7 @@ public: private: HTMLTextAreaElement(DOM::Document&, DOM::QualifiedName); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; // ^DOM::Element virtual i32 default_tab_index_value() const override; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTimeElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTimeElement.cpp index 77692b083d..d0a14e5909 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTimeElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLTimeElement.cpp @@ -14,10 +14,12 @@ HTMLTimeElement::HTMLTimeElement(DOM::Document& document, DOM::QualifiedName qua { } -void HTMLTimeElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLTimeElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLTimeElementPrototype>(realm, "HTMLTimeElement")); + + return {}; } HTMLTimeElement::~HTMLTimeElement() = default; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTimeElement.h b/Userland/Libraries/LibWeb/HTML/HTMLTimeElement.h index f6e9fefc72..573faa6118 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTimeElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLTimeElement.h @@ -23,7 +23,7 @@ public: private: HTMLTimeElement(DOM::Document&, DOM::QualifiedName); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTitleElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTitleElement.cpp index 998a4b5b24..94a663a01b 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTitleElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLTitleElement.cpp @@ -17,10 +17,12 @@ HTMLTitleElement::HTMLTitleElement(DOM::Document& document, DOM::QualifiedName q HTMLTitleElement::~HTMLTitleElement() = default; -void HTMLTitleElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLTitleElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLTitleElementPrototype>(realm, "HTMLTitleElement")); + + return {}; } void HTMLTitleElement::children_changed() diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTitleElement.h b/Userland/Libraries/LibWeb/HTML/HTMLTitleElement.h index 545b24b6f3..e2dbccb9e7 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTitleElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLTitleElement.h @@ -19,7 +19,7 @@ public: private: HTMLTitleElement(DOM::Document&, DOM::QualifiedName); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; virtual void children_changed() override; }; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTrackElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTrackElement.cpp index 286d94b73a..74796453bb 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTrackElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLTrackElement.cpp @@ -16,10 +16,12 @@ HTMLTrackElement::HTMLTrackElement(DOM::Document& document, DOM::QualifiedName q HTMLTrackElement::~HTMLTrackElement() = default; -void HTMLTrackElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLTrackElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLTrackElementPrototype>(realm, "HTMLTrackElement")); + + return {}; } } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTrackElement.h b/Userland/Libraries/LibWeb/HTML/HTMLTrackElement.h index 17be218974..804dcdd107 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTrackElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLTrackElement.h @@ -19,7 +19,7 @@ public: private: HTMLTrackElement(DOM::Document&, DOM::QualifiedName); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLUListElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLUListElement.cpp index 04e1fd451c..deb8651ac1 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLUListElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLUListElement.cpp @@ -16,10 +16,12 @@ HTMLUListElement::HTMLUListElement(DOM::Document& document, DOM::QualifiedName q HTMLUListElement::~HTMLUListElement() = default; -void HTMLUListElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLUListElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLUListElementPrototype>(realm, "HTMLUListElement")); + + return {}; } } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLUListElement.h b/Userland/Libraries/LibWeb/HTML/HTMLUListElement.h index f1f4585ad4..52b5fa6c58 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLUListElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLUListElement.h @@ -23,7 +23,7 @@ public: private: HTMLUListElement(DOM::Document&, DOM::QualifiedName); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLUnknownElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLUnknownElement.cpp index ae683a1b35..0b88dc1709 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLUnknownElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLUnknownElement.cpp @@ -16,10 +16,12 @@ HTMLUnknownElement::HTMLUnknownElement(DOM::Document& document, DOM::QualifiedNa HTMLUnknownElement::~HTMLUnknownElement() = default; -void HTMLUnknownElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLUnknownElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLUnknownElementPrototype>(realm, "HTMLUnknownElement")); + + return {}; } } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLUnknownElement.h b/Userland/Libraries/LibWeb/HTML/HTMLUnknownElement.h index 9e46892771..769bc6a7a3 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLUnknownElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLUnknownElement.h @@ -19,7 +19,7 @@ public: private: HTMLUnknownElement(DOM::Document&, DOM::QualifiedName); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLVideoElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLVideoElement.cpp index eea5bfd1d5..97d73d2aa1 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLVideoElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLVideoElement.cpp @@ -16,10 +16,12 @@ HTMLVideoElement::HTMLVideoElement(DOM::Document& document, DOM::QualifiedName q HTMLVideoElement::~HTMLVideoElement() = default; -void HTMLVideoElement::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> HTMLVideoElement::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLVideoElementPrototype>(realm, "HTMLVideoElement")); + + return {}; } } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLVideoElement.h b/Userland/Libraries/LibWeb/HTML/HTMLVideoElement.h index 0d4470a583..41bb73e3de 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLVideoElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLVideoElement.h @@ -19,7 +19,7 @@ public: private: HTMLVideoElement(DOM::Document&, DOM::QualifiedName); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/History.cpp b/Userland/Libraries/LibWeb/HTML/History.cpp index 7034c04ea5..36817a6969 100644 --- a/Userland/Libraries/LibWeb/HTML/History.cpp +++ b/Userland/Libraries/LibWeb/HTML/History.cpp @@ -23,10 +23,12 @@ History::History(JS::Realm& realm, DOM::Document& document) History::~History() = default; -void History::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> History::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::HistoryPrototype>(realm, "History")); + + return {}; } void History::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/HTML/History.h b/Userland/Libraries/LibWeb/HTML/History.h index c20902b1fe..044d947adc 100644 --- a/Userland/Libraries/LibWeb/HTML/History.h +++ b/Userland/Libraries/LibWeb/HTML/History.h @@ -30,7 +30,7 @@ public: private: History(JS::Realm&, DOM::Document&); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; enum class IsPush { diff --git a/Userland/Libraries/LibWeb/HTML/ImageData.cpp b/Userland/Libraries/LibWeb/HTML/ImageData.cpp index 04ab5b549e..7b2df06eac 100644 --- a/Userland/Libraries/LibWeb/HTML/ImageData.cpp +++ b/Userland/Libraries/LibWeb/HTML/ImageData.cpp @@ -40,10 +40,12 @@ ImageData::ImageData(JS::Realm& realm, NonnullRefPtr<Gfx::Bitmap> bitmap, JS::No ImageData::~ImageData() = default; -void ImageData::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> ImageData::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::ImageDataPrototype>(realm, "ImageData")); + + return {}; } void ImageData::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/HTML/ImageData.h b/Userland/Libraries/LibWeb/HTML/ImageData.h index 86c25ce578..e3ffc55490 100644 --- a/Userland/Libraries/LibWeb/HTML/ImageData.h +++ b/Userland/Libraries/LibWeb/HTML/ImageData.h @@ -31,7 +31,7 @@ public: private: ImageData(JS::Realm&, NonnullRefPtr<Gfx::Bitmap>, JS::NonnullGCPtr<JS::Uint8ClampedArray>); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; NonnullRefPtr<Gfx::Bitmap> m_bitmap; diff --git a/Userland/Libraries/LibWeb/HTML/Location.cpp b/Userland/Libraries/LibWeb/HTML/Location.cpp index 04714e5e52..d9d6ccaddb 100644 --- a/Userland/Libraries/LibWeb/HTML/Location.cpp +++ b/Userland/Libraries/LibWeb/HTML/Location.cpp @@ -35,9 +35,9 @@ void Location::visit_edges(Cell::Visitor& visitor) visitor.visit(property); } -void Location::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> Location::initialize(JS::Realm& realm) { - Object::initialize(realm); + MUST_OR_THROW_OOM(Object::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::LocationPrototype>(realm, "Location")); // FIXME: Implement steps 2.-4. @@ -45,6 +45,8 @@ void Location::initialize(JS::Realm& realm) // 5. Set the value of the [[DefaultProperties]] internal slot of location to location.[[OwnPropertyKeys]](). // NOTE: In LibWeb this happens before the ESO is set up, so we must avoid location's custom [[OwnPropertyKeys]]. m_default_properties.extend(MUST(Object::internal_own_property_keys())); + + return {}; } // https://html.spec.whatwg.org/multipage/history.html#relevant-document diff --git a/Userland/Libraries/LibWeb/HTML/Location.h b/Userland/Libraries/LibWeb/HTML/Location.h index a2f9fc48c9..0d79ea70c0 100644 --- a/Userland/Libraries/LibWeb/HTML/Location.h +++ b/Userland/Libraries/LibWeb/HTML/Location.h @@ -68,7 +68,7 @@ public: private: explicit Location(JS::Realm&); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; DOM::Document const* relevant_document() const; diff --git a/Userland/Libraries/LibWeb/HTML/MessageChannel.cpp b/Userland/Libraries/LibWeb/HTML/MessageChannel.cpp index 069564c3e2..a027cb0f95 100644 --- a/Userland/Libraries/LibWeb/HTML/MessageChannel.cpp +++ b/Userland/Libraries/LibWeb/HTML/MessageChannel.cpp @@ -38,10 +38,12 @@ void MessageChannel::visit_edges(Cell::Visitor& visitor) visitor.visit(m_port2.ptr()); } -void MessageChannel::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> MessageChannel::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::MessageChannelPrototype>(realm, "MessageChannel")); + + return {}; } MessagePort* MessageChannel::port1() diff --git a/Userland/Libraries/LibWeb/HTML/MessageChannel.h b/Userland/Libraries/LibWeb/HTML/MessageChannel.h index 1dfe15520c..ac472971cb 100644 --- a/Userland/Libraries/LibWeb/HTML/MessageChannel.h +++ b/Userland/Libraries/LibWeb/HTML/MessageChannel.h @@ -28,7 +28,7 @@ public: private: explicit MessageChannel(JS::Realm&); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; JS::GCPtr<MessagePort> m_port1; diff --git a/Userland/Libraries/LibWeb/HTML/MessageEvent.cpp b/Userland/Libraries/LibWeb/HTML/MessageEvent.cpp index 910a94b5ae..455b84b8d1 100644 --- a/Userland/Libraries/LibWeb/HTML/MessageEvent.cpp +++ b/Userland/Libraries/LibWeb/HTML/MessageEvent.cpp @@ -29,10 +29,12 @@ MessageEvent::MessageEvent(JS::Realm& realm, DeprecatedFlyString const& event_na MessageEvent::~MessageEvent() = default; -void MessageEvent::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> MessageEvent::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::MessageEventPrototype>(realm, "MessageEvent")); + + return {}; } void MessageEvent::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/HTML/MessageEvent.h b/Userland/Libraries/LibWeb/HTML/MessageEvent.h index 73cd28d29c..3a62c071aa 100644 --- a/Userland/Libraries/LibWeb/HTML/MessageEvent.h +++ b/Userland/Libraries/LibWeb/HTML/MessageEvent.h @@ -32,7 +32,7 @@ public: DeprecatedString const& last_event_id() const { return m_last_event_id; } private: - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; JS::Value m_data; diff --git a/Userland/Libraries/LibWeb/HTML/MessagePort.cpp b/Userland/Libraries/LibWeb/HTML/MessagePort.cpp index 52159660e0..65eb830882 100644 --- a/Userland/Libraries/LibWeb/HTML/MessagePort.cpp +++ b/Userland/Libraries/LibWeb/HTML/MessagePort.cpp @@ -26,10 +26,12 @@ MessagePort::MessagePort(JS::Realm& realm) MessagePort::~MessagePort() = default; -void MessagePort::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> MessagePort::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::MessagePortPrototype>(realm, "MessagePort")); + + return {}; } void MessagePort::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/HTML/MessagePort.h b/Userland/Libraries/LibWeb/HTML/MessagePort.h index 84de2b7288..855aaf38b8 100644 --- a/Userland/Libraries/LibWeb/HTML/MessagePort.h +++ b/Userland/Libraries/LibWeb/HTML/MessagePort.h @@ -46,7 +46,7 @@ public: private: explicit MessagePort(JS::Realm&); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; bool is_entangled() const { return m_remote_port; } diff --git a/Userland/Libraries/LibWeb/HTML/Navigator.cpp b/Userland/Libraries/LibWeb/HTML/Navigator.cpp index b53263418b..d862e63d45 100644 --- a/Userland/Libraries/LibWeb/HTML/Navigator.cpp +++ b/Userland/Libraries/LibWeb/HTML/Navigator.cpp @@ -27,10 +27,12 @@ Navigator::Navigator(JS::Realm& realm) Navigator::~Navigator() = default; -void Navigator::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> Navigator::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::NavigatorPrototype>(realm, "Navigator")); + + return {}; } // https://w3c.github.io/webdriver/#dfn-webdriver diff --git a/Userland/Libraries/LibWeb/HTML/Navigator.h b/Userland/Libraries/LibWeb/HTML/Navigator.h index a6447ed749..54026d53ae 100644 --- a/Userland/Libraries/LibWeb/HTML/Navigator.h +++ b/Userland/Libraries/LibWeb/HTML/Navigator.h @@ -46,7 +46,7 @@ public: private: explicit Navigator(JS::Realm&); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/PageTransitionEvent.cpp b/Userland/Libraries/LibWeb/HTML/PageTransitionEvent.cpp index 33393346db..7b46fb9a60 100644 --- a/Userland/Libraries/LibWeb/HTML/PageTransitionEvent.cpp +++ b/Userland/Libraries/LibWeb/HTML/PageTransitionEvent.cpp @@ -27,10 +27,12 @@ PageTransitionEvent::PageTransitionEvent(JS::Realm& realm, DeprecatedFlyString c PageTransitionEvent::~PageTransitionEvent() = default; -void PageTransitionEvent::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> PageTransitionEvent::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::PageTransitionEventPrototype>(realm, "PageTransitionEvent")); + + return {}; } } diff --git a/Userland/Libraries/LibWeb/HTML/PageTransitionEvent.h b/Userland/Libraries/LibWeb/HTML/PageTransitionEvent.h index 6409d141c8..ffee7bc592 100644 --- a/Userland/Libraries/LibWeb/HTML/PageTransitionEvent.h +++ b/Userland/Libraries/LibWeb/HTML/PageTransitionEvent.h @@ -28,7 +28,7 @@ public: bool persisted() const { return m_persisted; } private: - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; bool m_persisted { false }; }; diff --git a/Userland/Libraries/LibWeb/HTML/Path2D.cpp b/Userland/Libraries/LibWeb/HTML/Path2D.cpp index 3803c7f019..f4910ad59e 100644 --- a/Userland/Libraries/LibWeb/HTML/Path2D.cpp +++ b/Userland/Libraries/LibWeb/HTML/Path2D.cpp @@ -54,10 +54,12 @@ Path2D::Path2D(JS::Realm& realm, Optional<Variant<JS::Handle<Path2D>, Deprecated Path2D::~Path2D() = default; -void Path2D::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> Path2D::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::Path2DPrototype>(realm, "Path2D")); + + return {}; } } diff --git a/Userland/Libraries/LibWeb/HTML/Path2D.h b/Userland/Libraries/LibWeb/HTML/Path2D.h index db3d781d09..2805a60c8f 100644 --- a/Userland/Libraries/LibWeb/HTML/Path2D.h +++ b/Userland/Libraries/LibWeb/HTML/Path2D.h @@ -28,7 +28,7 @@ public: private: Path2D(JS::Realm&, Optional<Variant<JS::Handle<Path2D>, DeprecatedString>> const&); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/PromiseRejectionEvent.cpp b/Userland/Libraries/LibWeb/HTML/PromiseRejectionEvent.cpp index b27adcc40d..96faaab3a2 100644 --- a/Userland/Libraries/LibWeb/HTML/PromiseRejectionEvent.cpp +++ b/Userland/Libraries/LibWeb/HTML/PromiseRejectionEvent.cpp @@ -35,10 +35,12 @@ void PromiseRejectionEvent::visit_edges(Cell::Visitor& visitor) visitor.visit(m_reason); } -void PromiseRejectionEvent::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> PromiseRejectionEvent::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::PromiseRejectionEventPrototype>(realm, "PromiseRejectionEvent")); + + return {}; } } diff --git a/Userland/Libraries/LibWeb/HTML/PromiseRejectionEvent.h b/Userland/Libraries/LibWeb/HTML/PromiseRejectionEvent.h index 6b4f4e01ee..3cd0ef2f1c 100644 --- a/Userland/Libraries/LibWeb/HTML/PromiseRejectionEvent.h +++ b/Userland/Libraries/LibWeb/HTML/PromiseRejectionEvent.h @@ -35,7 +35,7 @@ public: private: PromiseRejectionEvent(JS::Realm&, DeprecatedFlyString const& event_name, PromiseRejectionEventInit const& event_init); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; JS::Promise* m_promise { nullptr }; diff --git a/Userland/Libraries/LibWeb/HTML/Storage.cpp b/Userland/Libraries/LibWeb/HTML/Storage.cpp index e826eb44b7..ca325205c8 100644 --- a/Userland/Libraries/LibWeb/HTML/Storage.cpp +++ b/Userland/Libraries/LibWeb/HTML/Storage.cpp @@ -22,10 +22,12 @@ Storage::Storage(JS::Realm& realm) Storage::~Storage() = default; -void Storage::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> Storage::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::StoragePrototype>(realm, "Storage")); + + return {}; } // https://html.spec.whatwg.org/multipage/webstorage.html#dom-storage-length diff --git a/Userland/Libraries/LibWeb/HTML/Storage.h b/Userland/Libraries/LibWeb/HTML/Storage.h index 6b3323bc81..2fc749ee88 100644 --- a/Userland/Libraries/LibWeb/HTML/Storage.h +++ b/Userland/Libraries/LibWeb/HTML/Storage.h @@ -35,7 +35,7 @@ public: private: explicit Storage(JS::Realm&); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; void reorder(); void broadcast(DeprecatedString const& key, DeprecatedString const& old_value, DeprecatedString const& new_value); diff --git a/Userland/Libraries/LibWeb/HTML/SubmitEvent.cpp b/Userland/Libraries/LibWeb/HTML/SubmitEvent.cpp index ee1a535447..f25bdcbccc 100644 --- a/Userland/Libraries/LibWeb/HTML/SubmitEvent.cpp +++ b/Userland/Libraries/LibWeb/HTML/SubmitEvent.cpp @@ -27,10 +27,12 @@ SubmitEvent::SubmitEvent(JS::Realm& realm, DeprecatedFlyString const& event_name SubmitEvent::~SubmitEvent() = default; -void SubmitEvent::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> SubmitEvent::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::SubmitEventPrototype>(realm, "SubmitEvent")); + + return {}; } void SubmitEvent::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/HTML/SubmitEvent.h b/Userland/Libraries/LibWeb/HTML/SubmitEvent.h index 51398d9a46..a7cece8c14 100644 --- a/Userland/Libraries/LibWeb/HTML/SubmitEvent.h +++ b/Userland/Libraries/LibWeb/HTML/SubmitEvent.h @@ -29,7 +29,7 @@ public: private: SubmitEvent(JS::Realm&, DeprecatedFlyString const& event_name, SubmitEventInit const& event_init); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; JS::GCPtr<HTMLElement> m_submitter; diff --git a/Userland/Libraries/LibWeb/HTML/TextMetrics.cpp b/Userland/Libraries/LibWeb/HTML/TextMetrics.cpp index fda88cba77..acd6002399 100644 --- a/Userland/Libraries/LibWeb/HTML/TextMetrics.cpp +++ b/Userland/Libraries/LibWeb/HTML/TextMetrics.cpp @@ -21,10 +21,12 @@ TextMetrics::TextMetrics(JS::Realm& realm) TextMetrics::~TextMetrics() = default; -void TextMetrics::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> TextMetrics::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::TextMetricsPrototype>(realm, "TextMetrics")); + + return {}; } } diff --git a/Userland/Libraries/LibWeb/HTML/TextMetrics.h b/Userland/Libraries/LibWeb/HTML/TextMetrics.h index 8c969a2545..47df236a57 100644 --- a/Userland/Libraries/LibWeb/HTML/TextMetrics.h +++ b/Userland/Libraries/LibWeb/HTML/TextMetrics.h @@ -47,7 +47,7 @@ public: private: explicit TextMetrics(JS::Realm&); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; double m_width { 0 }; double m_actual_bounding_box_left { 0 }; diff --git a/Userland/Libraries/LibWeb/HTML/Worker.cpp b/Userland/Libraries/LibWeb/HTML/Worker.cpp index cf5179dc6a..8581c58c47 100644 --- a/Userland/Libraries/LibWeb/HTML/Worker.cpp +++ b/Userland/Libraries/LibWeb/HTML/Worker.cpp @@ -30,10 +30,12 @@ Worker::Worker(DeprecatedFlyString const& script_url, WorkerOptions const option { } -void Worker::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> Worker::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::WorkerPrototype>(realm, "Worker")); + + return {}; } void Worker::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/HTML/Worker.h b/Userland/Libraries/LibWeb/HTML/Worker.h index 9650cd39ea..218a0b7383 100644 --- a/Userland/Libraries/LibWeb/HTML/Worker.h +++ b/Userland/Libraries/LibWeb/HTML/Worker.h @@ -68,7 +68,7 @@ private: return static_cast<Bindings::WebEngineCustomData*>(target_vm.custom_data())->event_loop; } - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; DeprecatedFlyString m_script_url; diff --git a/Userland/Libraries/LibWeb/HTML/WorkerGlobalScope.cpp b/Userland/Libraries/LibWeb/HTML/WorkerGlobalScope.cpp index 24c01bab54..c7b8973c4f 100644 --- a/Userland/Libraries/LibWeb/HTML/WorkerGlobalScope.cpp +++ b/Userland/Libraries/LibWeb/HTML/WorkerGlobalScope.cpp @@ -30,10 +30,12 @@ WorkerGlobalScope::WorkerGlobalScope(JS::Realm& realm) WorkerGlobalScope::~WorkerGlobalScope() = default; -void WorkerGlobalScope::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> WorkerGlobalScope::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); m_navigator = WorkerNavigator::create(*this); + + return {}; } void WorkerGlobalScope::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/HTML/WorkerGlobalScope.h b/Userland/Libraries/LibWeb/HTML/WorkerGlobalScope.h index 9a1106cd32..c6bf3d6c1e 100644 --- a/Userland/Libraries/LibWeb/HTML/WorkerGlobalScope.h +++ b/Userland/Libraries/LibWeb/HTML/WorkerGlobalScope.h @@ -73,7 +73,7 @@ protected: explicit WorkerGlobalScope(JS::Realm&); private: - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; diff --git a/Userland/Libraries/LibWeb/HTML/WorkerNavigator.cpp b/Userland/Libraries/LibWeb/HTML/WorkerNavigator.cpp index 2585f260b4..0eadfd0fd8 100644 --- a/Userland/Libraries/LibWeb/HTML/WorkerNavigator.cpp +++ b/Userland/Libraries/LibWeb/HTML/WorkerNavigator.cpp @@ -23,10 +23,12 @@ WorkerNavigator::WorkerNavigator(WorkerGlobalScope& global_scope) WorkerNavigator::~WorkerNavigator() = default; -void WorkerNavigator::initialize(JS::Realm& realm) +JS::ThrowCompletionOr<void> WorkerNavigator::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype<Bindings::WorkerNavigatorPrototype>(realm, "WorkerNavigator")); + + return {}; } } diff --git a/Userland/Libraries/LibWeb/HTML/WorkerNavigator.h b/Userland/Libraries/LibWeb/HTML/WorkerNavigator.h index 54fdb2b263..d111884375 100644 --- a/Userland/Libraries/LibWeb/HTML/WorkerNavigator.h +++ b/Userland/Libraries/LibWeb/HTML/WorkerNavigator.h @@ -29,7 +29,7 @@ public: private: explicit WorkerNavigator(WorkerGlobalScope&); - virtual void initialize(JS::Realm&) override; + virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; }; } |