diff options
author | Srikavin Ramkumar <srikavinramkumar@gmail.com> | 2023-03-23 04:01:05 -0400 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2023-03-23 13:37:40 +0100 |
commit | daf421846c83ab1f748b33b52b1de1149d41c43c (patch) | |
tree | 6ef090daefd75f4ffecfa4368258e940f53c0138 /Meta | |
parent | 6bc6ea8e97260b0c7b78f4a24020d015431228de (diff) | |
download | serenity-daf421846c83ab1f748b33b52b1de1149d41c43c.zip |
LibWeb: Return TypeError for [HTMLConstructor] IDL constructors
This matches the spec since there can be no matching custom element
definition if we don't support custom elements yet.
Diffstat (limited to 'Meta')
-rw-r--r-- | Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp b/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp index 012e78fda2..b102245dd2 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp @@ -3012,6 +3012,15 @@ JS::ThrowCompletionOr<JS::NonnullGCPtr<JS::Object>> @constructor_class@::constru generator.append(R"~~~( return vm().throw_completion<JS::TypeError>(JS::ErrorType::NotAConstructor, "@namespaced_name@"); )~~~"); + } else if (interface.constructors.find_if([](auto const& x) { return x.extended_attributes.contains("HTMLConstructor"); }) != interface.constructors.end()) { + // https://html.spec.whatwg.org/multipage/dom.html#htmlconstructor + VERIFY(interface.constructors.size() == 1); + + // FIXME: Properly implement HTMLConstructor extended attribute once custom elements are implemented + generator.set("constructor.length", "0"); + generator.append(R"~~~( + return vm().throw_completion<JS::TypeError>(JS::ErrorType::NotAConstructor, "@namespaced_name@"); +)~~~"); } else if (interface.constructors.size() == 1) { // Single constructor |