Closed Bug 1051150 Opened 7 years ago Closed 7 years ago

FileReader is not defined in web workers


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

31 Branch
Not set





(Reporter: Matthew.Holt, Unassigned)


User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36

Steps to reproduce:

In a web worker, trying to instantiate or even reference the FileReader variable throws a ReferenceError:

var worker = new FileReader();

FileReaderSync may be easier to use, but is there really any reason to force developers to use the synchronous file reader in a web worker? Other browsers (like Chrome) allow use of FileReader in web workers.

More importantly, FileReaderSync performance is drastically worse than FileReader when chunking large files:

Though those results were measured in Chrome, similar performance issues were observed in Firefox, though the exact numbers were slightly different.

Between poor performance with FileReaderSync in Chrome/Firefox and the unavailability of FileReader in Firefox, scripts are forced to branch more wildly to use one or the other; for example, see this commit which has to handle using both FileReader and FileReaderSync:

In any case, FileReader should be exposed in web workers to prevent significant slowdown when reading large files and also to make the API more consistent for developers.

Actual results:

ReferenceError: FileReader is not defined

Expected results:

FileReader should be available in web workers.
Component: Untriaged → DOM
OS: Mac OS X → All
Product: Firefox → Core
Hardware: x86 → All
Good news, we're almost finished implementing this.
Closed: 7 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 901097
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.