1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 12:07:45 +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:
Andreas Kling 2022-08-28 13:42:07 +02:00
parent bb547ce1c4
commit 6f433c8656
445 changed files with 4797 additions and 4268 deletions

View file

@ -20,15 +20,12 @@ namespace Web::DOM {
// https://dom.spec.whatwg.org/#domtokenlist
class DOMTokenList final : public Bindings::LegacyPlatformObject {
JS_OBJECT(DOMTokenList, Bindings::LegacyPlatformObject);
WEB_PLATFORM_OBJECT(DOMTokenList, Bindings::LegacyPlatformObject);
public:
static DOMTokenList* create(Element const& associated_element, FlyString associated_attribute);
DOMTokenList(Element const& associated_element, FlyString associated_attribute);
~DOMTokenList() = default;
DOMTokenList& impl() { return *this; }
void associated_attribute_changed(StringView value);
virtual bool is_supported_property_index(u32 index) const override;
@ -46,6 +43,8 @@ public:
void set_value(String value);
private:
DOMTokenList(Element const& associated_element, FlyString associated_attribute);
ExceptionOr<void> validate_token(StringView token) const;
void run_update_steps();
@ -56,7 +55,4 @@ private:
}
namespace Web::Bindings {
inline JS::Object* wrap(JS::Realm&, Web::DOM::DOMTokenList& object) { return &object; }
using DOMTokenListWrapper = Web::DOM::DOMTokenList;
}
WRAPPER_HACK(DOMTokenList, Web::DOM)