From 7f90b0cab7b4a22585663e99a011d238a1514f7a Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 8 Jun 2023 07:07:40 +0200 Subject: [PATCH] LibWeb: Don't override prototype on generated iterator prototypes Generated iterator prototypes already have the IteratorPrototype as their prototype, but we were incorrectly hijacking them and rerouting to ObjectPrototype. Regressed in cfe663435ed0780440e52bc66d69d787f6c0af2f. --- .../BindingsGenerator/IDLGenerators.cpp | 19 ------------------- .../url-search-params-iterator-iterator.txt | 6 ++++++ .../url-search-params-iterator-iterator.html | 13 +++++++++++++ 3 files changed, 19 insertions(+), 19 deletions(-) create mode 100644 Tests/LibWeb/Text/expected/url-search-params-iterator-iterator.txt create mode 100644 Tests/LibWeb/Text/input/url-search-params-iterator-iterator.html diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp b/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp index b1e9c8b3433..b5a4753dec5 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp @@ -3881,25 +3881,6 @@ JS::ThrowCompletionOr @prototype_class@::initialize(JS::Realm& realm) { auto& vm = this->vm(); MUST_OR_THROW_OOM(Base::initialize(realm)); - -)~~~"); - - if (interface.prototype_base_class == "ObjectPrototype") { - generator.append(R"~~~( - - set_prototype(realm.intrinsics().object_prototype()); - -)~~~"); - } else { - generator.append(R"~~~( - - set_prototype(&ensure_web_prototype<@prototype_base_class@>(realm, "@parent_name@")); - -)~~~"); - } - - generator.append(R"~~~( - define_native_function(realm, vm.names.next, next, 0, JS::Attribute::Writable | JS::Attribute::Enumerable | JS::Attribute::Configurable); define_direct_property(vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(JS::PrimitiveString::create(vm, "Iterator"sv)), JS::Attribute::Configurable); diff --git a/Tests/LibWeb/Text/expected/url-search-params-iterator-iterator.txt b/Tests/LibWeb/Text/expected/url-search-params-iterator-iterator.txt new file mode 100644 index 00000000000..935f423016f --- /dev/null +++ b/Tests/LibWeb/Text/expected/url-search-params-iterator-iterator.txt @@ -0,0 +1,6 @@ +[object Iterator] +[object Iterator] +true +hello +1 +[object Window] diff --git a/Tests/LibWeb/Text/input/url-search-params-iterator-iterator.html b/Tests/LibWeb/Text/input/url-search-params-iterator-iterator.html new file mode 100644 index 00000000000..6ed3c38a09f --- /dev/null +++ b/Tests/LibWeb/Text/input/url-search-params-iterator-iterator.html @@ -0,0 +1,13 @@ + +