diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp b/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp index c130a342855..4eb4da0c340 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp @@ -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()) - return JS::throw_completion(WebIDL::InvalidStateError::create(realm, "Custom element has already been constructed"_string)); + return vm.throw_completion("Custom element has already been constructed"sv); // 12. Perform ? element.[[SetPrototypeOf]](prototype). auto actual_element = element.get>(); diff --git a/Tests/LibWeb/Text/expected/wpt-import/custom-elements/upgrading/Node-cloneNode.txt b/Tests/LibWeb/Text/expected/wpt-import/custom-elements/upgrading/Node-cloneNode.txt new file mode 100644 index 00000000000..be1c4d0bf58 --- /dev/null +++ b/Tests/LibWeb/Text/expected/wpt-import/custom-elements/upgrading/Node-cloneNode.txt @@ -0,0 +1,14 @@ +Harness status: OK + +Found 9 tests + +9 Pass +Pass Node.prototype.cloneNode(false) must be able to clone a custom element +Pass Node.prototype.cloneNode(false) must be able to clone as a autonomous custom element when it contains is attribute +Pass Node.prototype.cloneNode(false) must be able to clone a custom element inside an iframe +Pass Node.prototype.cloneNode(true) must be able to clone a descendent custom element +Pass Node.prototype.cloneNode(true) must set parentNode, previousSibling, and nextSibling before upgrading custom elements +Pass HTMLElement constructor must throw an TypeError when the top of the construction stack is marked AlreadyConstructed due to a custom element constructor constructing itself after super() call +Pass HTMLElement constructor must throw an TypeError when the top of the construction stack is marked AlreadyConstructed due to a custom element constructor constructing itself before super() call +Pass Upgrading a custom element must throw TypeError when the custom element's constructor returns another element +Pass Inserting an element must not try to upgrade a custom element when it had already failed to upgrade once \ No newline at end of file diff --git a/Tests/LibWeb/Text/expected/wpt-import/custom-elements/upgrading/upgrading-parser-created-element.txt b/Tests/LibWeb/Text/expected/wpt-import/custom-elements/upgrading/upgrading-parser-created-element.txt new file mode 100644 index 00000000000..7ef0c67f11c --- /dev/null +++ b/Tests/LibWeb/Text/expected/wpt-import/custom-elements/upgrading/upgrading-parser-created-element.txt @@ -0,0 +1,11 @@ +Harness status: OK + +Found 6 tests + +6 Pass +Pass Element.prototype.createElement must add an unresolved custom element to the upgrade candidates map +Pass HTMLElement constructor must throw an TypeError when the top of the construction stack is marked AlreadyConstructed due to a custom element constructor constructing itself after super() call +Pass HTMLElement constructor must throw an TypeError when the top of the construction stack is marked AlreadyConstructed due to a custom element constructor constructing itself before super() call +Pass Upgrading a custom element must throw an TypeError when the returned element is not SameValue as the upgraded element +Pass Upgrading a custom element whose constructor returns a Text node must throw +Pass Upgrading a custom element whose constructor returns an Element must throw \ No newline at end of file diff --git a/Tests/LibWeb/Text/input/wpt-import/custom-elements/upgrading/Node-cloneNode.html b/Tests/LibWeb/Text/input/wpt-import/custom-elements/upgrading/Node-cloneNode.html new file mode 100644 index 00000000000..d953730063a --- /dev/null +++ b/Tests/LibWeb/Text/input/wpt-import/custom-elements/upgrading/Node-cloneNode.html @@ -0,0 +1,206 @@ + + + +Custom Elements: Upgrading + + + + + + + + +
+ + + diff --git a/Tests/LibWeb/Text/input/wpt-import/custom-elements/upgrading/upgrading-parser-created-element.html b/Tests/LibWeb/Text/input/wpt-import/custom-elements/upgrading/upgrading-parser-created-element.html new file mode 100644 index 00000000000..90dbb6dfbc2 --- /dev/null +++ b/Tests/LibWeb/Text/input/wpt-import/custom-elements/upgrading/upgrading-parser-created-element.html @@ -0,0 +1,125 @@ + + + +Custom Elements: Upgrading unresolved elements + + + + + + + +
+ + + + + + + + + +