Re: [whatwg/streams] Possible spec bug with concurrent byob reads (#1170)

Unfortunately, we can't, because the underlying byte source could have *transferred* the BYOB view's buffer:
```javascript
const view = c.byobRequest.view;
worker.postMessage(view, [view.buffer]);
c.close();
```
That's why we have to *wait* until the source (eventually) calls `.respond()` or `.respondWithNewView()`, for example:
```javascript
worker.onmessage = (event) => {
  c.byobRequest.respondWithNewView(event.message.view);
};
```
Only then we regain control over the BYOB view, allowing us to resolve the `read(view)` request(s).

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/issues/1170#issuecomment-933773946

Received on Monday, 4 October 2021 19:09:55 UTC