1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 01:57:44 +00:00

LibJS+LibWeb: Refactor GetIterator to use GetIteratorFromMethod

This is an editorial change in the ECMA-262 spec. See:
956e5af

This splits the GetIterator AO into two AOs, to remove some recursion
and to (soon) remove optional parameters.
This commit is contained in:
Timothy Flynn 2023-07-18 14:40:02 -04:00 committed by Andreas Kling
parent b918dcd4db
commit 5703833116
5 changed files with 111 additions and 71 deletions

View file

@ -67,7 +67,8 @@ static JS::ThrowCompletionOr<Vector<String>> convert_value_to_sequence_of_string
// https://webidl.spec.whatwg.org/#create-sequence-from-iterable
// To create an IDL value of type sequence<T> given an iterable iterable and an iterator getter method, perform the following steps:
// 1. Let iter be ? GetIterator(iterable, sync, method).
auto iterator = TRY(JS::get_iterator(vm, value, JS::IteratorHint::Sync, method));
// FIXME: The WebIDL spec is out of date - it should be using GetIteratorFromMethod.
auto iterator = TRY(JS::get_iterator_from_method(vm, value, *method));
// 2. Initialize i to be 0.
Vector<String> sequence_of_strings;