Open Bug 1602747 Opened 5 years ago Updated 2 years ago

Move IO stream handling to DOM streams

Categories

(Remote Protocol :: CDP, task, P3)

task

Tracking

(Not tracked)

People

(Reporter: whimboo, Unassigned)

References

(Blocks 2 open bugs)

Details

To support a variety of stream types (like Fetch, Blob, File) in the future we should make use of the DOM streams API. This decision came out from the review of https://phabricator.services.mozilla.com/D55968, but might need more work to do. As such it has been filed as a follow-up bug to not block us from getting the File streaming out.

Things to care about here:

  • Use File.createFromNsIFile(your nsIFile) to create a DOM file instance, and it's stream() method for fetching the stream.
  • Use stream.getReader() to work with the actual stream. See this review comment for details.
  • seek is not implemented for reader, so would have to write our own implementation
  • What happens with overlapping calls to IO.read?

When I filed a crash bug for Chromium in regards IO.read for negative size I noticed the following test file for blobs:

https://chromium.googlesource.com/chromium/src/+/9e9b1128e2602bd045a00df34e469db65de53590/third_party/blink/web_tests/inspector-protocol/io/blob-streams.js

They create testable blob streams via evaluate and IO.resolveBlob.

When moving to the new API we should try to also limit the amount of open file handles. Lets see how we could handle that with DOM streams, also by having the performance in mind. We don't want to close and reopen, and seek for each and every read call.

Component: CDP: IO → CDP
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.