mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 09:07:45 +00:00
LibJS+Everywhere: Allow Cell::initialize overrides to throw OOM errors
Note that as of this commit, there aren't any such throwers, and the call site in Heap::allocate will drop exceptions on the floor. This commit only serves to change the declaration of the overrides, make sure they return an empty value, and to propagate OOM errors frm their base initialize invocations.
This commit is contained in:
parent
1c1b902a6a
commit
2692db8699
694 changed files with 1774 additions and 1065 deletions
|
@ -25,10 +25,12 @@ SVGAnimatedLength::SVGAnimatedLength(JS::Realm& realm, JS::NonnullGCPtr<SVGLengt
|
|||
|
||||
SVGAnimatedLength::~SVGAnimatedLength() = default;
|
||||
|
||||
void SVGAnimatedLength::initialize(JS::Realm& realm)
|
||||
JS::ThrowCompletionOr<void> SVGAnimatedLength::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::SVGAnimatedLengthPrototype>(realm, "SVGAnimatedLength"));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
void SVGAnimatedLength::visit_edges(Cell::Visitor& visitor)
|
||||
|
|
|
@ -25,7 +25,7 @@ public:
|
|||
private:
|
||||
SVGAnimatedLength(JS::Realm&, JS::NonnullGCPtr<SVGLength> base_val, JS::NonnullGCPtr<SVGLength> anim_val);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
||||
JS::NonnullGCPtr<SVGLength> m_base_val;
|
||||
|
|
|
@ -16,10 +16,12 @@ SVGCircleElement::SVGCircleElement(DOM::Document& document, DOM::QualifiedName q
|
|||
{
|
||||
}
|
||||
|
||||
void SVGCircleElement::initialize(JS::Realm& realm)
|
||||
JS::ThrowCompletionOr<void> SVGCircleElement::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::SVGCircleElementPrototype>(realm, "SVGCircleElement"));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
void SVGCircleElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value)
|
||||
|
|
|
@ -28,7 +28,7 @@ public:
|
|||
private:
|
||||
SVGCircleElement(DOM::Document&, DOM::QualifiedName);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
|
||||
Optional<Gfx::Path> m_path;
|
||||
|
||||
|
|
|
@ -18,10 +18,12 @@ SVGClipPathElement::~SVGClipPathElement()
|
|||
{
|
||||
}
|
||||
|
||||
void SVGClipPathElement::initialize(JS::Realm& realm)
|
||||
JS::ThrowCompletionOr<void> SVGClipPathElement::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::SVGClipPathElementPrototype>(realm, "SVGClipPathElement"));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
JS::GCPtr<Layout::Node> SVGClipPathElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties>)
|
||||
|
|
|
@ -21,7 +21,7 @@ public:
|
|||
private:
|
||||
SVGClipPathElement(DOM::Document&, DOM::QualifiedName);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -18,10 +18,12 @@ SVGDefsElement::~SVGDefsElement()
|
|||
{
|
||||
}
|
||||
|
||||
void SVGDefsElement::initialize(JS::Realm& realm)
|
||||
JS::ThrowCompletionOr<void> SVGDefsElement::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::SVGDefsElementPrototype>(realm, "SVGDefsElement"));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
JS::GCPtr<Layout::Node> SVGDefsElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties>)
|
||||
|
|
|
@ -21,7 +21,7 @@ public:
|
|||
private:
|
||||
SVGDefsElement(DOM::Document&, DOM::QualifiedName);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -16,10 +16,12 @@ SVGElement::SVGElement(DOM::Document& document, DOM::QualifiedName qualified_nam
|
|||
{
|
||||
}
|
||||
|
||||
void SVGElement::initialize(JS::Realm& realm)
|
||||
JS::ThrowCompletionOr<void> SVGElement::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::SVGElementPrototype>(realm, "SVGElement"));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
void SVGElement::visit_edges(Cell::Visitor& visitor)
|
||||
|
|
|
@ -22,7 +22,7 @@ public:
|
|||
protected:
|
||||
SVGElement(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::NonnullGCPtr<HTML::DOMStringMap> m_dataset;
|
||||
|
|
|
@ -16,10 +16,12 @@ SVGEllipseElement::SVGEllipseElement(DOM::Document& document, DOM::QualifiedName
|
|||
{
|
||||
}
|
||||
|
||||
void SVGEllipseElement::initialize(JS::Realm& realm)
|
||||
JS::ThrowCompletionOr<void> SVGEllipseElement::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::SVGEllipseElementPrototype>(realm, "SVGEllipseElement"));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
void SVGEllipseElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value)
|
||||
|
|
|
@ -29,7 +29,7 @@ public:
|
|||
private:
|
||||
SVGEllipseElement(DOM::Document&, DOM::QualifiedName);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
|
||||
Optional<Gfx::Path> m_path;
|
||||
|
||||
|
|
|
@ -21,9 +21,9 @@ SVGForeignObjectElement::SVGForeignObjectElement(DOM::Document& document, DOM::Q
|
|||
|
||||
SVGForeignObjectElement::~SVGForeignObjectElement() = default;
|
||||
|
||||
void SVGForeignObjectElement::initialize(JS::Realm& realm)
|
||||
JS::ThrowCompletionOr<void> SVGForeignObjectElement::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::SVGForeignObjectElementPrototype>(realm, "SVGForeignObjectElement"));
|
||||
|
||||
// FIXME: These never actually get updated!
|
||||
|
@ -31,6 +31,8 @@ void SVGForeignObjectElement::initialize(JS::Realm& realm)
|
|||
m_y = SVGAnimatedLength::create(realm, SVGLength::create(realm, 0, 0), SVGLength::create(realm, 0, 0));
|
||||
m_width = SVGAnimatedLength::create(realm, SVGLength::create(realm, 0, 0), SVGLength::create(realm, 0, 0));
|
||||
m_height = SVGAnimatedLength::create(realm, SVGLength::create(realm, 0, 0), SVGLength::create(realm, 0, 0));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
void SVGForeignObjectElement::visit_edges(Cell::Visitor& visitor)
|
||||
|
|
|
@ -27,7 +27,7 @@ public:
|
|||
private:
|
||||
SVGForeignObjectElement(DOM::Document& document, DOM::QualifiedName qualified_name);
|
||||
|
||||
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;
|
||||
|
|
|
@ -15,10 +15,12 @@ SVGGeometryElement::SVGGeometryElement(DOM::Document& document, DOM::QualifiedNa
|
|||
{
|
||||
}
|
||||
|
||||
void SVGGeometryElement::initialize(JS::Realm& realm)
|
||||
JS::ThrowCompletionOr<void> SVGGeometryElement::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::SVGGeometryElementPrototype>(realm, "SVGGeometryElement"));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
JS::GCPtr<Layout::Node> SVGGeometryElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style)
|
||||
|
|
|
@ -26,7 +26,7 @@ public:
|
|||
protected:
|
||||
SVGGeometryElement(DOM::Document& document, DOM::QualifiedName qualified_name);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -18,10 +18,12 @@ SVGGraphicsElement::SVGGraphicsElement(DOM::Document& document, DOM::QualifiedNa
|
|||
{
|
||||
}
|
||||
|
||||
void SVGGraphicsElement::initialize(JS::Realm& realm)
|
||||
JS::ThrowCompletionOr<void> SVGGraphicsElement::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::SVGGraphicsElementPrototype>(realm, "SVGGraphicsElement"));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
void SVGGraphicsElement::apply_presentational_hints(CSS::StyleProperties& style) const
|
||||
|
|
|
@ -27,7 +27,7 @@ public:
|
|||
protected:
|
||||
SVGGraphicsElement(DOM::Document&, DOM::QualifiedName);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -21,10 +21,12 @@ SVGLength::SVGLength(JS::Realm& realm, u8 unit_type, float value)
|
|||
{
|
||||
}
|
||||
|
||||
void SVGLength::initialize(JS::Realm& realm)
|
||||
JS::ThrowCompletionOr<void> SVGLength::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::SVGLengthPrototype>(realm, "SVGLength"));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
SVGLength::~SVGLength() = default;
|
||||
|
|
|
@ -27,7 +27,7 @@ public:
|
|||
private:
|
||||
SVGLength(JS::Realm&, u8 unit_type, float value);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
|
||||
u8 m_unit_type { 0 };
|
||||
float m_value { 0 };
|
||||
|
|
|
@ -16,10 +16,12 @@ SVGLineElement::SVGLineElement(DOM::Document& document, DOM::QualifiedName quali
|
|||
{
|
||||
}
|
||||
|
||||
void SVGLineElement::initialize(JS::Realm& realm)
|
||||
JS::ThrowCompletionOr<void> SVGLineElement::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::SVGLineElementPrototype>(realm, "SVGLineElement"));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
void SVGLineElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value)
|
||||
|
|
|
@ -29,7 +29,7 @@ public:
|
|||
private:
|
||||
SVGLineElement(DOM::Document&, DOM::QualifiedName);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
|
||||
Optional<Gfx::Path> m_path;
|
||||
|
||||
|
|
|
@ -89,10 +89,12 @@ SVGPathElement::SVGPathElement(DOM::Document& document, DOM::QualifiedName quali
|
|||
{
|
||||
}
|
||||
|
||||
void SVGPathElement::initialize(JS::Realm& realm)
|
||||
JS::ThrowCompletionOr<void> SVGPathElement::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::SVGPathElementPrototype>(realm, "SVGPathElement"));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
void SVGPathElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value)
|
||||
|
|
|
@ -26,7 +26,7 @@ public:
|
|||
private:
|
||||
SVGPathElement(DOM::Document&, DOM::QualifiedName);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
|
||||
Vector<PathInstruction> m_instructions;
|
||||
Optional<Gfx::Path> m_path;
|
||||
|
|
|
@ -16,10 +16,12 @@ SVGPolygonElement::SVGPolygonElement(DOM::Document& document, DOM::QualifiedName
|
|||
{
|
||||
}
|
||||
|
||||
void SVGPolygonElement::initialize(JS::Realm& realm)
|
||||
JS::ThrowCompletionOr<void> SVGPolygonElement::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::SVGPolygonElementPrototype>(realm, "SVGPolygonElement"));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
void SVGPolygonElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value)
|
||||
|
|
|
@ -23,7 +23,7 @@ public:
|
|||
private:
|
||||
SVGPolygonElement(DOM::Document&, DOM::QualifiedName);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
|
||||
Optional<Gfx::Path> m_path;
|
||||
|
||||
|
|
|
@ -16,10 +16,12 @@ SVGPolylineElement::SVGPolylineElement(DOM::Document& document, DOM::QualifiedNa
|
|||
{
|
||||
}
|
||||
|
||||
void SVGPolylineElement::initialize(JS::Realm& realm)
|
||||
JS::ThrowCompletionOr<void> SVGPolylineElement::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::SVGPolylineElementPrototype>(realm, "SVGPolylineElement"));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
void SVGPolylineElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value)
|
||||
|
|
|
@ -23,7 +23,7 @@ public:
|
|||
private:
|
||||
SVGPolylineElement(DOM::Document&, DOM::QualifiedName);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
|
||||
Optional<Gfx::Path> m_path;
|
||||
|
||||
|
|
|
@ -18,10 +18,12 @@ SVGRectElement::SVGRectElement(DOM::Document& document, DOM::QualifiedName quali
|
|||
{
|
||||
}
|
||||
|
||||
void SVGRectElement::initialize(JS::Realm& realm)
|
||||
JS::ThrowCompletionOr<void> SVGRectElement::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::SVGRectElementPrototype>(realm, "SVGRectElement"));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
void SVGRectElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value)
|
||||
|
|
|
@ -31,7 +31,7 @@ public:
|
|||
private:
|
||||
SVGRectElement(DOM::Document&, DOM::QualifiedName);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
|
||||
Gfx::FloatPoint calculate_used_corner_radius_values();
|
||||
|
||||
|
|
|
@ -22,10 +22,12 @@ SVGSVGElement::SVGSVGElement(DOM::Document& document, DOM::QualifiedName qualifi
|
|||
{
|
||||
}
|
||||
|
||||
void SVGSVGElement::initialize(JS::Realm& realm)
|
||||
JS::ThrowCompletionOr<void> SVGSVGElement::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::SVGSVGElementPrototype>(realm, "SVGSVGElement"));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
JS::GCPtr<Layout::Node> SVGSVGElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style)
|
||||
|
|
|
@ -28,7 +28,7 @@ public:
|
|||
private:
|
||||
SVGSVGElement(DOM::Document&, DOM::QualifiedName);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
|
||||
virtual bool is_svg_svg_element() const override { return true; }
|
||||
|
||||
|
|
|
@ -17,10 +17,12 @@ SVGTextContentElement::SVGTextContentElement(DOM::Document& document, DOM::Quali
|
|||
{
|
||||
}
|
||||
|
||||
void SVGTextContentElement::initialize(JS::Realm& realm)
|
||||
JS::ThrowCompletionOr<void> SVGTextContentElement::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::SVGTextContentElementPrototype>(realm, "SVGTextContentElement"));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
// https://svgwg.org/svg2-draft/text.html#__svg__SVGTextContentElement__getNumberOfChars
|
||||
|
|
|
@ -21,7 +21,7 @@ public:
|
|||
protected:
|
||||
SVGTextContentElement(DOM::Document&, DOM::QualifiedName);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue