Closed Bug 1359359 Opened 4 years ago Closed 4 years ago

FileReaderSync should be able to read from a nsIAsyncInputStream

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

(3 files)

Currently FileReaderSync wants a sync nsIInputStream.
It's not able to deal with the new IPCBlobInputStream.
Right now this is executed on the current thread. This is not compatible with the use of IPCBlobInputStream in sync event loop in workers.
Assignee: nobody → amarchesini
Attachment #8861351 - Flags: review?(bugs)
Attached patch part 2 - testsSplinter Review
Attachment #8861353 - Flags: review?(bugs)
Blocks: 1353629
Attachment #8861351 - Flags: review?(bugs) → review+
Attachment #8861352 - Flags: review?(bugs) → review+
Comment on attachment 8861353 [details] [diff] [review]
part 2 - tests

>+let workerUrl = URL.createObjectURL(new Blob(["(", workerScript.toSource(), ")()"]));
>+let worker = new Worker(workerUrl);
>+worker.onmessage = event => {
>+  ok(event.data.length, "The file has been read");
I would prefer if this tested that the expected data was actually read.

Could you for example read the data asynchronously in the main thread and then compare that the _exactly_ same
data is read synchronously in worker as is asynchronously in main thread. 

With that, r+
Attachment #8861353 - Flags: review?(bugs) → review+
And please ensure that there are also tests for memory blob reading with workers!
That too is required for the r+.
Pushed by amarchesini@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/b65172f39db5
IPCBlobInputStream should execute StreamReady() in the target thread of AsyncWait, r=smaug
https://hg.mozilla.org/integration/mozilla-inbound/rev/25c997594daa
FileReaderSync should support nsIAsyncInputStream, r=smaug
https://hg.mozilla.org/integration/mozilla-inbound/rev/46389058f13d
Tests for FileReaderSync and IPCBlobInputStream, r=smaug
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.