LibWeb: Move setting of Web object prototypes to initialize()

This needs to happen before prototype/constructor intitialization can be
made lazy. Otherwise, GC could run during the C++ constructor and try to
collect the object currently being created.
This commit is contained in:
Timothy Flynn 2023-01-10 06:28:20 -05:00 committed by Andreas Kling
parent 7bd8fd000f
commit 834202aeb9
Notes: sideshowbarker 2024-07-17 01:51:10 +09:00
339 changed files with 1294 additions and 187 deletions

View file

@ -24,7 +24,6 @@ namespace Web::Bindings {
LocationObject::LocationObject(JS::Realm& realm)
: PlatformObject(realm)
{
set_prototype(&cached_web_prototype(realm, "Location"));
}
LocationObject::~LocationObject() = default;
@ -41,6 +40,8 @@ void LocationObject::initialize(JS::Realm& realm)
auto& vm = this->vm();
Object::initialize(realm);
set_prototype(&ensure_web_prototype<LocationPrototype>(realm, "Location"));
u8 attr = JS::Attribute::Writable | JS::Attribute::Enumerable;
define_native_accessor(realm, "href", href_getter, href_setter, attr);
define_native_accessor(realm, "host", host_getter, {}, attr);

View file

@ -14,7 +14,6 @@ namespace Web::CSS {
CSSConditionRule::CSSConditionRule(JS::Realm& realm, CSSRuleList& rules)
: CSSGroupingRule(realm, rules)
{
set_prototype(&Bindings::ensure_web_prototype<Bindings::CSSConditionRulePrototype>(realm, "CSSConditionRule"));
}
void CSSConditionRule::for_each_effective_style_rule(Function<void(CSSStyleRule const&)> const& callback) const
@ -23,4 +22,10 @@ void CSSConditionRule::for_each_effective_style_rule(Function<void(CSSStyleRule
CSSGroupingRule::for_each_effective_style_rule(callback);
}
void CSSConditionRule::initialize(JS::Realm& realm)
{
Base::initialize(realm);
set_prototype(&Bindings::ensure_web_prototype<Bindings::CSSConditionRulePrototype>(realm, "CSSConditionRule"));
}
}

View file

@ -26,6 +26,8 @@ public:
protected:
CSSConditionRule(JS::Realm&, CSSRuleList&);
virtual void initialize(JS::Realm&) override;
};
}

View file

@ -21,6 +21,11 @@ CSSFontFaceRule::CSSFontFaceRule(JS::Realm& realm, FontFace&& font_face)
: CSSRule(realm)
, m_font_face(move(font_face))
{
}
void CSSFontFaceRule::initialize(JS::Realm& realm)
{
Base::initialize(realm);
set_prototype(&Bindings::ensure_web_prototype<Bindings::CSSFontFaceRulePrototype>(realm, "CSSFontFaceRule"));
}

View file

@ -28,6 +28,7 @@ public:
private:
CSSFontFaceRule(JS::Realm&, FontFace&&);
virtual void initialize(JS::Realm&) override;
virtual DeprecatedString serialized() const override;
FontFace m_font_face;

View file

