1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-30 16:40:57 -05:00
denoland-deno/tests/wpt/runner
Milly fa27350977
fix(ext/web): ReadableStream.from() ignores null Symbol.asyncIterator (#23910)
If `@@asyncIterator` is `null` or `undefined`, it should ignores and
fallback to `@@iterator`.

Tests have been merged into WPT.
https://github.com/web-platform-tests/wpt/pull/46374

The proposal of `ReadableStream.from` uses TC39 [GetIterator][] and
[GetMethod][] within it.
GetMethod treats null as undefined.
So if `@@asyncIterator` is `null` it should be ignored and fallback to
`@@iterator`.

[GetIterator]: https://tc39.es/ecma262/#sec-getiterator
[GetMethod]: https://tc39.es/ecma262/#sec-getmethod

```bash
> deno eval "ReadableStream.from({ [Symbol.asyncIterator]: null, [Symbol.iterator]: () => ({ next: () => ({ done: true }) }) }).pipeTo(new WritableStream())"
error: Uncaught (in promise) TypeError: obj[SymbolAsyncIterator] is not a function
ReadableStream.from({ [Symbol.asyncIterator]: null, [Symbol.iterator]: () => ({ next: () => ({ done: true }) }) }).pipeTo(new WritableStream())
               ^
    at getIterator (ext:deno_web/06_streams.js:5105:38)
    at Function.from (ext:deno_web/06_streams.js:5207:22)
    at file:///D:/work/js/deno/tests/wpt/suite/$deno$eval:1:16
```

---------

Co-authored-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-05-23 13:55:07 +02:00
..
certs chore: move tools/wpt to tests/wpt/runner (#22545) 2024-03-05 00:41:16 +00:00
config.json chore: move tools/wpt to tests/wpt/runner (#22545) 2024-03-05 00:41:16 +00:00
expectation.json fix(ext/web): ReadableStream.from() ignores null Symbol.asyncIterator (#23910) 2024-05-23 13:55:07 +02:00
runner.ts chore: move tools/wpt to tests/wpt/runner (#22545) 2024-03-05 00:41:16 +00:00
testharnessreport.js chore: move tools/wpt to tests/wpt/runner (#22545) 2024-03-05 00:41:16 +00:00
utils.ts chore: ensure python@3.11 is installed for WPT tests (#23195) 2024-04-03 12:26:13 +11:00