Skip to content

Commit 62a19ce

Browse files
committed
fixup! lib: refactor internal webidl converters
Signed-off-by: Filip Skokan <[email protected]>
1 parent af69bca commit 62a19ce

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

lib/internal/webidl.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -770,8 +770,8 @@ function createSequenceConverter(converter) {
770770
'cannot be converted to sequence.',
771771
options);
772772
}
773-
// Step 3.2: return the sequence when the iterator is done.
774-
if (next.done === true) {
773+
// Step 3.2: IteratorComplete applies ToBoolean(done).
774+
if (next.done) {
775775
break;
776776
}
777777
// Step 3.3: convert next to an IDL value of type T.

test/parallel/test-internal-webidl.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,16 @@ assert.throws(() => webidl.requiredArguments(1, 2, opts), {
395395
message: 'Prefix: Context[0] is a Symbol and cannot be converted ' +
396396
'to a string.',
397397
});
398+
399+
assert.deepStrictEqual(converter({
400+
[Symbol.iterator]() {
401+
return {
402+
next() {
403+
return { done: 1, value: Symbol() };
404+
},
405+
};
406+
},
407+
}), []);
398408
}
399409

400410
{

0 commit comments

Comments
 (0)