LibWeb: Make CustomElementDefinition relationship with GC more sane

1. Stop using GC::Root in member variables, since that usually creates
   a realm leak.

2. Stop putting OrderedHashMap<FlyString, GC::Ptr> on the stack while
   setting these up, since that won't protect the objects from GC.
This commit is contained in:
Andreas Kling 2024-12-26 18:17:41 +01:00 committed by Andreas Kling
commit ceefe7d858
Notes: github-actions[bot] 2024-12-27 09:03:54 +00:00
5 changed files with 17 additions and 14 deletions

View file

@ -2635,7 +2635,7 @@ static void generate_html_constructor(SourceGenerator& generator, IDL::Construct
return JS::throw_completion(WebIDL::InvalidStateError::create(realm, "Custom element has already been constructed"_string));
// 12. Perform ? element.[[SetPrototypeOf]](prototype).
auto actual_element = element.get<GC::Root<DOM::Element>>();
auto actual_element = element.get<GC::Ref<DOM::Element>>();
TRY(actual_element->internal_set_prototype_of(&prototype.as_object()));
// 13. Replace the last entry in definition's construction stack with an already constructed marker.