Closed Bug 1859853 Opened 2 years ago Closed 1 year ago

WritableStream write timing doesn't match with Blink/WebKit if start function is async

Categories

(Core :: DOM: Streams, defect, P3)

defect

Tracking

()

RESOLVED WONTFIX

People

(Reporter: saschanaz, Unassigned)

References

()

Details

(Whiteboard: dom-lws-bugdash-triage)

new WritableStream({
  async start() {},
  async write(chunk) {
    console.log(chunk)
  }
}).getWriter().write('write');
Promise.resolve('promise').then(console.log)

Gecko: promise and then write
Blink/WebKit: write and then promise

But not sure why, shouldn't the write operation wait for start promise here?

Flags: needinfo?(krosylight)

Hmm.

WebKit: it just uses Promise.resolve() instead of "a promise resolved with" steps: https://searchfox.org/wubkat/rev/afcea26699c7f4b151758a203f76cd4fb5ef68fe/Source/WebCore/Modules/streams/WritableStreamInternals.js#596

Blink: Somehow start algorithms are made to always wrapped with Promise.resolve() which then is used directly with .then() on it.

So nobody is doing what the spec says. The reference implementation follows the Gecko behavior as expected.

(But I don't think the spec has a point, why make extra promise at all here?)

Flags: needinfo?(krosylight)
See Also: → 1860083
Severity: -- → S3
Priority: -- → P3

This is not our defect, closing while keeping the spec issue open.

Status: NEW → RESOLVED
Closed: 1 year ago
Resolution: --- → WONTFIX
Whiteboard: dom-lws-bugdash-triage
You need to log in before you can comment on or make changes to this bug.