@ -18,11 +18,16 @@ CSSGroupingRule::CSSGroupingRule(JS::Realm& realm, CSSRuleList& rules)
: CSSRule(realm)
, m_rules(rules)
{
set_prototype(&Bindings::ensure_web_prototype<Bindings::CSSGroupingRulePrototype>(realm, "CSSGroupingRule"));
for (auto& rule : m_rules)
rule.set_parent_rule(this);
}
void CSSGroupingRule::initialize(JS::Realm& realm)
{
Base::initialize(realm);
set_prototype(&Bindings::ensure_web_prototype<Bindings::CSSGroupingRulePrototype>(realm, "CSSGroupingRule"));
}
void CSSGroupingRule::visit_edges(Cell::Visitor& visitor)
{
Base::visit_edges(visitor);

View file

@ -32,6 +32,8 @@ public:
protected:
CSSGroupingRule(JS::Realm&, CSSRuleList&);
virtual void initialize(JS::Realm&) override;
virtual void visit_edges(Cell::Visitor&) override;
private:

View file

@ -29,8 +29,6 @@ CSSImportRule::CSSImportRule(AK::URL url, DOM::Document& document)
, m_url(move(url))
, m_document(document)
{
set_prototype(&Bindings::ensure_web_prototype<Bindings::CSSImportRulePrototype>(document.realm(), "CSSImportRule"));
dbgln_if(CSS_LOADER_DEBUG, "CSSImportRule: Loading import URL: {}", m_url);
auto request = LoadRequest::create_for_url_on_page(m_url, document.page());
@ -41,6 +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)
{
Base::initialize(realm);
set_prototype(&Bindings::ensure_web_prototype<Bindings::CSSImportRulePrototype>(realm, "CSSImportRule"));
}
void CSSImportRule::visit_edges(Cell::Visitor& visitor)
{
Base::visit_edges(visitor);

View file

@ -40,6 +40,7 @@ public:
private:
CSSImportRule(AK::URL, DOM::Document&);
virtual void initialize(JS::Realm&) override;
virtual void visit_edges(Cell::Visitor&) override;
virtual DeprecatedString serialized() const override;

View file

@ -21,6 +21,11 @@ CSSMediaRule::CSSMediaRule(JS::Realm& realm, MediaList& media, CSSRuleList& rule
: CSSConditionRule(realm, rules)
, m_media(media)
{
}
void CSSMediaRule::initialize(JS::Realm& realm)
{
Base::initialize(realm);
set_prototype(&Bindings::ensure_web_prototype<Bindings::CSSMediaRulePrototype>(realm, "CSSMediaRule"));
}

View file

@ -35,6 +35,7 @@ public:
private:
CSSMediaRule(JS::Realm&, MediaList&, CSSRuleList&);
virtual void initialize(JS::Realm&) override;
virtual void visit_edges(Cell::Visitor&) override;
virtual DeprecatedString serialized() const override;

View file

@ -21,6 +21,11 @@ CSSStyleRule::CSSStyleRule(JS::Realm& realm, NonnullRefPtrVector<Selector>&& sel
, m_selectors(move(selectors))
, m_declaration(declaration)
{
}
void CSSStyleRule::initialize(JS::Realm& realm)
{
Base::initialize(realm);
set_prototype(&Bindings::ensure_web_prototype<Bindings::CSSStyleRulePrototype>(realm, "CSSStyleRule"));
}

View file

@ -36,6 +36,7 @@ public:
private:
CSSStyleRule(JS::Realm&, NonnullRefPtrVector<Selector>&&, CSSStyleDeclaration&);
virtual void initialize(JS::Realm&) override;
virtual void visit_edges(Cell::Visitor&) override;
virtual DeprecatedString serialized() const override;

View file

@ -23,8 +23,6 @@ CSSStyleSheet::CSSStyleSheet(JS::Realm& realm, CSSRuleList& rules, MediaList& me
: StyleSheet(realm, media)
, m_rules(&rules)
{
set_prototype(&Bindings::ensure_web_prototype<Bindings::CSSStyleSheetPrototype>(realm, "CSSStyleSheet"));
if (location.has_value())
set_location(location->to_deprecated_string());
@ -32,6 +30,12 @@ CSSStyleSheet::CSSStyleSheet(JS::Realm& realm, CSSRuleList& rules, MediaList& me
rule.set_parent_style_sheet(this);
}
void CSSStyleSheet::initialize(JS::Realm& realm)
{
Base::initialize(realm);
set_prototype(&Bindings::ensure_web_prototype<Bindings::CSSStyleSheetPrototype>(realm, "CSSStyleSheet"));
}
void CSSStyleSheet::visit_edges(Cell::Visitor& visitor)
{
Base::visit_edges(visitor);

View file

@ -52,6 +52,7 @@ public:
private:
CSSStyleSheet(JS::Realm&, CSSRuleList&, MediaList&, Optional<AK::URL> location);
virtual void initialize(JS::Realm&) override;
virtual void visit_edges(Cell::Visitor&) override;
CSSRuleList* m_rules { nullptr };

View file

@ -20,6 +20,11 @@ CSSSupportsRule::CSSSupportsRule(JS::Realm& realm, NonnullRefPtr<Supports>&& sup
: CSSConditionRule(realm, rules)
, m_supports(move(supports))
{
}
void CSSSupportsRule::initialize(JS::Realm& realm)
{
Base::initialize(realm);
set_prototype(&Bindings::ensure_web_prototype<Bindings::CSSSupportsRulePrototype>(realm, "CSSSupportsRule"));
}

View file

@ -33,6 +33,7 @@ public:
private:
CSSSupportsRule(JS::Realm&, NonnullRefPtr<Supports>&&, CSSRuleList&);
virtual void initialize(JS::Realm&) override;
virtual DeprecatedString serialized() const override;
NonnullRefPtr<Supports> m_supports;

View file

@ -25,10 +25,15 @@ MediaQueryList::MediaQueryList(DOM::Document& document, NonnullRefPtrVector<Medi
, m_document(document)
, m_media(move(media))
{
set_prototype(&Bindings::ensure_web_prototype<Bindings::MediaQueryListPrototype>(document.realm(), "MediaQueryList"));
evaluate();
}
void MediaQueryList::initialize(JS::Realm& realm)
{
Base::initialize(realm);
set_prototype(&Bindings::ensure_web_prototype<Bindings::MediaQueryListPrototype>(realm, "MediaQueryList"));
}
void MediaQueryList::visit_edges(Cell::Visitor& visitor)
{
Base::visit_edges(visitor);

View file

@ -34,6 +34,7 @@ public:
private:
MediaQueryList(DOM::Document&, NonnullRefPtrVector<MediaQuery>&&);
virtual void initialize(JS::Realm&) override;
virtual void visit_edges(Cell::Visitor&) override;
JS::NonnullGCPtr<DOM::Document> m_document;

View file

@ -20,9 +20,14 @@ MediaQueryListEvent::MediaQueryListEvent(JS::Realm& realm, DeprecatedFlyString c
, m_media(event_init.media)
, m_matches(event_init.matches)
{
set_prototype(&Bindings::ensure_web_prototype<Bindings::MediaQueryListEventPrototype>(realm, "MediaQueryListEvent"));
}
MediaQueryListEvent::~MediaQueryListEvent() = default;
void MediaQueryListEvent::initialize(JS::Realm& realm)
{
Base::initialize(realm);
set_prototype(&Bindings::ensure_web_prototype<Bindings::MediaQueryListEventPrototype>(realm, "MediaQueryListEvent"));
}
}

View file

@ -29,6 +29,8 @@ public:
private:
MediaQueryListEvent(JS::Realm&, DeprecatedFlyString const& event_name, MediaQueryListEventInit const& event_init);
virtual void initialize(JS::Realm&) override;
DeprecatedString m_media;
bool m_matches;
};

View file

@ -22,7 +22,12 @@ Screen::Screen(HTML::Window& window)
: PlatformObject(window.realm())
, m_window(window)
{
set_prototype(&Bindings::ensure_web_prototype<Bindings::ScreenPrototype>(window.realm(), "Screen"));
}
void Screen::initialize(JS::Realm& realm)
{
Base::initialize(realm);
set_prototype(&Bindings::ensure_web_prototype<Bindings::ScreenPrototype>(realm, "Screen"));
}
void Screen::visit_edges(Cell::Visitor& visitor)

View file

@ -29,6 +29,7 @@ public:
private:
explicit Screen(HTML::Window&);
virtual void initialize(JS::Realm&) override;
virtual void visit_edges(Cell::Visitor&) override;
HTML::Window const& window() const { return *m_window; }

View file

@ -22,7 +22,6 @@ JS::NonnullGCPtr<Crypto> Crypto::create(JS::Realm& realm)
Crypto::Crypto(JS::Realm& realm)
: PlatformObject(realm)
{
set_prototype(&Bindings::cached_web_prototype(realm, "Crypto"));
}
Crypto::~Crypto() = default;
@ -30,6 +29,7 @@ Crypto::~Crypto() = default;
void Crypto::initialize(JS::Realm& realm)
{
Base::initialize(realm);
set_prototype(&Bindings::ensure_web_prototype<Bindings::CryptoPrototype>(realm, "Crypto"));
m_subtle = SubtleCrypto::create(realm);
}

View file

@ -26,11 +26,11 @@ public:
DeprecatedString random_uuid() const;
protected:
virtual void initialize(JS::Realm&) override;
virtual void visit_edges(Cell::Visitor&) override;
private:
explicit Crypto(JS::Realm&);
virtual void initialize(JS::Realm&) override;
JS::GCPtr<SubtleCrypto> m_subtle;
};

View file

@ -22,11 +22,16 @@ JS::NonnullGCPtr<SubtleCrypto> SubtleCrypto::create(JS::Realm& realm)
SubtleCrypto::SubtleCrypto(JS::Realm& realm)
: PlatformObject(realm)
{
set_prototype(&Bindings::cached_web_prototype(realm, "SubtleCrypto"));
}
SubtleCrypto::~SubtleCrypto() = default;
void SubtleCrypto::initialize(JS::Realm& realm)
{
Base::initialize(realm);
set_prototype(&Bindings::ensure_web_prototype<Bindings::SubtleCryptoPrototype>(realm, "SubtleCrypto"));
}
// https://w3c.github.io/webcrypto/#dfn-SubtleCrypto-method-digest
JS::Promise* SubtleCrypto::digest(DeprecatedString const& algorithm, JS::Handle<JS::Object> const& data)
{

View file

@ -23,6 +23,7 @@ public:
private:
explicit SubtleCrypto(JS::Realm&);
virtual void initialize(JS::Realm&) override;
};
}

View file

@ -21,11 +21,16 @@ AbortController::AbortController(JS::Realm& realm, JS::NonnullGCPtr<AbortSignal>
: PlatformObject(realm)
, m_signal(move(signal))
{
set_prototype(&Bindings::cached_web_prototype(realm, "AbortController"));
}
AbortController::~AbortController() = default;
void AbortController::initialize(JS::Realm& realm)
{
Base::initialize(realm);
set_prototype(&Bindings::ensure_web_prototype<Bindings::AbortControllerPrototype>(realm, "AbortController"));
}
void AbortController::visit_edges(Cell::Visitor& visitor)
{
Base::visit_edges(visitor);

View file

@ -28,6 +28,7 @@ public:
private:
AbortController(JS::Realm&, JS::NonnullGCPtr<AbortSignal>);
virtual void initialize(JS::Realm&) override;
virtual void visit_edges(Cell::Visitor&) override;
// https://dom.spec.whatwg.org/#abortcontroller-signal

View file

@ -20,7 +20,12 @@ JS::NonnullGCPtr<AbortSignal> AbortSignal::construct_impl(JS::Realm& realm)
AbortSignal::AbortSignal(JS::Realm& realm)
: EventTarget(realm)
{
set_prototype(&Bindings::cached_web_prototype(realm, "AbortSignal"));
}
void AbortSignal::initialize(JS::Realm& realm)
{
Base::initialize(realm);
set_prototype(&Bindings::ensure_web_prototype<Bindings::AbortSignalPrototype>(realm, "AbortSignal"));
}
// https://dom.spec.whatwg.org/#abortsignal-add

View file

@ -43,6 +43,7 @@ public:
private:
explicit AbortSignal(JS::Realm&);
virtual void initialize(JS::Realm&) override;
virtual void visit_edges(JS::Cell::Visitor&) override;
// https://dom.spec.whatwg.org/#abortsignal-abort-reason

View file

@ -29,7 +29,12 @@ Attr::Attr(Document& document, QualifiedName qualified_name, DeprecatedString va
, m_value(move(value))
, m_owner_element(owner_element)
{
set_prototype(&Bindings::cached_web_prototype(document.realm(), "Attr"));
}
void Attr::initialize(JS::Realm& realm)
{
Base::initialize(realm);
set_prototype(&Bindings::ensure_web_prototype<Bindings::AttrPrototype>(realm, "Attr"));
}
void Attr::visit_edges(Cell::Visitor& visitor)

View file

@ -45,6 +45,7 @@ public:
private:
Attr(Document&, QualifiedName, DeprecatedString value, Element const*);
virtual void initialize(JS::Realm&) override;
virtual void visit_edges(Cell::Visitor&) override;
QualifiedName m_qualified_name;

View file

@ -12,9 +12,14 @@ namespace Web::DOM {
CDATASection::CDATASection(Document& document, DeprecatedString const& data)
: Text(document, NodeType::CDATA_SECTION_NODE, data)
{
set_prototype(&Bindings::cached_web_prototype(realm(), "CDATASection"));
}
CDATASection::~CDATASection() = default;
void CDATASection::initialize(JS::Realm& realm)
{
Base::initialize(realm);
set_prototype(&Bindings::ensure_web_prototype<Bindings::CDATASectionPrototype>(realm, "CDATASection"));
}
}

View file

@ -22,6 +22,8 @@ public:
private:
CDATASection(Document&, DeprecatedString const&);
virtual void initialize(JS::Realm&) override;
};
template<>

View file

@ -17,7 +17,12 @@ CharacterData::CharacterData(Document& document, NodeType type, DeprecatedString
: Node(document, type)
, m_data(data)
{
set_prototype(&Bindings::ensure_web_prototype<Bindings::CharacterDataPrototype>(document.realm(), "CharacterData"));
}
void CharacterData::initialize(JS::Realm& realm)
{
Base::initialize(realm);
set_prototype(&Bindings::ensure_web_prototype<Bindings::CharacterDataPrototype>(realm, "CharacterData"));
}
// https://dom.spec.whatwg.org/#dom-characterdata-data

View file

@ -36,6 +36,8 @@ public:
protected:
CharacterData(Document&, NodeType, DeprecatedString const&);
virtual void initialize(JS::Realm&) override;
private:
DeprecatedString m_data;
};

View file

@ -25,11 +25,16 @@ CustomEvent::CustomEvent(JS::Realm& realm, DeprecatedFlyString const& event_name
: Event(realm, event_name, event_init)
, m_detail(event_init.detail)
{
set_prototype(&Bindings::cached_web_prototype(realm, "CustomEvent"));
}
CustomEvent::~CustomEvent() = default;
void CustomEvent::initialize(JS::Realm& realm)
{
Base::initialize(realm);
set_prototype(&Bindings::ensure_web_prototype<Bindings::CustomEventPrototype>(realm, "CustomEvent"));
}
void CustomEvent::visit_edges(JS::Cell::Visitor& visitor)
{
Base::visit_edges(visitor);

View file

@ -28,6 +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 void visit_edges(JS::Cell::Visitor&) override;
void init_custom_event(DeprecatedString const& type, bool bubbles, bool cancelable, JS::Value detail);

View file

@ -297,8 +297,6 @@ Document::Document(JS::Realm& realm, const AK::URL& url)
, m_style_computer(make<CSS::StyleComputer>(*this))
, m_url(url)
{
set_prototype(&Bindings::cached_web_prototype(realm, "Document"));
HTML::main_thread_event_loop().register_document({}, *this);
m_style_update_timer = Platform::Timer::create_single_shot(0, [this] {
@ -315,6 +313,12 @@ Document::~Document()
HTML::main_thread_event_loop().unregister_document({}, *this);
}
void Document::initialize(JS::Realm& realm)
{
Base::initialize(realm);
set_prototype(&Bindings::ensure_web_prototype<Bindings::DocumentPrototype>(realm, "Document"));
}
void Document::visit_edges(Cell::Visitor& visitor)
{
Base::visit_edges(visitor);

View file

@ -450,6 +450,7 @@ public:
DeprecatedString dump_accessibility_tree_as_json();
protected:
virtual void initialize(JS::Realm&) override;
virtual void visit_edges(Cell::Visitor&) override;
private:

View file

@ -12,7 +12,12 @@ namespace Web::DOM {
DocumentFragment::DocumentFragment(Document& document)
: ParentNode(document, NodeType::DOCUMENT_FRAGMENT_NODE)
{
set_prototype(&Bindings::cached_web_prototype(realm(), "DocumentFragment"));
}
void DocumentFragment::initialize(JS::Realm& realm)
{
Base::initialize(realm);
set_prototype(&Bindings::ensure_web_prototype<Bindings::DocumentFragmentPrototype>(realm, "DocumentFragment"));
}
void DocumentFragment::visit_edges(Cell::Visitor& visitor)

View file

@ -33,6 +33,7 @@ public:
protected:
explicit DocumentFragment(Document& document);
virtual void initialize(JS::Realm&) override;
virtual void visit_edges(Cell::Visitor&) override;
private:

View file

@ -17,7 +17,12 @@ JS::NonnullGCPtr<DocumentType> DocumentType::create(Document& document)
DocumentType::DocumentType(Document& document)
: Node(document, NodeType::DOCUMENT_TYPE_NODE)
{
set_prototype(&Bindings::cached_web_prototype(realm(), "DocumentType"));
}
void DocumentType::initialize(JS::Realm& realm)
{
Base::initialize(realm);
set_prototype(&Bindings::ensure_web_prototype<Bindings::DocumentTypePrototype>(realm, "DocumentType"));
}
}

View file

@ -36,6 +36,8 @@ public:
private:
explicit DocumentType(Document&);
virtual void initialize(JS::Realm&) override;
DeprecatedString m_name;
DeprecatedString m_public_id;
DeprecatedString m_system_id;

View file

@ -56,7 +56,6 @@ Element::Element(Document& document, DOM::QualifiedName qualified_name)
: ParentNode(document, NodeType::ELEMENT_NODE)
, m_qualified_name(move(qualified_name))
{
set_prototype(&Bindings::cached_web_prototype(document.realm(), "Element"));
make_html_uppercased_qualified_name();
}
@ -65,6 +64,8 @@ Element::~Element() = default;
void Element::initialize(JS::Realm& realm)
{
Base::initialize(realm);
set_prototype(&Bindings::ensure_web_prototype<Bindings::ElementPrototype>(realm, "Element"));
m_attributes = NamedNodeMap::create(*this);
}

View file

@ -21,7 +21,6 @@ MutationObserver::MutationObserver(JS::Realm& realm, JS::GCPtr<WebIDL::CallbackT
: PlatformObject(realm)
, m_callback(move(callback))
{
set_prototype(&Bindings::cached_web_prototype(realm, "MutationObserver"));
// 1. Set thiss callback to callback.
@ -32,6 +31,12 @@ MutationObserver::MutationObserver(JS::Realm& realm, JS::GCPtr<WebIDL::CallbackT
MutationObserver::~MutationObserver() = default;
void MutationObserver::initialize(JS::Realm& realm)
{
Base::initialize(realm);
set_prototype(&Bindings::ensure_web_prototype<Bindings::MutationObserverPrototype>(realm, "MutationObserver"));
}
void MutationObserver::visit_edges(Cell::Visitor& visitor)
{
Base::visit_edges(visitor);

View file

@ -52,6 +52,7 @@ public:
private:
MutationObserver(JS::Realm&, JS::GCPtr<WebIDL::CallbackType>);
virtual void initialize(JS::Realm&) override;
virtual void visit_edges(Cell::Visitor&) override;
// https://dom.spec.whatwg.org/#concept-mo-callback
@ -81,6 +82,7 @@ public:
protected:
RegisteredObserver(MutationObserver& observer, MutationObserverInit const& options);
virtual void visit_edges(Cell::Visitor&) override;
private:
@ -100,6 +102,7 @@ public:
private:
TransientRegisteredObserver(MutationObserver& observer, MutationObserverInit const& options, RegisteredObserver& source);
virtual void visit_edges(Cell::Visitor&) override;
JS::NonnullGCPtr<RegisteredObserver> m_source;

View file

@ -29,11 +29,16 @@ MutationRecord::MutationRecord(JS::Realm& realm, DeprecatedFlyString const& type
, m_attribute_namespace(attribute_namespace)
, m_old_value(old_value)
{
set_prototype(&Bindings::cached_web_prototype(realm, "MutationRecord"));
}
MutationRecord::~MutationRecord() = default;
void MutationRecord::initialize(JS::Realm& realm)
{
Base::initialize(realm);
set_prototype(&Bindings::ensure_web_prototype<Bindings::MutationRecordPrototype>(realm, "MutationRecord"));
}
void MutationRecord::visit_edges(Cell::Visitor& visitor)
{
Base::visit_edges(visitor);

View file

@ -31,6 +31,8 @@ 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 void visit_edges(Cell::Visitor&) override;
DeprecatedFlyString m_type;

View file

@ -15,7 +15,12 @@ ProcessingInstruction::ProcessingInstruction(Document& document, DeprecatedStrin
: CharacterData(document, NodeType::PROCESSING_INSTRUCTION_NODE, data)
, m_target(target)
{
set_prototype(&Bindings::cached_web_prototype(document.realm(), "ProcessingInstruction"));
}
void ProcessingInstruction::initialize(JS::Realm& realm)
{
Base::initialize(realm);
set_prototype(&Bindings::ensure_web_prototype<Bindings::ProcessingInstructionPrototype>(realm, "ProcessingInstruction"));
}
}

View file

@ -24,6 +24,8 @@ public:
private:
ProcessingInstruction(Document&, DeprecatedString const& data, DeprecatedString const& target);
virtual void initialize(JS::Realm&) override;
DeprecatedString m_target;
};

View file

@ -52,13 +52,11 @@ JS::NonnullGCPtr<Range> Range::construct_impl(JS::Realm& realm)
Range::Range(Document& document)
: Range(document, 0, document, 0)
{
set_prototype(&Bindings::cached_web_prototype(document.realm(), "Range"));
}
Range::Range(Node& start_container, u32 start_offset, Node& end_container, u32 end_offset)
: AbstractRange(start_container, start_offset, end_container, end_offset)
{
set_prototype(&Bindings::cached_web_prototype(start_container.realm(), "Range"));
live_ranges().set(this);
}
@ -67,6 +65,12 @@ Range::~Range()
live_ranges().remove(this);
}
void Range::initialize(JS::Realm& realm)
{
Base::initialize(realm);
set_prototype(&Bindings::ensure_web_prototype<Bindings::RangePrototype>(realm, "Range"));
}
// https://dom.spec.whatwg.org/#concept-range-root
Node& Range::root()
{

View file

@ -88,6 +88,8 @@ private:
explicit Range(Document&);
Range(Node& start_container, u32 start_offset, Node& end_container, u32 end_offset);
virtual void initialize(JS::Realm&) override;
Node& root();
Node const& root() const;

View file

@ -17,7 +17,6 @@ namespace Web::DOM {
StaticRange::StaticRange(Node& start_container, u32 start_offset, Node& end_container, u32 end_offset)
: AbstractRange(start_container, start_offset, end_container, end_offset)
{
set_prototype(&Bindings::cached_web_prototype(start_container.realm(), "StaticRange"));
}
StaticRange::~StaticRange() = default;
@ -36,4 +35,10 @@ 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)
{
Base::initialize(realm);
set_prototype(&Bindings::ensure_web_prototype<Bindings::StaticRangePrototype>(realm, "StaticRange"));
}
}

View file

@ -28,6 +28,8 @@ public:
StaticRange(Node& start_container, u32 start_offset, Node& end_container, u32 end_offset);
virtual ~StaticRange() override;
virtual void initialize(JS::Realm&) override;
};
}

View file

@ -17,13 +17,17 @@ namespace Web::DOM {
Text::Text(Document& document, DeprecatedString const& data)
: CharacterData(document, NodeType::TEXT_NODE, data)
{
set_prototype(&Bindings::cached_web_prototype(realm(), "Text"));
}
Text::Text(Document& document, NodeType type, DeprecatedString const& data)
: CharacterData(document, type, data)
{
set_prototype(&Bindings::cached_web_prototype(realm(), "Text"));
}
void Text::initialize(JS::Realm& realm)
{
Base::initialize(realm);
set_prototype(&Bindings::ensure_web_prototype<Bindings::TextPrototype>(realm, "Text"));
}
void Text::visit_edges(Cell::Visitor& visitor)

View file

@ -38,6 +38,7 @@ protected:
Text(Document&, DeprecatedString const&);
Text(Document&, NodeType, DeprecatedString const&);
virtual void initialize(JS::Realm&) override;
virtual void visit_edges(Cell::Visitor&) override;
private:

View file

@ -28,11 +28,16 @@ JS::NonnullGCPtr<XMLSerializer> XMLSerializer::construct_impl(JS::Realm& realm)
XMLSerializer::XMLSerializer(JS::Realm& realm)
: PlatformObject(realm)
{
set_prototype(&Bindings::cached_web_prototype(realm, "XMLSerializer"));
}
XMLSerializer::~XMLSerializer() = default;
void XMLSerializer::initialize(JS::Realm& realm)
{
Base::initialize(realm);
set_prototype(&Bindings::ensure_web_prototype<Bindings::XMLSerializerPrototype>(realm, "XMLSerializer"));
}
// https://w3c.github.io/DOM-Parsing/#dom-xmlserializer-serializetostring
WebIDL::ExceptionOr<DeprecatedString> XMLSerializer::serialize_to_string(JS::NonnullGCPtr<DOM::Node> root)
{

View file

@ -22,6 +22,8 @@ public:
private:
explicit XMLSerializer(JS::Realm&);
virtual void initialize(JS::Realm&) override;
};
enum class RequireWellFormed {

View file

@ -29,11 +29,16 @@ TextDecoder::TextDecoder(JS::Realm& realm, TextCodec::Decoder& decoder, Deprecat
, m_fatal(fatal)
, m_ignore_bom(ignore_bom)
{
set_prototype(&Bindings::cached_web_prototype(realm, "TextDecoder"));
}
TextDecoder::~TextDecoder() = default;
void TextDecoder::initialize(JS::Realm& realm)
{
Base::initialize(realm);
set_prototype(&Bindings::ensure_web_prototype<Bindings::TextDecoderPrototype>(realm, "TextDecoder"));
}
// https://encoding.spec.whatwg.org/#dom-textdecoder-decode
WebIDL::ExceptionOr<DeprecatedString> TextDecoder::decode(JS::Handle<JS::Object> const& input) const
{

View file

@ -35,6 +35,8 @@ 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;
TextCodec::Decoder& m_decoder;
DeprecatedFlyString m_encoding;
bool m_fatal { false };

View file

@ -19,11 +19,16 @@ JS::NonnullGCPtr<TextEncoder> TextEncoder::construct_impl(JS::Realm& realm)
TextEncoder::TextEncoder(JS::Realm& realm)
: PlatformObject(realm)
{
set_prototype(&Bindings::cached_web_prototype(realm, "TextEncoder"));
}
TextEncoder::~TextEncoder() = default;
void TextEncoder::initialize(JS::Realm& realm)
{
Base::initialize(realm);
set_prototype(&Bindings::ensure_web_prototype<Bindings::TextEncoderPrototype>(realm, "TextEncoder"));
}
// https://encoding.spec.whatwg.org/#dom-textencoder-encode
JS::Uint8Array* TextEncoder::encode(DeprecatedString const& input) const
{

View file

@ -31,6 +31,8 @@ public:
protected:
// https://encoding.spec.whatwg.org/#dom-textencoder
explicit TextEncoder(JS::Realm&);
virtual void initialize(JS::Realm&) override;
};
}

View file

@ -33,11 +33,16 @@ Headers::Headers(JS::Realm& realm, JS::NonnullGCPtr<Infrastructure::HeaderList>
: PlatformObject(realm)
, m_header_list(header_list)
{
set_prototype(&Bindings::cached_web_prototype(realm, "Headers"));
}
Headers::~Headers() = default;
void Headers::initialize(JS::Realm& realm)
{
Base::initialize(realm);
set_prototype(&Bindings::ensure_web_prototype<Bindings::HeadersPrototype>(realm, "Headers"));
}
void Headers::visit_edges(JS::Cell::Visitor& visitor)
{
Base::visit_edges(visitor);

View file

@ -60,6 +60,7 @@ private:
Headers(JS::Realm&, JS::NonnullGCPtr<Infrastructure::HeaderList>);
virtual void initialize(JS::Realm&) override;
virtual void visit_edges(JS::Cell::Visitor&) override;
WebIDL::ExceptionOr<bool> validate(Infrastructure::Header const&) const;

View file

@ -33,11 +33,16 @@ HeadersIterator::HeadersIterator(Headers const& headers, JS::Object::PropertyKin
, m_headers(headers)
, m_iteration_kind(iteration_kind)
{
set_prototype(&Bindings::ensure_web_prototype<Bindings::HeadersIteratorPrototype>(headers.realm(), "HeadersIterator"));
}
HeadersIterator::~HeadersIterator() = default;
void HeadersIterator::initialize(JS::Realm& realm)
{
Base::initialize(realm);
set_prototype(&Bindings::ensure_web_prototype<Bindings::HeadersIteratorPrototype>(realm, "HeadersIterator"));
}
void HeadersIterator::visit_edges(JS::Cell::Visitor& visitor)
{
Base::visit_edges(visitor);

View file

@ -22,6 +22,7 @@ public:
JS::ThrowCompletionOr<JS::Object*> next();
private:
virtual void initialize(JS::Realm&) override;
virtual void visit_edges(JS::Cell::Visitor&) override;
HeadersIterator(Headers const&, JS::Object::PropertyKind iteration_kind);

View file

@ -25,11 +25,16 @@ Request::Request(JS::Realm& realm, JS::NonnullGCPtr<Infrastructure::Request> req
: PlatformObject(realm)
, m_request(request)
{
set_prototype(&Bindings::cached_web_prototype(realm, "Request"));
}
Request::~Request() = default;
void Request::initialize(JS::Realm& realm)
{
Base::initialize(realm);
set_prototype(&Bindings::ensure_web_prototype<Bindings::RequestPrototype>(realm, "Request"));
}
void Request::visit_edges(Cell::Visitor& visitor)
{
Base::visit_edges(visitor);

View file

@ -98,6 +98,7 @@ public:
private:
Request(JS::Realm&, JS::NonnullGCPtr<Infrastructure::Request>);
virtual void initialize(JS::Realm&) override;
virtual void visit_edges(Cell::Visitor&) override;
// https://fetch.spec.whatwg.org/#concept-request-request

View file

@ -22,11 +22,16 @@ Response::Response(JS::Realm& realm, JS::NonnullGCPtr<Infrastructure::Response>
: PlatformObject(realm)
, m_response(response)
{
set_prototype(&Bindings::cached_web_prototype(realm, "Response"));
}
Response::~Response() = default;
void Response::initialize(JS::Realm& realm)
{
Base::initialize(realm);
set_prototype(&Bindings::ensure_web_prototype<Bindings::ResponsePrototype>(realm, "Response"));
}
void Response::visit_edges(Cell::Visitor& visitor)
{
Base::visit_edges(visitor);

View file

@ -62,6 +62,7 @@ public:
private:
Response(JS::Realm&, JS::NonnullGCPtr<Infrastructure::Response>);
virtual void initialize(JS::Realm&) override;
virtual void visit_edges(Cell::Visitor&) override;
WebIDL::ExceptionOr<void> initialize_response(ResponseInit const&, Optional<Infrastructure::BodyWithType> const&);

View file

@ -115,7 +115,6 @@ bool is_basic_latin(StringView view)
Blob::Blob(JS::Realm& realm)
: PlatformObject(realm)
{
set_prototype(&Bindings::cached_web_prototype(realm, "Blob"));
}
Blob::Blob(JS::Realm& realm, ByteBuffer byte_buffer, DeprecatedString type)
@ -123,18 +122,22 @@ Blob::Blob(JS::Realm& realm, ByteBuffer byte_buffer, DeprecatedString type)
, m_byte_buffer(move(byte_buffer))
, m_type(move(type))
{
set_prototype(&Bindings::cached_web_prototype(realm, "Blob"));
}
Blob::Blob(JS::Realm& realm, ByteBuffer byte_buffer)
: PlatformObject(realm)
, m_byte_buffer(move(byte_buffer))
{
set_prototype(&Bindings::cached_web_prototype(realm, "Blob"));
}
Blob::~Blob() = default;
void Blob::initialize(JS::Realm& realm)
{
Base::initialize(realm);
set_prototype(&Bindings::ensure_web_prototype<Bindings::BlobPrototype>(realm, "Blob"));
}
// https://w3c.github.io/FileAPI/#ref-for-dom-blob-blob
WebIDL::ExceptionOr<JS::NonnullGCPtr<Blob>> Blob::create(JS::Realm& realm, Optional<Vector<BlobPart>> const& blob_parts, Optional<BlobPropertyBag> const& options)
{

View file

@ -53,6 +53,8 @@ protected:
Blob(JS::Realm&, ByteBuffer, DeprecatedString type);
Blob(JS::Realm&, ByteBuffer);
virtual void initialize(JS::Realm&) override;
private:
explicit Blob(JS::Realm&);

View file

@ -16,7 +16,12 @@ File::File(JS::Realm& realm, ByteBuffer byte_buffer, DeprecatedString file_name,
, m_name(move(file_name))
, m_last_modified(last_modified)
{
set_prototype(&Bindings::cached_web_prototype(realm, "File"));
}
void File::initialize(JS::Realm& realm)
{
Base::initialize(realm);
set_prototype(&Bindings::ensure_web_prototype<Bindings::FilePrototype>(realm, "File"));
}
File::~File() = default;

View file

@ -31,6 +31,8 @@ public:
private:
File(JS::Realm&, ByteBuffer, DeprecatedString file_name, DeprecatedString type, i64 last_modified);
virtual void initialize(JS::Realm&) override;
DeprecatedString m_name;
i64 m_last_modified { 0 };
};

View file

@ -18,7 +18,6 @@ JS::NonnullGCPtr<DOMPoint> DOMPoint::construct_impl(JS::Realm& realm, double x,
DOMPoint::DOMPoint(JS::Realm& realm, double x, double y, double z, double w)
: DOMPointReadOnly(realm, x, y, z, w)
{
set_prototype(&Bindings::cached_web_prototype(realm, "DOMPoint"));
}
// https://drafts.fxtf.org/geometry/#dom-dompoint-frompoint
@ -30,4 +29,10 @@ JS::NonnullGCPtr<DOMPoint> DOMPoint::from_point(JS::VM& vm, DOMPointInit const&
DOMPoint::~DOMPoint() = default;
void DOMPoint::initialize(JS::Realm& realm)
{
Base::initialize(realm);
set_prototype(&Bindings::ensure_web_prototype<Bindings::DOMPointPrototype>(realm, "DOMPoint"));
}
}

View file

@ -34,6 +34,8 @@ public:
private:
DOMPoint(JS::Realm&, double x, double y, double z, double w);
virtual void initialize(JS::Realm&) override;
};
}

View file

@ -22,7 +22,6 @@ DOMPointReadOnly::DOMPointReadOnly(JS::Realm& realm, double x, double y, double
, m_z(z)
, m_w(w)
{
set_prototype(&Bindings::cached_web_prototype(realm, "DOMPointReadOnly"));
}
// https://drafts.fxtf.org/geometry/#dom-dompointreadonly-frompoint
@ -34,4 +33,10 @@ JS::NonnullGCPtr<DOMPointReadOnly> DOMPointReadOnly::from_point(JS::VM& vm, DOMP
DOMPointReadOnly::~DOMPointReadOnly() = default;
void DOMPointReadOnly::initialize(JS::Realm& realm)
{
Base::initialize(realm);
set_prototype(&Bindings::ensure_web_prototype<Bindings::DOMPointReadOnlyPrototype>(realm, "DOMPointReadOnly"));
}
}

View file

@ -39,6 +39,8 @@ public:
protected:
DOMPointReadOnly(JS::Realm&, double x, double y, double z, double w);
virtual void initialize(JS::Realm&) override;
double m_x;
double m_y;
double m_z;

View file

@ -22,9 +22,14 @@ JS::NonnullGCPtr<DOMRect> DOMRect::create(JS::Realm& realm, Gfx::FloatRect const
DOMRect::DOMRect(JS::Realm& realm, double x, double y, double width, double height)
: DOMRectReadOnly(realm, x, y, width, height)
{
set_prototype(&Bindings::cached_web_prototype(realm, "DOMRect"));
}
DOMRect::~DOMRect() = default;
void DOMRect::initialize(JS::Realm& realm)
{
Base::initialize(realm);
set_prototype(&Bindings::ensure_web_prototype<Bindings::DOMRectPrototype>(realm, "DOMRect"));
}
}

View file

@ -32,6 +32,8 @@ public:
private:
DOMRect(JS::Realm&, double x, double y, double width, double height);
virtual void initialize(JS::Realm&) override;
};
}

View file

@ -18,9 +18,14 @@ DOMRectReadOnly::DOMRectReadOnly(JS::Realm& realm, double x, double y, double wi
: PlatformObject(realm)
, m_rect(x, y, width, height)
{
set_prototype(&Bindings::cached_web_prototype(realm, "DOMRectReadOnly"));
}
DOMRectReadOnly::~DOMRectReadOnly() = default;
void DOMRectReadOnly::initialize(JS::Realm& realm)
{
Base::initialize(realm);
set_prototype(&Bindings::ensure_web_prototype<Bindings::DOMRectReadOnlyPrototype>(realm, "DOMRectReadOnly"));
}
}

View file

@ -34,6 +34,8 @@ public:
protected:
DOMRectReadOnly(JS::Realm&, double x, double y, double width, double height);
virtual void initialize(JS::Realm&) override;
Gfx::FloatRect m_rect;
};
}

View file

@ -43,11 +43,16 @@ CanvasGradient::CanvasGradient(JS::Realm& realm, Type type)
: PlatformObject(realm)
, m_type(type)
{
set_prototype(&Bindings::cached_web_prototype(realm, "CanvasGradient"));
}
CanvasGradient::~CanvasGradient() = default;
void CanvasGradient::initialize(JS::Realm& realm)
{
Base::initialize(realm);
set_prototype(&Bindings::ensure_web_prototype<Bindings::CanvasGradientPrototype>(realm, "CanvasGradient"));
}
// https://html.spec.whatwg.org/multipage/canvas.html#dom-canvasgradient-addcolorstop
WebIDL::ExceptionOr<void> CanvasGradient::add_color_stop(double offset, DeprecatedString const& color)
{

View file

@ -32,6 +32,8 @@ public:
private:
CanvasGradient(JS::Realm&, Type);
virtual void initialize(JS::Realm&) override;
Type m_type {};
struct ColorStop {

View file

@ -33,11 +33,16 @@ CanvasRenderingContext2D::CanvasRenderingContext2D(JS::Realm& realm, HTMLCanvasE
, CanvasPath(static_cast<Bindings::PlatformObject&>(*this))
, m_element(element)
{
set_prototype(&Bindings::cached_web_prototype(realm, "CanvasRenderingContext2D"));
}
CanvasRenderingContext2D::~CanvasRenderingContext2D() = default;
void CanvasRenderingContext2D::initialize(JS::Realm& realm)
{
Base::initialize(realm);
set_prototype(&Bindings::ensure_web_prototype<Bindings::CanvasRenderingContext2DPrototype>(realm, "CanvasRenderingContext2D"));
}
void CanvasRenderingContext2D::visit_edges(Cell::Visitor& visitor)
{
Base::visit_edges(visitor);

View file

@ -86,6 +86,7 @@ public:
private:
explicit CanvasRenderingContext2D(JS::Realm&, HTMLCanvasElement&);
virtual void initialize(JS::Realm&) override;
virtual void visit_edges(Cell::Visitor&) override;
struct PreparedTextGlyph {

View file

@ -25,9 +25,14 @@ CloseEvent::CloseEvent(JS::Realm& realm, DeprecatedFlyString const& event_name,
, m_code(event_init.code)
, m_reason(event_init.reason)
{
set_prototype(&Bindings::cached_web_prototype(realm, "CloseEvent"));
}
CloseEvent::~CloseEvent() = default;
void CloseEvent::initialize(JS::Realm& realm)
{
Base::initialize(realm);
set_prototype(&Bindings::ensure_web_prototype<Bindings::CloseEventPrototype>(realm, "CloseEvent"));
}
}

View file

@ -33,6 +33,8 @@ public:
private:
CloseEvent(JS::Realm&, DeprecatedFlyString const& event_name, CloseEventInit const& event_init);
virtual void initialize(JS::Realm&) override;
bool m_was_clean { false };
u16 m_code { 0 };
DeprecatedString m_reason;

View file

@ -21,11 +21,16 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<DOMParser>> DOMParser::construct_impl(JS::R
DOMParser::DOMParser(JS::Realm& realm)
: PlatformObject(realm)
{
set_prototype(&Bindings::cached_web_prototype(realm, "DOMParser"));
}
DOMParser::~DOMParser() = default;
void DOMParser::initialize(JS::Realm& realm)
{
Base::initialize(realm);
set_prototype(&Bindings::ensure_web_prototype<Bindings::DOMParserPrototype>(realm, "DOMParser"));
}
// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-domparser-parsefromstring
JS::NonnullGCPtr<DOM::Document> DOMParser::parse_from_string(DeprecatedString const& string, Bindings::DOMParserSupportedType type)
{

View file

@ -27,6 +27,8 @@ public:
private:
explicit DOMParser(JS::Realm&);
virtual void initialize(JS::Realm&) override;
};
}

View file

@ -27,11 +27,16 @@ ErrorEvent::ErrorEvent(JS::Realm& realm, DeprecatedFlyString const& event_name,
, m_colno(event_init.colno)
, m_error(event_init.error)
{
set_prototype(&Bindings::cached_web_prototype(realm, "ErrorEvent"));
}
ErrorEvent::~ErrorEvent() = default;
void ErrorEvent::initialize(JS::Realm& realm)
{
Base::initialize(realm);
set_prototype(&Bindings::ensure_web_prototype<Bindings::ErrorEventPrototype>(realm, "ErrorEvent"));
}
void ErrorEvent::visit_edges(Cell::Visitor& visitor)
{
Base::visit_edges(visitor);

View file

@ -47,6 +47,7 @@ public:
private:
ErrorEvent(JS::Realm&, DeprecatedFlyString const& event_name, ErrorEventInit const& event_init);
virtual void initialize(JS::Realm&) override;
virtual void visit_edges(Cell::Visitor&) override;
DeprecatedString m_message { "" };

View file

@ -13,8 +13,6 @@ namespace Web::HTML {
HTMLAnchorElement::HTMLAnchorElement(DOM::Document& document, DOM::QualifiedName qualified_name)
: HTMLElement(document, move(qualified_name))
{
set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLAnchorElement"));
activation_behavior = [this](auto const& event) {
run_activation_behavior(event);
};
@ -22,6 +20,12 @@ HTMLAnchorElement::HTMLAnchorElement(DOM::Document& document, DOM::QualifiedName
HTMLAnchorElement::~HTMLAnchorElement() = default;
void HTMLAnchorElement::initialize(JS::Realm& realm)
{
Base::initialize(realm);
set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLAnchorElementPrototype>(realm, "HTMLAnchorElement"));
}
void HTMLAnchorElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value)
{
HTMLElement::parse_attribute(name, value);

View file

@ -32,6 +32,8 @@ public:
private:
HTMLAnchorElement(DOM::Document&, DOM::QualifiedName);
virtual void initialize(JS::Realm&) override;
void run_activation_behavior(Web::DOM::Event const&);
// ^DOM::Element

View file

@ -13,11 +13,16 @@ namespace Web::HTML {
HTMLAreaElement::HTMLAreaElement(DOM::Document& document, DOM::QualifiedName qualified_name)
: HTMLElement(document, move(qualified_name))
{
set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLAreaElement"));
}
HTMLAreaElement::~HTMLAreaElement() = default;
void HTMLAreaElement::initialize(JS::Realm& realm)
{
Base::initialize(realm);
set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLAreaElementPrototype>(realm, "HTMLAreaElement"));
}
void HTMLAreaElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value)
{
HTMLElement::parse_attribute(name, value);

View file

@ -23,6 +23,8 @@ public:
private:
HTMLAreaElement(DOM::Document&, DOM::QualifiedName);
virtual void initialize(JS::Realm&) override;
// ^DOM::Element
virtual void parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) override;
virtual i32 default_tab_index_value() const override;

View file

@ -12,8 +12,14 @@ namespace Web::HTML {
HTMLAudioElement::HTMLAudioElement(DOM::Document& document, DOM::QualifiedName qualified_name)
: HTMLMediaElement(document, move(qualified_name))
{
set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLAudioElement"));
}
HTMLAudioElement::~HTMLAudioElement() = default;
void HTMLAudioElement::initialize(JS::Realm& realm)
{
Base::initialize(realm);
set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLAudioElementPrototype>(realm, "HTMLAudioElement"));
}
}

View file

@ -18,6 +18,8 @@ public:
private:
HTMLAudioElement(DOM::Document&, DOM::QualifiedName);
virtual void initialize(JS::Realm&) override;
};
}

Some files were not shown because too many files have changed in this diff Show more