Closed Bug 1393769 Opened 7 years ago Closed 2 years ago

Consider to return a nsIAsyncInputStream in BlobImpl::CreateInputStream

Categories

(Core :: DOM: File, enhancement, P5)

enhancement

Tracking

()

RESOLVED INVALID

People

(Reporter: baku, Unassigned)

References

Details

Currently a BlobImpl returns a generic nsIInputStream. But doing this, FileReader and other APIs have to check if that stream is an nsIAsyncInputStream and in case it's not, they have to use nsITransport (or a pipe) and read off the current thread (often the main-thread).

Would be nice to return a nsIASyncInputStream always. Currently the only non-nsIAsyncInputStreams are FileBlobImpl objects. Maybe we can create a wrapper around those inputStreams and make them nsIAsyncInputStream as well.
Priority: -- → P3

Bulk-downgrade of unassigned, untouched DOM/Storage bug's priority.

If you have reason to believe, this is wrong, please write a comment and ni :jstutte.

Severity: normal → S4
Priority: P3 → P5

(It's renamed years ago)

See Also: → 1404845
Summary: Consider to return a nsIAsyncInputStream in BlobImpl::GetInternalStream → Consider to return a nsIAsyncInputStream in BlobImpl::CreateInputStream

Currently the only non-nsIAsyncInputStreams are FileBlobImpl objects.

This is not true since it currently returns SlicedInputStream which implements nsIAsyncInputStream: https://searchfox.org/mozilla-central/rev/4ef183d00fcd61e80399c14a2e5c7dff529ab388/dom/file/FileBlobImpl.cpp#265

That said, StringInputStream used by several BlobImpls is still non-nsIAsyncInputStream.

FileReader and other APIs have to check if that stream is an nsIAsyncInputStream and in case it's not, they have to use nsITransport (or a pipe) and read off the current thread (often the main-thread).

Bug 1371699 fixed this by introducing NonBlockingAsyncInputStream.

So this is not relevant anymore, closing.

Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.