mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 09:58:11 +00:00
LibWeb+LibJS: Make the EventTarget hierarchy (incl. DOM) GC-allocated
This is a monster patch that turns all EventTargets into GC-allocated PlatformObjects. Their C++ wrapper classes are removed, and the LibJS garbage collector is now responsible for their lifetimes. There's a fair amount of hacks and band-aids in this patch, and we'll have a lot of cleanup to do after this.
This commit is contained in:
parent
bb547ce1c4
commit
6f433c8656
445 changed files with 4797 additions and 4268 deletions
|
@ -14,16 +14,13 @@ namespace Web::HTML {
|
|||
|
||||
// https://html.spec.whatwg.org/multipage/dom.html#domstringmap
|
||||
class DOMStringMap final : public Bindings::PlatformObject {
|
||||
JS_OBJECT(DOMStringMap, Bindings::PlatformObject);
|
||||
WEB_PLATFORM_OBJECT(DOMStringMap, Bindings::PlatformObject);
|
||||
|
||||
public:
|
||||
static DOMStringMap* create(DOM::Element&);
|
||||
explicit DOMStringMap(DOM::Element&);
|
||||
static JS::NonnullGCPtr<DOMStringMap> create(DOM::Element&);
|
||||
|
||||
virtual ~DOMStringMap() override;
|
||||
|
||||
DOMStringMap& impl() { return *this; }
|
||||
|
||||
Vector<String> supported_property_names() const;
|
||||
|
||||
String determine_value_of_named_property(String const&) const;
|
||||
|
@ -34,6 +31,10 @@ public:
|
|||
bool delete_existing_named_property(String const&);
|
||||
|
||||
private:
|
||||
explicit DOMStringMap(DOM::Element&);
|
||||
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
||||
struct NameValuePair {
|
||||
String name;
|
||||
String value;
|
||||
|
@ -42,12 +43,9 @@ private:
|
|||
Vector<NameValuePair> get_name_value_pairs() const;
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/dom.html#concept-domstringmap-element
|
||||
NonnullRefPtr<DOM::Element> m_associated_element;
|
||||
JS::NonnullGCPtr<DOM::Element> m_associated_element;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
namespace Web::Bindings {
|
||||
inline JS::Object* wrap(JS::Realm&, Web::HTML::DOMStringMap& object) { return &object; }
|
||||
using DOMStringMapWrapper = Web::HTML::DOMStringMap;
|
||||
}
|
||||
WRAPPER_HACK(DOMStringMap, Web::HTML)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue