Truly independent web browser
Meta: Give a Rust interface with an indexed getter an @@iterator
Shannon Booth796a9372de4c
diff --git a/Libraries/LibWeb/Bindings/Rust/src/bindings/interface.rs b/Libraries/LibWeb/Bindings/Rust/src/bindings/interface.rsindex 883a68b0176..4b7cc8e3df8 100644--- a/Libraries/LibWeb/Bindings/Rust/src/bindings/interface.rs+++ b/Libraries/LibWeb/Bindings/Rust/src/bindings/interface.rs@@ -573,17 +573,23 @@ pub(crate) fn define_operation();}-/// Defines the properties of a value iterator on the interface prototype object of an interface that supports indexed-/// properties, which are those of %Array.prototype%, https://webidl.spec.whatwg.org/#define-the-iteration-methods-pub(crate) fn define_value_iterator_properties(vm: &Vm, realm: Gc<Realm>, prototype: Gc<Object>) {+/// Defines the @@iterator property of the interface prototype object of an interface that supports indexed properties,+/// which is %Array.prototype.values%, https://webidl.spec.whatwg.org/#es-iterator+pub(crate) fn define_indexed_properties_iterator(vm: &Vm, realm: Gc<Realm>, prototype: Gc<Object>) {let array_prototype = realm.intrinsics().array_prototype(vm);- let names = &vm.names;prototype.define_direct_property(vm,&PropertyKey::from(vm.well_known_symbols().iterator),- array_prototype.get_without_side_effects(vm, &names.values),+ array_prototype.get_without_side_effects(vm, &vm.names.values),PropertyAttributes::new(Attribute::CONFIGURABLE | Attribute::WRITABLE),);+}++/// Defines the properties of a value iterator on the interface prototype object of an interface that supports indexed+/// properties, which are those of %Array.prototype%, https://webidl.spec.whatwg.org/#define-the-iteration-methods+pub(crate) fn define_value_iterator_properties(vm: &Vm, realm: Gc<Realm>, prototype: Gc<Object>) {+ let array_prototype = realm.intrinsics().array_prototype(vm);+ let names = &vm.names;for name in [&names.entries, &names.keys, &names.values, &names.forEach] {prototype.define_direct_property(vm,diff --git a/Meta/Generators/libweb_bindings/rust_bindings.py b/Meta/Generators/libweb_bindings/rust_bindings.pyindex 52f9861f243..7aa9f944af1 100644--- a/Meta/Generators/libweb_bindings/rust_bindings.py+++ b/Meta/Generators/libweb_bindings/rust_bindings.py@@ -806,10 +806,11 @@ RUST_BINDINGS_IMPORTS = """ #![allow(unused_imports)]};use crate::bindings::interface::{Inherits, Interface, Ref, Wrapped, cell_class, construct_arguments, construct_wrapper, create_dictionary_object,- define_attribute, define_cached_attribute, define_constants, define_interface_object_properties,- define_operation, define_to_string_tag, define_unimplemented_property, define_value_iterator_properties,- entry_point_arguments, implementation_if, implementation_of, prototype_from_new_target, realm_is_window,- rejected_promise, set_dictionary_member, set_interface_prototype_object_prototype, this_object, to_interface,+ define_attribute, define_cached_attribute, define_constants, define_indexed_properties_iterator,+ define_interface_object_properties, define_operation, define_to_string_tag, define_unimplemented_property,+ define_value_iterator_properties, entry_point_arguments, implementation_if, implementation_of,+ prototype_from_new_target, realm_is_window, rejected_promise, set_dictionary_member,+ set_interface_prototype_object_prototype, this_object, to_interface,};use crate::bindings::async_iterable::{AsyncIterable, DefaultAsyncIterator, DefaultAsyncIteratorClasses, async_iterator_next, async_iterator_return,@@ -1044,6 +1045,7 @@ def write_rust_interface(f"{getter_set.length});\n")defined_property_names.append(getter_set.name)+ out.write(" define_indexed_properties_iterator(vm, realm, prototype);\n")if members.indexed_property_getter.has_value_iterator:out.write(" define_value_iterator_properties(vm, realm, prototype);\n")if members.pair_iterator is not None: