You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Calling cancel(reason) on a locked readable stream should not cause invalid state error. I cannot see anything that would say so in the spec and doing so causes incompatibility with the fetch spec.
Exactly what @Svanazar said. Throwing is the correct behavior. The rationale is that when a stream is locked, the reader takes over ownership of its lifecycle. The reader to which the stream is locked can cancel it but the stream itself cannot be directly canceled while locked.
Activity
Svanazar commentedon Apr 21, 2022
I am not sure if it is relevant but a section on
cancel(reason)seems to be mentioning this behavior:from https://streams.spec.whatwg.org/#rs-cancel
jasnell commentedon Apr 21, 2022
Exactly what @Svanazar said. Throwing is the correct behavior. The rationale is that when a stream is locked, the reader takes over ownership of its lifecycle. The reader to which the stream is locked can cancel it but the stream itself cannot be directly canceled while locked.