Closed Bug 1360476 Opened 4 years ago Closed 4 years ago

IPCBlobInputStream needs to be seekable on the parent side

Categories

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

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: baku, Assigned: baku)

References

Details

Attachments

(1 file, 1 obsolete file)

When a IPCBlobInputStream child actor is running in the parent process, necko treats it as a 'regular' inputStream and it tries to QI to nsISeekableInputStream.
This issue appears because of the porting of IDB to IPCBlob.
Blocks: 1353629
Attached patch seekable.patch (obsolete) — Splinter Review
Assignee: nobody → amarchesini
Attachment #8862752 - Flags: review?(bugs)
Why do we need this fix? What is broken now? Why that brokenness isn't something noticed by tests?
Comment on attachment 8862752 [details] [diff] [review]
seekable.patch

>+bool
>+IPCBlobInputStream::IsSeekableStream() const
>+{
>+  // We are nsISeekableStream only if we have the remote stream and that is a
>+  // nsISeekableStream.
This comment is in wrong place. Should be next to do_QueryInterface(mRemoteStream);

>+
>+  if (mState != eRunning) {
>+    return false;
>+  }
This needs a comment. Or, is there actually any need for this check?

>+
>+  MOZ_ASSERT(mRemoteStream);
>+  nsCOMPtr<nsISeekableStream> seekableStream = do_QueryInterface(mRemoteStream);
>+  return !!seekableStream;
since you anyhow have this



>+IPCBlobInputStream::Seek(int32_t aWhence, int64_t aOffset)
>+{
>+  if (mState != eRunning) {
>+    return NS_BASE_STREAM_CLOSED;
>+  }
>+
>+  MOZ_ASSERT(mRemoteStream);
>+  nsCOMPtr<nsISeekableStream> seekableStream = do_QueryInterface(mRemoteStream);
>+  if (!seekableStream) {
>+    return NS_ERROR_FAILURE;
>+  }
and can't we do similar thing here. Just rely on the QI, no need to check mState


>+IPCBlobInputStream::Tell(int64_t *aResult)
nit, * goes with type

>+{
>+  if (mState != eRunning) {
>+    return NS_BASE_STREAM_CLOSED;
>+  }
>+
>+  MOZ_ASSERT(mRemoteStream);
>+  nsCOMPtr<nsISeekableStream> seekableStream = do_QueryInterface(mRemoteStream);
>+  if (!seekableStream) {
>+    return NS_ERROR_FAILURE;
>+  }
I guess here too?
Attachment #8862752 - Flags: review?(bugs) → review-
Attached patch seekable.patchSplinter Review
Attachment #8862752 - Attachment is obsolete: true
Attachment #8862764 - Flags: review?(bugs)
Attachment #8862764 - Flags: review?(bugs) → review+
Pushed by amarchesini@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/03213181829e
IPCBlobInputStream needs to be seekable on the parent side, r=smaug
Pushed by amarchesini@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/c460929df438
IPCBlobInputStream needs to be seekable on the parent side, r=me
https://hg.mozilla.org/mozilla-central/rev/03213181829e
https://hg.mozilla.org/mozilla-central/rev/c460929df438
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.