Closed Bug 1897793 Opened 4 months ago Closed 4 months ago

[wpt-sync] Sync PR 46374 - Fix ReadableStream.from ignores a null @@asyncIterator

Categories

(Core :: DOM: Streams, task, P4)

task

Tracking

()

RESOLVED FIXED
128 Branch
Tracking Status
firefox128 --- fixed

People

(Reporter: wpt-sync, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

Sync web-platform-tests PR 46374 into mozilla-central (this bug is closed when the sync is complete).

PR: https://github.com/web-platform-tests/wpt/pull/46374
Details from upstream follow.

Milly <milly.ca@gmail.com> wrote:

Fix ReadableStream.from ignores a null @@asyncIterator

The proposal 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.

This change breaks Deno v1.43.5 and Node v20.13.1.
However, Firefox 126.0 are implemented correctly.

Similarly, null @@iterator is ignored, but there is no fallback, so its expected result is throws no-iterator-found TypeError, which is indistinguishable from not-callable TypeError.

> 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

> node -e "ReadableStream.from({ [Symbol.asyncIterator]: null, [Symbol.iterator]: () => ({ next: () => ({ done: true }) }) }).pipeTo(new WritableStream())"
node:internal/webstreams/util:250
  const iterator = FunctionPrototypeCall(method, obj);
                   ^

TypeError: FunctionPrototypeCall is not a function
    at getIterator (node:internal/webstreams/util:250:20)
    at readableStreamFromIterable (node:internal/webstreams/readablestream:1279:26)
    at ReadableStream.from (node:internal/webstreams/readablestream:324:12)
    at [eval]:1:16
    at runScriptInThisContext (node:internal/vm:209:10)
    at node:internal/process/execution:118:14
    at [eval]-wrapper:6:24
    at runScript (node:internal/process/execution:101:62)
    at evalScript (node:internal/process/execution:133:3)
    at node:internal/main/eval_string:51:3

Node.js v20.13.1
Component: web-platform-tests → DOM: Streams
Product: Testing → Core

CI Results

Ran 9 Firefox configurations based on mozilla-central, and Firefox, Chrome, and Safari on GitHub CI

Total 5 tests and 39 subtests

Status Summary

Firefox

OK : 4
PASS : 156
ERROR : 1

Chrome

OK : 3
PASS : 33
FAIL : 84
TIMEOUT: 1
ERROR : 1

Safari

OK : 4
PASS : 44
FAIL : 112
ERROR : 1

Links

Gecko CI (Treeherder)
GitHub PR Head
GitHub PR Base

Details

New Tests That Don't Pass

Pushed by wptsync@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/ac6f25272e8f [wpt PR 46374] - Fix ReadableStream.from ignores a null @@asyncIterator, a=testonly
Status: NEW → RESOLVED
Closed: 4 months ago
Resolution: --- → FIXED
Target Milestone: --- → 128 Branch
You need to log in before you can comment on or make changes to this bug.