mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 23:37:35 +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
|
@ -18,13 +18,15 @@ AudioConstructor::AudioConstructor(JS::Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void AudioConstructor::initialize(JS::Realm& realm)
|
||||
JS::ThrowCompletionOr<void> AudioConstructor::initialize(JS::Realm& realm)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
NativeFunction::initialize(realm);
|
||||
MUST_OR_THROW_OOM(NativeFunction::initialize(realm));
|
||||
|
||||
define_direct_property(vm.names.prototype, &ensure_web_prototype<Bindings::HTMLAudioElementPrototype>(realm, "HTMLAudioElement"), 0);
|
||||
define_direct_property(vm.names.length, JS::Value(0), JS::Attribute::Configurable);
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
JS::ThrowCompletionOr<JS::Value> AudioConstructor::call()
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Web::Bindings {
|
|||
class AudioConstructor final : public JS::NativeFunction {
|
||||
public:
|
||||
explicit AudioConstructor(JS::Realm&);
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
virtual ~AudioConstructor() override = default;
|
||||
|
||||
virtual JS::ThrowCompletionOr<JS::Value> call() override;
|
||||
|
|
|
@ -18,12 +18,14 @@ CSSNamespace::CSSNamespace(JS::Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void CSSNamespace::initialize(JS::Realm& realm)
|
||||
JS::ThrowCompletionOr<void> CSSNamespace::initialize(JS::Realm& realm)
|
||||
{
|
||||
Object::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Object::initialize(realm));
|
||||
u8 attr = JS::Attribute::Enumerable;
|
||||
define_native_function(realm, "escape", escape, 1, attr);
|
||||
define_native_function(realm, "supports", supports, 2, attr);
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
// https://www.w3.org/TR/cssom-1/#dom-css-escape
|
||||
|
|
|
@ -17,7 +17,7 @@ class CSSNamespace final : public JS::Object {
|
|||
|
||||
public:
|
||||
explicit CSSNamespace(JS::Realm&);
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
virtual ~CSSNamespace() override = default;
|
||||
|
||||
private:
|
||||
|
|
|
@ -18,13 +18,15 @@ ImageConstructor::ImageConstructor(JS::Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void ImageConstructor::initialize(JS::Realm& realm)
|
||||
JS::ThrowCompletionOr<void> ImageConstructor::initialize(JS::Realm& realm)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
|
||||
NativeFunction::initialize(realm);
|
||||
MUST_OR_THROW_OOM(NativeFunction::initialize(realm));
|
||||
define_direct_property(vm.names.prototype, &ensure_web_prototype<Bindings::HTMLImageElementPrototype>(realm, "HTMLImageElement"), 0);
|
||||
define_direct_property(vm.names.length, JS::Value(0), JS::Attribute::Configurable);
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
JS::ThrowCompletionOr<JS::Value> ImageConstructor::call()
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Web::Bindings {
|
|||
class ImageConstructor final : public JS::NativeFunction {
|
||||
public:
|
||||
explicit ImageConstructor(JS::Realm&);
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
virtual ~ImageConstructor() override = default;
|
||||
|
||||
virtual JS::ThrowCompletionOr<JS::Value> call() override;
|
||||
|
|
|
@ -20,13 +20,15 @@ OptionConstructor::OptionConstructor(JS::Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void OptionConstructor::initialize(JS::Realm& realm)
|
||||
JS::ThrowCompletionOr<void> OptionConstructor::initialize(JS::Realm& realm)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
|
||||
NativeFunction::initialize(realm);
|
||||
MUST_OR_THROW_OOM(NativeFunction::initialize(realm));
|
||||
define_direct_property(vm.names.prototype, &ensure_web_prototype<Bindings::HTMLOptionElementPrototype>(realm, "HTMLOptionElement"), 0);
|
||||
define_direct_property(vm.names.length, JS::Value(0), JS::Attribute::Configurable);
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
JS::ThrowCompletionOr<JS::Value> OptionConstructor::call()
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Web::Bindings {
|
|||
class OptionConstructor final : public JS::NativeFunction {
|
||||
public:
|
||||
explicit OptionConstructor(JS::Realm&);
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
virtual ~OptionConstructor() override = default;
|
||||
|
||||
virtual JS::ThrowCompletionOr<JS::Value> call() override;
|
||||
|
|
|
@ -27,13 +27,15 @@ JS::ThrowCompletionOr<JS::NonnullGCPtr<JS::Object>> WindowConstructor::construct
|
|||
return vm().throw_completion<JS::TypeError>(JS::ErrorType::NotAConstructor, "Window");
|
||||
}
|
||||
|
||||
void WindowConstructor::initialize(JS::Realm& realm)
|
||||
JS::ThrowCompletionOr<void> WindowConstructor::initialize(JS::Realm& realm)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
|
||||
NativeFunction::initialize(realm);
|
||||
MUST_OR_THROW_OOM(NativeFunction::initialize(realm));
|
||||
define_direct_property(vm.names.prototype, &ensure_web_prototype<Bindings::WindowPrototype>(realm, "Window"), 0);
|
||||
define_direct_property(vm.names.length, JS::Value(0), JS::Attribute::Configurable);
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ class WindowConstructor : public JS::NativeFunction {
|
|||
|
||||
public:
|
||||
explicit WindowConstructor(JS::Realm&);
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
virtual ~WindowConstructor() override;
|
||||
|
||||
virtual JS::ThrowCompletionOr<JS::Value> call() override;
|
||||
|
|
|
@ -14,10 +14,12 @@ WindowPrototype::WindowPrototype(JS::Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void WindowPrototype::initialize(JS::Realm& realm)
|
||||
JS::ThrowCompletionOr<void> WindowPrototype::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::EventTargetPrototype>(realm, "EventTarget"));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ public:
|
|||
explicit WindowPrototype(JS::Realm& realm);
|
||||
|
||||
private:
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -22,10 +22,12 @@ void CSSConditionRule::for_each_effective_style_rule(Function<void(CSSStyleRule
|
|||
CSSGroupingRule::for_each_effective_style_rule(callback);
|
||||
}
|
||||
|
||||
void CSSConditionRule::initialize(JS::Realm& realm)
|
||||
JS::ThrowCompletionOr<void> CSSConditionRule::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::CSSConditionRulePrototype>(realm, "CSSConditionRule"));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ public:
|
|||
protected:
|
||||
CSSConditionRule(JS::Realm&, CSSRuleList&);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -23,10 +23,12 @@ CSSFontFaceRule::CSSFontFaceRule(JS::Realm& realm, FontFace&& font_face)
|
|||
{
|
||||
}
|
||||
|
||||
void CSSFontFaceRule::initialize(JS::Realm& realm)
|
||||
JS::ThrowCompletionOr<void> CSSFontFaceRule::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::CSSFontFaceRulePrototype>(realm, "CSSFontFaceRule"));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
CSSStyleDeclaration* CSSFontFaceRule::style()
|
||||
|
|
|
@ -28,7 +28,7 @@ public:
|
|||
private:
|
||||
CSSFontFaceRule(JS::Realm&, FontFace&&);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
virtual DeprecatedString serialized() const override;
|
||||
|
||||
FontFace m_font_face;
|
||||
|
|
|
@ -22,10 +22,12 @@ CSSGroupingRule::CSSGroupingRule(JS::Realm& realm, CSSRuleList& rules)
|
|||
rule.set_parent_rule(this);
|
||||
}
|
||||
|
||||
void CSSGroupingRule::initialize(JS::Realm& realm)
|
||||
JS::ThrowCompletionOr<void> CSSGroupingRule::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::CSSGroupingRulePrototype>(realm, "CSSGroupingRule"));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
void CSSGroupingRule::visit_edges(Cell::Visitor& visitor)
|
||||
|
|
|
@ -33,7 +33,7 @@ public:
|
|||
protected:
|
||||
CSSGroupingRule(JS::Realm&, CSSRuleList&);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
||||
private:
|
||||
|
|
|
@ -39,10 +39,12 @@ CSSImportRule::CSSImportRule(AK::URL url, DOM::Document& document)
|
|||
set_resource(ResourceLoader::the().load_resource(Resource::Type::Generic, request));
|
||||
}
|
||||
|
||||
void CSSImportRule::initialize(JS::Realm& realm)
|
||||
JS::ThrowCompletionOr<void> CSSImportRule::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::CSSImportRulePrototype>(realm, "CSSImportRule"));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
void CSSImportRule::visit_edges(Cell::Visitor& visitor)
|
||||
|
|
|
@ -40,7 +40,7 @@ public:
|
|||
private:
|
||||
CSSImportRule(AK::URL, DOM::Document&);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
||||
virtual DeprecatedString serialized() const override;
|
||||
|
|
|
@ -23,10 +23,12 @@ CSSMediaRule::CSSMediaRule(JS::Realm& realm, MediaList& media, CSSRuleList& rule
|
|||
{
|
||||
}
|
||||
|
||||
void CSSMediaRule::initialize(JS::Realm& realm)
|
||||
JS::ThrowCompletionOr<void> CSSMediaRule::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::CSSMediaRulePrototype>(realm, "CSSMediaRule"));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
void CSSMediaRule::visit_edges(Cell::Visitor& visitor)
|
||||
|
|
|
@ -35,7 +35,7 @@ public:
|
|||
private:
|
||||
CSSMediaRule(JS::Realm&, MediaList&, CSSRuleList&);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
virtual DeprecatedString serialized() const override;
|
||||
|
||||
|
|
|
@ -35,10 +35,12 @@ CSSRuleList* CSSRuleList::create_empty(JS::Realm& realm)
|
|||
return realm.heap().allocate<CSSRuleList>(realm, realm);
|
||||
}
|
||||
|
||||
void CSSRuleList::initialize(JS::Realm& realm)
|
||||
JS::ThrowCompletionOr<void> CSSRuleList::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::CSSRuleListPrototype>(realm, "CSSRuleList"));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
void CSSRuleList::visit_edges(Cell::Visitor& visitor)
|
||||
|
|
|
@ -66,7 +66,7 @@ public:
|
|||
private:
|
||||
explicit CSSRuleList(JS::Realm&);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
||||
Vector<CSSRule&> m_rules;
|
||||
|
|
|
@ -23,10 +23,12 @@ CSSStyleRule::CSSStyleRule(JS::Realm& realm, NonnullRefPtrVector<Selector>&& sel
|
|||
{
|
||||
}
|
||||
|
||||
void CSSStyleRule::initialize(JS::Realm& realm)
|
||||
JS::ThrowCompletionOr<void> CSSStyleRule::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::CSSStyleRulePrototype>(realm, "CSSStyleRule"));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
void CSSStyleRule::visit_edges(Cell::Visitor& visitor)
|
||||
|
|
|
@ -36,7 +36,7 @@ public:
|
|||
private:
|
||||
CSSStyleRule(JS::Realm&, NonnullRefPtrVector<Selector>&&, CSSStyleDeclaration&);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
virtual DeprecatedString serialized() const override;
|
||||
|
||||
|
|
|
@ -30,10 +30,12 @@ CSSStyleSheet::CSSStyleSheet(JS::Realm& realm, CSSRuleList& rules, MediaList& me
|
|||
rule.set_parent_style_sheet(this);
|
||||
}
|
||||
|
||||
void CSSStyleSheet::initialize(JS::Realm& realm)
|
||||
JS::ThrowCompletionOr<void> CSSStyleSheet::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::CSSStyleSheetPrototype>(realm, "CSSStyleSheet"));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
void CSSStyleSheet::visit_edges(Cell::Visitor& visitor)
|
||||
|
|
|
@ -52,7 +52,7 @@ public:
|
|||
private:
|
||||
CSSStyleSheet(JS::Realm&, CSSRuleList&, MediaList&, Optional<AK::URL> location);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
||||
CSSRuleList* m_rules { nullptr };
|
||||
|
|
|
@ -22,10 +22,12 @@ CSSSupportsRule::CSSSupportsRule(JS::Realm& realm, NonnullRefPtr<Supports>&& sup
|
|||
{
|
||||
}
|
||||
|
||||
void CSSSupportsRule::initialize(JS::Realm& realm)
|
||||
JS::ThrowCompletionOr<void> CSSSupportsRule::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::CSSSupportsRulePrototype>(realm, "CSSSupportsRule"));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
DeprecatedString CSSSupportsRule::condition_text() const
|
||||
|
|
|
@ -33,7 +33,7 @@ public:
|
|||
private:
|
||||
CSSSupportsRule(JS::Realm&, NonnullRefPtr<Supports>&&, CSSRuleList&);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
virtual DeprecatedString serialized() const override;
|
||||
|
||||
NonnullRefPtr<Supports> m_supports;
|
||||
|
|
|
@ -23,10 +23,12 @@ MediaList::MediaList(JS::Realm& realm, NonnullRefPtrVector<MediaQuery>&& media)
|
|||
{
|
||||
}
|
||||
|
||||
void MediaList::initialize(JS::Realm& realm)
|
||||
JS::ThrowCompletionOr<void> MediaList::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::MediaListPrototype>(realm, "MediaList"));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
// https://www.w3.org/TR/cssom-1/#dom-medialist-mediatext
|
||||
|
|
|
@ -39,7 +39,7 @@ public:
|
|||
private:
|
||||
MediaList(JS::Realm&, NonnullRefPtrVector<MediaQuery>&&);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
|
||||
NonnullRefPtrVector<MediaQuery> m_media;
|
||||
};
|
||||
|
|
|
@ -28,10 +28,12 @@ MediaQueryList::MediaQueryList(DOM::Document& document, NonnullRefPtrVector<Medi
|
|||
evaluate();
|
||||
}
|
||||
|
||||
void MediaQueryList::initialize(JS::Realm& realm)
|
||||
JS::ThrowCompletionOr<void> MediaQueryList::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::MediaQueryListPrototype>(realm, "MediaQueryList"));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
void MediaQueryList::visit_edges(Cell::Visitor& visitor)
|
||||
|
|
|
@ -34,7 +34,7 @@ public:
|
|||
private:
|
||||
MediaQueryList(DOM::Document&, NonnullRefPtrVector<MediaQuery>&&);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
||||
JS::NonnullGCPtr<DOM::Document> m_document;
|
||||
|
|
|
@ -24,10 +24,12 @@ MediaQueryListEvent::MediaQueryListEvent(JS::Realm& realm, DeprecatedFlyString c
|
|||
|
||||
MediaQueryListEvent::~MediaQueryListEvent() = default;
|
||||
|
||||
void MediaQueryListEvent::initialize(JS::Realm& realm)
|
||||
JS::ThrowCompletionOr<void> MediaQueryListEvent::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::MediaQueryListEventPrototype>(realm, "MediaQueryListEvent"));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ public:
|
|||
private:
|
||||
MediaQueryListEvent(JS::Realm&, DeprecatedFlyString const& event_name, MediaQueryListEventInit const& event_init);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
|
||||
DeprecatedString m_media;
|
||||
bool m_matches;
|
||||
|
|
|
@ -24,10 +24,12 @@ Screen::Screen(HTML::Window& window)
|
|||
{
|
||||
}
|
||||
|
||||
void Screen::initialize(JS::Realm& realm)
|
||||
JS::ThrowCompletionOr<void> Screen::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::ScreenPrototype>(realm, "Screen"));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
void Screen::visit_edges(Cell::Visitor& visitor)
|
||||
|
|
|
@ -29,7 +29,7 @@ public:
|
|||
private:
|
||||
explicit Screen(HTML::Window&);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
||||
HTML::Window const& window() const { return *m_window; }
|
||||
|
|
|
@ -57,10 +57,12 @@ StyleSheetList::StyleSheetList(DOM::Document& document)
|
|||
{
|
||||
}
|
||||
|
||||
void StyleSheetList::initialize(JS::Realm& realm)
|
||||
JS::ThrowCompletionOr<void> StyleSheetList::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::StyleSheetListPrototype>(realm, "StyleSheetList"));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
void StyleSheetList::visit_edges(Cell::Visitor& visitor)
|
||||
|
|
|
@ -41,7 +41,7 @@ public:
|
|||
private:
|
||||
explicit StyleSheetList(DOM::Document&);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
||||
void sort_sheets();
|
||||
|
|
|
@ -26,11 +26,13 @@ Crypto::Crypto(JS::Realm& realm)
|
|||
|
||||
Crypto::~Crypto() = default;
|
||||
|
||||
void Crypto::initialize(JS::Realm& realm)
|
||||
JS::ThrowCompletionOr<void> Crypto::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::CryptoPrototype>(realm, "Crypto"));
|
||||
m_subtle = SubtleCrypto::create(realm);
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
JS::NonnullGCPtr<SubtleCrypto> Crypto::subtle() const
|
||||
|
|
|
@ -26,7 +26,7 @@ public:
|
|||
DeprecatedString random_uuid() const;
|
||||
|
||||
protected:
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
||||
private:
|
||||
|
|
|
@ -26,10 +26,12 @@ SubtleCrypto::SubtleCrypto(JS::Realm& realm)
|
|||
|
||||
SubtleCrypto::~SubtleCrypto() = default;
|
||||
|
||||
void SubtleCrypto::initialize(JS::Realm& realm)
|
||||
JS::ThrowCompletionOr<void> SubtleCrypto::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::SubtleCryptoPrototype>(realm, "SubtleCrypto"));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
// https://w3c.github.io/webcrypto/#dfn-SubtleCrypto-method-digest
|
||||
|
|
|
@ -23,7 +23,7 @@ public:
|
|||
|
||||
private:
|
||||
explicit SubtleCrypto(JS::Realm&);
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -25,10 +25,12 @@ AbortController::AbortController(JS::Realm& realm, JS::NonnullGCPtr<AbortSignal>
|
|||
|
||||
AbortController::~AbortController() = default;
|
||||
|
||||
void AbortController::initialize(JS::Realm& realm)
|
||||
JS::ThrowCompletionOr<void> AbortController::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::AbortControllerPrototype>(realm, "AbortController"));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
void AbortController::visit_edges(Cell::Visitor& visitor)
|
||||
|
|
|
@ -28,7 +28,7 @@ public:
|
|||
private:
|
||||
AbortController(JS::Realm&, JS::NonnullGCPtr<AbortSignal>);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
||||
// https://dom.spec.whatwg.org/#abortcontroller-signal
|
||||
|
|
|
@ -22,10 +22,12 @@ AbortSignal::AbortSignal(JS::Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void AbortSignal::initialize(JS::Realm& realm)
|
||||
JS::ThrowCompletionOr<void> AbortSignal::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::AbortSignalPrototype>(realm, "AbortSignal"));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#abortsignal-add
|
||||
|
|
|
@ -43,7 +43,7 @@ public:
|
|||
private:
|
||||
explicit AbortSignal(JS::Realm&);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(JS::Cell::Visitor&) override;
|
||||
|
||||
// https://dom.spec.whatwg.org/#abortsignal-abort-reason
|
||||
|
|
|
@ -21,10 +21,12 @@ AbstractRange::AbstractRange(Node& start_container, u32 start_offset, Node& end_
|
|||
|
||||
AbstractRange::~AbstractRange() = default;
|
||||
|
||||
void AbstractRange::initialize(JS::Realm& realm)
|
||||
JS::ThrowCompletionOr<void> AbstractRange::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::AbstractRangePrototype>(realm, "AbstractRange"));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
void AbstractRange::visit_edges(Cell::Visitor& visitor)
|
||||
|
|
|
@ -36,7 +36,7 @@ public:
|
|||
protected:
|
||||
AbstractRange(Node& start_container, u32 start_offset, Node& end_container, u32 end_offset);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
||||
JS::NonnullGCPtr<Node> m_start_container;
|
||||
|
|
|
@ -31,10 +31,12 @@ Attr::Attr(Document& document, QualifiedName qualified_name, DeprecatedString va
|
|||
{
|
||||
}
|
||||
|
||||
void Attr::initialize(JS::Realm& realm)
|
||||
JS::ThrowCompletionOr<void> Attr::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::AttrPrototype>(realm, "Attr"));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
void Attr::visit_edges(Cell::Visitor& visitor)
|
||||
|
|
|
@ -45,7 +45,7 @@ public:
|
|||
private:
|
||||
Attr(Document&, QualifiedName, DeprecatedString value, Element const*);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
||||
QualifiedName m_qualified_name;
|
||||
|
|
|
@ -16,10 +16,12 @@ CDATASection::CDATASection(Document& document, DeprecatedString const& data)
|
|||
|
||||
CDATASection::~CDATASection() = default;
|
||||
|
||||
void CDATASection::initialize(JS::Realm& realm)
|
||||
JS::ThrowCompletionOr<void> CDATASection::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::CDATASectionPrototype>(realm, "CDATASection"));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ public:
|
|||
private:
|
||||
CDATASection(Document&, DeprecatedString const&);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
};
|
||||
|
||||
template<>
|
||||
|
|
|
@ -19,10 +19,12 @@ CharacterData::CharacterData(Document& document, NodeType type, DeprecatedString
|
|||
{
|
||||
}
|
||||
|
||||
void CharacterData::initialize(JS::Realm& realm)
|
||||
JS::ThrowCompletionOr<void> CharacterData::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::CharacterDataPrototype>(realm, "CharacterData"));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-characterdata-data
|
||||
|
|
|
@ -36,7 +36,7 @@ public:
|
|||
protected:
|
||||
CharacterData(Document&, NodeType, DeprecatedString const&);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
|
||||
private:
|
||||
DeprecatedString m_data;
|
||||
|
|
|
@ -29,10 +29,12 @@ CustomEvent::CustomEvent(JS::Realm& realm, DeprecatedFlyString const& event_name
|
|||
|
||||
CustomEvent::~CustomEvent() = default;
|
||||
|
||||
void CustomEvent::initialize(JS::Realm& realm)
|
||||
JS::ThrowCompletionOr<void> CustomEvent::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::CustomEventPrototype>(realm, "CustomEvent"));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
void CustomEvent::visit_edges(JS::Cell::Visitor& visitor)
|
||||
|
|
|
@ -28,7 +28,7 @@ public:
|
|||
// https://dom.spec.whatwg.org/#dom-customevent-detail
|
||||
JS::Value detail() const { return m_detail; }
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(JS::Cell::Visitor&) override;
|
||||
|
||||
void init_custom_event(DeprecatedString const& type, bool bubbles, bool cancelable, JS::Value detail);
|
||||
|
|
|
@ -31,10 +31,12 @@ DOMImplementation::DOMImplementation(Document& document)
|
|||
|
||||
DOMImplementation::~DOMImplementation() = default;
|
||||
|
||||
void DOMImplementation::initialize(JS::Realm& realm)
|
||||
JS::ThrowCompletionOr<void> DOMImplementation::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::DOMImplementationPrototype>(realm, "DOMImplementation"));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
void DOMImplementation::visit_edges(Cell::Visitor& visitor)
|
||||
|
|
|
@ -30,7 +30,7 @@ public:
|
|||
private:
|
||||
explicit DOMImplementation(Document&);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
||||
Document& document() { return m_document; }
|
||||
|
|
|
@ -68,10 +68,12 @@ DOMTokenList::DOMTokenList(Element const& associated_element, DeprecatedFlyStrin
|
|||
associated_attribute_changed(value);
|
||||
}
|
||||
|
||||
void DOMTokenList::initialize(JS::Realm& realm)
|
||||
JS::ThrowCompletionOr<void> DOMTokenList::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::DOMTokenListPrototype>(realm, "DOMTokenList"));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
void DOMTokenList::visit_edges(Cell::Visitor& visitor)
|
||||
|
|
|
@ -45,7 +45,7 @@ public:
|
|||
private:
|
||||
DOMTokenList(Element const& associated_element, DeprecatedFlyString associated_attribute);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
||||
WebIDL::ExceptionOr<void> validate_token(StringView token) const;
|
||||
|
|
|
@ -314,10 +314,12 @@ Document::~Document()
|
|||
HTML::main_thread_event_loop().unregister_document({}, *this);
|
||||
}
|
||||
|
||||
void Document::initialize(JS::Realm& realm)
|
||||
JS::ThrowCompletionOr<void> Document::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::DocumentPrototype>(realm, "Document"));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
void Document::visit_edges(Cell::Visitor& visitor)
|
||||
|
|
|
@ -450,7 +450,7 @@ public:
|
|||
DeprecatedString dump_accessibility_tree_as_json();
|
||||
|
||||
protected:
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
||||
private:
|
||||
|
|
|
@ -14,10 +14,12 @@ DocumentFragment::DocumentFragment(Document& document)
|
|||
{
|
||||
}
|
||||
|
||||
void DocumentFragment::initialize(JS::Realm& realm)
|
||||
JS::ThrowCompletionOr<void> DocumentFragment::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::DocumentFragmentPrototype>(realm, "DocumentFragment"));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
void DocumentFragment::visit_edges(Cell::Visitor& visitor)
|
||||
|
|
|
@ -33,7 +33,7 @@ public:
|
|||
protected:
|
||||
explicit DocumentFragment(Document& document);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
||||
private:
|
||||
|
|
|
@ -19,10 +19,12 @@ DocumentType::DocumentType(Document& document)
|
|||
{
|
||||
}
|
||||
|
||||
void DocumentType::initialize(JS::Realm& realm)
|
||||
JS::ThrowCompletionOr<void> DocumentType::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::DocumentTypePrototype>(realm, "DocumentType"));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ public:
|
|||
private:
|
||||
explicit DocumentType(Document&);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
|
||||
DeprecatedString m_name;
|
||||
DeprecatedString m_public_id;
|
||||
|
|
|
@ -61,12 +61,14 @@ Element::Element(Document& document, DOM::QualifiedName qualified_name)
|
|||
|
||||
Element::~Element() = default;
|
||||
|
||||
void Element::initialize(JS::Realm& realm)
|
||||
JS::ThrowCompletionOr<void> Element::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::ElementPrototype>(realm, "Element"));
|
||||
|
||||
m_attributes = NamedNodeMap::create(*this);
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
void Element::visit_edges(Cell::Visitor& visitor)
|
||||
|
|
|
@ -251,7 +251,7 @@ public:
|
|||
|
||||
protected:
|
||||
Element(Document&, DOM::QualifiedName);
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
|
||||
virtual void children_changed() override;
|
||||
virtual i32 default_tab_index_value() const;
|
||||
|
|
|
@ -41,10 +41,12 @@ Event::Event(JS::Realm& realm, DeprecatedFlyString const& type, EventInit const&
|
|||
{
|
||||
}
|
||||
|
||||
void Event::initialize(JS::Realm& realm)
|
||||
JS::ThrowCompletionOr<void> Event::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::EventPrototype>(realm, "Event"));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
void Event::visit_edges(Visitor& visitor)
|
||||
|
|
|
@ -146,7 +146,7 @@ public:
|
|||
protected:
|
||||
void initialize_event(DeprecatedString const&, bool, bool);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(Visitor&) override;
|
||||
|
||||
private:
|
||||
|
|
|
@ -27,10 +27,12 @@ HTMLCollection::HTMLCollection(ParentNode& root, Function<bool(Element const&)>
|
|||
|
||||
HTMLCollection::~HTMLCollection() = default;
|
||||
|
||||
void HTMLCollection::initialize(JS::Realm& realm)
|
||||
JS::ThrowCompletionOr<void> HTMLCollection::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLCollectionPrototype>(realm, "HTMLCollection"));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
void HTMLCollection::visit_edges(Cell::Visitor& visitor)
|
||||
|
|
|
@ -47,7 +47,7 @@ public:
|
|||
protected:
|
||||
HTMLCollection(ParentNode& root, Function<bool(Element const&)> filter);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
|
||||
JS::NonnullGCPtr<ParentNode> root() { return *m_root; }
|
||||
|
||||
|
|
|
@ -31,10 +31,12 @@ MutationObserver::MutationObserver(JS::Realm& realm, JS::GCPtr<WebIDL::CallbackT
|
|||
|
||||
MutationObserver::~MutationObserver() = default;
|
||||
|
||||
void MutationObserver::initialize(JS::Realm& realm)
|
||||
JS::ThrowCompletionOr<void> MutationObserver::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::MutationObserverPrototype>(realm, "MutationObserver"));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
void MutationObserver::visit_edges(Cell::Visitor& visitor)
|
||||
|
|
|
@ -52,7 +52,7 @@ public:
|
|||
private:
|
||||
MutationObserver(JS::Realm&, JS::GCPtr<WebIDL::CallbackType>);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
||||
// https://dom.spec.whatwg.org/#concept-mo-callback
|
||||
|
|
|
@ -33,10 +33,12 @@ MutationRecord::MutationRecord(JS::Realm& realm, DeprecatedFlyString const& type
|
|||
|
||||
MutationRecord::~MutationRecord() = default;
|
||||
|
||||
void MutationRecord::initialize(JS::Realm& realm)
|
||||
JS::ThrowCompletionOr<void> MutationRecord::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::MutationRecordPrototype>(realm, "MutationRecord"));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
void MutationRecord::visit_edges(Cell::Visitor& visitor)
|
||||
|
|
|
@ -32,7 +32,7 @@ public:
|
|||
private:
|
||||
MutationRecord(JS::Realm& realm, DeprecatedFlyString const& type, Node& target, NodeList& added_nodes, NodeList& removed_nodes, Node* previous_sibling, Node* next_sibling, DeprecatedString const& attribute_name, DeprecatedString const& attribute_namespace, DeprecatedString const& old_value);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
||||
DeprecatedFlyString m_type;
|
||||
|
|
|
@ -25,10 +25,12 @@ NamedNodeMap::NamedNodeMap(Element& element)
|
|||
{
|
||||
}
|
||||
|
||||
void NamedNodeMap::initialize(JS::Realm& realm)
|
||||
JS::ThrowCompletionOr<void> NamedNodeMap::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::NamedNodeMapPrototype>(realm, "NamedNodeMap"));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
void NamedNodeMap::visit_edges(Cell::Visitor& visitor)
|
||||
|
|
|
@ -56,7 +56,7 @@ public:
|
|||
private:
|
||||
explicit NamedNodeMap(Element&);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
||||
Element& associated_element() { return *m_element; }
|
||||
|
|
|
@ -21,10 +21,12 @@ NodeIterator::NodeIterator(Node& root)
|
|||
|
||||
NodeIterator::~NodeIterator() = default;
|
||||
|
||||
void NodeIterator::initialize(JS::Realm& realm)
|
||||
JS::ThrowCompletionOr<void> NodeIterator::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::NodeIteratorPrototype>(realm, "NodeIterator"));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
void NodeIterator::finalize()
|
||||
|
|
|
@ -37,7 +37,7 @@ public:
|
|||
private:
|
||||
explicit NodeIterator(Node& root);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
virtual void finalize() override;
|
||||
|
||||
|
|
|
@ -17,10 +17,12 @@ NodeList::NodeList(JS::Realm& realm)
|
|||
|
||||
NodeList::~NodeList() = default;
|
||||
|
||||
void NodeList::initialize(JS::Realm& realm)
|
||||
JS::ThrowCompletionOr<void> NodeList::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::NodeListPrototype>(realm, "NodeList"));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
JS::Value NodeList::item_value(size_t index) const
|
||||
|
|
|
@ -27,7 +27,7 @@ public:
|
|||
protected:
|
||||
explicit NodeList(JS::Realm&);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -17,10 +17,12 @@ ProcessingInstruction::ProcessingInstruction(Document& document, DeprecatedStrin
|
|||
{
|
||||
}
|
||||
|
||||
void ProcessingInstruction::initialize(JS::Realm& realm)
|
||||
JS::ThrowCompletionOr<void> ProcessingInstruction::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::ProcessingInstructionPrototype>(realm, "ProcessingInstruction"));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ public:
|
|||
private:
|
||||
ProcessingInstruction(Document&, DeprecatedString const& data, DeprecatedString const& target);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
|
||||
DeprecatedString m_target;
|
||||
};
|
||||
|
|
|
@ -66,10 +66,12 @@ Range::~Range()
|
|||
live_ranges().remove(this);
|
||||
}
|
||||
|
||||
void Range::initialize(JS::Realm& realm)
|
||||
JS::ThrowCompletionOr<void> Range::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::RangePrototype>(realm, "Range"));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
void Range::visit_edges(Cell::Visitor& visitor)
|
||||
|
|
|
@ -93,7 +93,7 @@ private:
|
|||
explicit Range(Document&);
|
||||
Range(Node& start_container, u32 start_offset, Node& end_container, u32 end_offset);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
||||
Node& root();
|
||||
|
|
|
@ -35,10 +35,12 @@ WebIDL::ExceptionOr<StaticRange*> StaticRange::construct_impl(JS::Realm& realm,
|
|||
return realm.heap().allocate<StaticRange>(realm, *init.start_container, init.start_offset, *init.end_container, init.end_offset).ptr();
|
||||
}
|
||||
|
||||
void StaticRange::initialize(JS::Realm& realm)
|
||||
JS::ThrowCompletionOr<void> StaticRange::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::StaticRangePrototype>(realm, "StaticRange"));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ public:
|
|||
StaticRange(Node& start_container, u32 start_offset, Node& end_container, u32 end_offset);
|
||||
virtual ~StaticRange() override;
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -24,10 +24,12 @@ Text::Text(Document& document, NodeType type, DeprecatedString const& data)
|
|||
{
|
||||
}
|
||||
|
||||
void Text::initialize(JS::Realm& realm)
|
||||
JS::ThrowCompletionOr<void> Text::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::TextPrototype>(realm, "Text"));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
void Text::visit_edges(Cell::Visitor& visitor)
|
||||
|
|
|
@ -38,7 +38,7 @@ protected:
|
|||
Text(Document&, DeprecatedString const&);
|
||||
Text(Document&, NodeType, DeprecatedString const&);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
||||
private:
|
||||
|
|
|
@ -22,10 +22,12 @@ TreeWalker::TreeWalker(Node& root)
|
|||
|
||||
TreeWalker::~TreeWalker() = default;
|
||||
|
||||
void TreeWalker::initialize(JS::Realm& realm)
|
||||
JS::ThrowCompletionOr<void> TreeWalker::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::TreeWalkerPrototype>(realm, "TreeWalker"));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
void TreeWalker::visit_edges(Cell::Visitor& visitor)
|
||||
|
|
|
@ -39,7 +39,7 @@ public:
|
|||
private:
|
||||
explicit TreeWalker(Node& root);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
||||
enum class ChildTraversalType {
|
||||
|
|
|
@ -32,10 +32,12 @@ XMLSerializer::XMLSerializer(JS::Realm& realm)
|
|||
|
||||
XMLSerializer::~XMLSerializer() = default;
|
||||
|
||||
void XMLSerializer::initialize(JS::Realm& realm)
|
||||
JS::ThrowCompletionOr<void> XMLSerializer::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::XMLSerializerPrototype>(realm, "XMLSerializer"));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
// https://w3c.github.io/DOM-Parsing/#dom-xmlserializer-serializetostring
|
||||
|
|
|
@ -23,7 +23,7 @@ public:
|
|||
private:
|
||||
explicit XMLSerializer(JS::Realm&);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
};
|
||||
|
||||
enum class RequireWellFormed {
|
||||
|
|
|
@ -33,10 +33,12 @@ TextDecoder::TextDecoder(JS::Realm& realm, TextCodec::Decoder& decoder, Deprecat
|
|||
|
||||
TextDecoder::~TextDecoder() = default;
|
||||
|
||||
void TextDecoder::initialize(JS::Realm& realm)
|
||||
JS::ThrowCompletionOr<void> TextDecoder::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::TextDecoderPrototype>(realm, "TextDecoder"));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
// https://encoding.spec.whatwg.org/#dom-textdecoder-decode
|
||||
|
|
|
@ -35,7 +35,7 @@ private:
|
|||
// https://encoding.spec.whatwg.org/#dom-textdecoder
|
||||
TextDecoder(JS::Realm&, TextCodec::Decoder&, DeprecatedFlyString encoding, bool fatal, bool ignore_bom);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
|
||||
TextCodec::Decoder& m_decoder;
|
||||
DeprecatedFlyString m_encoding;
|
||||
|
|
|
@ -23,10 +23,12 @@ TextEncoder::TextEncoder(JS::Realm& realm)
|
|||
|
||||
TextEncoder::~TextEncoder() = default;
|
||||
|
||||
void TextEncoder::initialize(JS::Realm& realm)
|
||||
JS::ThrowCompletionOr<void> TextEncoder::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::TextEncoderPrototype>(realm, "TextEncoder"));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
// https://encoding.spec.whatwg.org/#dom-textencoder-encode
|
||||
|
|
|
@ -32,7 +32,7 @@ protected:
|
|||
// https://encoding.spec.whatwg.org/#dom-textencoder
|
||||
explicit TextEncoder(JS::Realm&);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue