mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-02 15:46:33 +00:00
IDLGenerators: Throw TypeError if custom element is already constructed
Throwing a TypeError instead of an InvalidStateError DOMException follows the current specification steps.
This commit is contained in:
parent
08b5cae199
commit
7ee33529e8
Notes:
github-actions[bot]
2025-02-22 10:40:27 +00:00
Author: https://github.com/tcl3
Commit: 7ee33529e8
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3664
Reviewed-by: https://github.com/trflynn89 ✅
5 changed files with 358 additions and 2 deletions
|
@ -2701,9 +2701,9 @@ static void generate_html_constructor(SourceGenerator& generator, IDL::Construct
|
|||
// 10. Let element be the last entry in definition's construction stack.
|
||||
auto& element = definition->construction_stack().last();
|
||||
|
||||
// 11. If element is an already constructed marker, then throw an "InvalidStateError" DOMException.
|
||||
// 11. If element is an already constructed marker, then throw a TypeError.
|
||||
if (element.has<HTML::AlreadyConstructedCustomElementMarker>())
|
||||
return JS::throw_completion(WebIDL::InvalidStateError::create(realm, "Custom element has already been constructed"_string));
|
||||
return vm.throw_completion<JS::TypeError>("Custom element has already been constructed"sv);
|
||||
|
||||
// 12. Perform ? element.[[SetPrototypeOf]](prototype).
|
||||
auto actual_element = element.get<GC::Ref<DOM::Element>>();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue