Open Bug 1859853 Opened 8 months ago Updated 8 months ago

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

Categories

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

defect

Tracking

()

People

(Reporter: saschanaz, Unassigned)

References

()

Details

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
You need to log in before you can comment on or make changes to this bug.