Closed Bug 1355369 Opened 9 years ago Closed 9 years ago

SlicedInputStream should be nsIAsyncInputStream only if the internal stream implements the that interface as well

Categories

(Core :: DOM: Core & HTML, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: baku, Assigned: baku)

References

Details

Attachments

(2 files)

Currently, SlicedInputStream is always an nsIAsyncInputStream, also when the internal stream is not. In this case, CloseWithStatus() and AsyncWait() return NS_ERROR_FAILURE.
Blocks: 1353629
Assignee: nobody → amarchesini
Attachment #8856852 - Flags: review?(bugs)
Attachment #8856950 - Flags: review?(bugs)
Attachment #8856852 - Attachment description: ipcBlob_7.patch → part 1 - the interface
Attachment #8856852 - Flags: review?(bugs) → review+
Comment on attachment 8856950 [details] [diff] [review] part 2 - AsyncWait > SlicedInputStream::AsyncWait(nsIInputStreamCallback* aCallback, > uint32_t aFlags, > uint32_t aRequestedCount, > nsIEventTarget* aEventTarget) > { > NS_ENSURE_STATE(mInputStream); > NS_ENSURE_STATE(mWeakAsyncInputStream); > >- return mWeakAsyncInputStream->AsyncWait(aCallback, aFlags, aRequestedCount, >+ // If we haven't start retrieving data, let's see if we can seek. s/start/started/ >+ // If we cannot seek, we will do consecutive reads. >+ if (mCurPos < mStart) { >+ nsCOMPtr<nsISeekableStream> seekableStream = >+ do_QueryInterface(mInputStream); >+ if (seekableStream) { Why you QI when we have mWeakSeekableInputStream ? >+ >+ if (mAsyncWaitCallback && aCallback) { >+ return NS_ERROR_FAILURE; >+ } >+ >+ mAsyncWaitCallback = aCallback; >+ >+ if (!mAsyncWaitCallback) { >+ return NS_OK; >+ } Odd to have this stuff after Seek. So, move Seek after this part? This all needs tests!
Attachment #8856950 - Flags: review?(bugs) → review+
Pushed by amarchesini@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/11b1cea5a2e7 SlicedInputStream should expose nsIAsyncInputStream interface only when needed, r=smaug https://hg.mozilla.org/integration/mozilla-inbound/rev/4473199dca26 SlicedInputStream must implement AsyncWait correctly, r=smaug https://hg.mozilla.org/integration/mozilla-inbound/rev/cd7c31a01d5c gtests for SlicedInputStream and ASyncWait, r=me
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: