Skip to content
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

Streams: when streaming a blob as a request body, bypass SpiderMonkey #26709

Open
gterzian opened this issue May 29, 2020 · 0 comments
Open

Streams: when streaming a blob as a request body, bypass SpiderMonkey #26709

gterzian opened this issue May 29, 2020 · 0 comments
Labels
A-content/script Related to the script thread A-network

Comments

@gterzian
Copy link
Member

gterzian commented May 29, 2020

Follow-up on #25873

In that PR, when a Blob is used as the BodyInit of a Request, we get a ReadableStream from the blob(see impl Extractable for Blob), then later as part of transmitting the body over the network(see TransmitBodyConnectHandler), we read chunks from the stream through SpiderMonkey(unless the blob has already been read into memory).

There's a couple of problem with that:

  1. It doesn't work with sync XHR(the event-loop is blocked so SM cannot read from the JS stream),
  2. It's unnecessary to go though the JS stream, since there is in fact no user provided JS stream.

So we should look into building a native stream, or perhaps no stream at all, in such a case.

The "no stream at all" might be feasible, since the data is coming from the net component, and that's also where it's going. Perhaps we can just pass around the file ID and then read it directly when transmitting the body, in a way similar to what is done when doing a scheme_fetch (see net/fetch/method.rs)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-content/script Related to the script thread A-network
Projects
None yet
Development

No branches or pull requests

1 participant