-
Notifications
You must be signed in to change notification settings - Fork 166
Add state checks to Close() and Enqueue() #1029
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Exit early from abstract operations ReadableStreamDefaultControllerClose() and ReadableStreamDefaultControllerEnqueue() if ReadableStreamDefaultControllerCanCloseOrEnqueue() is false. Remove the asserts that it is true, and the requirement that callers perform the check as part of the interface contract. In practice the implementation of ReadableStreamTee() was failing to properly check CanCloseOrEnqueue(). By relaxing the interface contract we can prevent similar problems with future standards. Also remove a now-redundant check of CanCloseOrEnqueue() in TransformStreamDefaultControllerTerminate(). Also make similar changes to ReadableByteStreamControllerClose() and ReadableByteStreamControllerEnqueue().
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Tests?
It doesn't appear to be possible to reproduce the problem with |
As best I understand things, microtasks shouldn't be able to be made to be run synchronously. If some spec is failing to properly defer a microtask checkpoint, that's just a bug in the spec. Or am I somehow wrong about this? |
This is how it's done in Chromium: I don't know if that's a spec bug or an implementation bug. |
Implementation bug. Per spec, that getter runs at https://heycam.github.io/webidl/#call-a-user-objects-operation step 10.1. But step 7 of that algorithm calls https://html.spec.whatwg.org/multipage/webappapis.html#prepare-to-run-script which pushes a JS execution context on the stack. After that, until the matching https://html.spec.whatwg.org/multipage/webappapis.html#clean-up-after-running-script (which happens in step 15.2), there should be no microtask checkpoints. |
Exit early from abstract operations ReadableStreamDefaultControllerClose() and ReadableStreamDefaultControllerEnqueue() if ReadableStreamDefaultControllerCanCloseOrEnqueue() is false. Remove the asserts that it is true, and the requirement that callers perform the check as part of the interface contract. In practice the implementation of ReadableStreamTee() was failing to properly check CanCloseOrEnqueue(). By relaxing the interface contract we can prevent similar problems with future standards. Also remove a now-redundant check of CanCloseOrEnqueue() in TransformStreamDefaultControllerTerminate(). Also make similar changes to ReadableByteStreamControllerClose() and ReadableByteStreamControllerEnqueue().
Exit early from abstract operations
ReadableStreamDefaultControllerClose() and
ReadableStreamDefaultControllerEnqueue() if
ReadableStreamDefaultControllerCanCloseOrEnqueue() is false. Remove the
asserts that it is true, and the requirement that callers perform the
check as part of the interface contract.
In practice the implementation of ReadableStreamTee() was failing to
properly check CanCloseOrEnqueue(). By relaxing the interface contract
we can prevent similar problems with future standards.
Also remove a now-redundant check of CanCloseOrEnqueue() in
TransformStreamDefaultControllerTerminate().
Also make similar changes to ReadableByteStreamControllerClose() and
ReadableByteStreamControllerEnqueue().
Preview | Diff