Security

(public)

User Story

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:
http://stackoverflow.com/questions/24708649/why-does-web-worker-performance-sharply-decline-after-30-seconds
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: https://github.com/mholt/PapaParse/commit/553f5d7e396dd39f155007e9889ff6ba2e3b321a
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.