FileReader is not defined in web workers

RESOLVED DUPLICATE of bug 901097

Status

()

Core
DOM
RESOLVED DUPLICATE of bug 901097
3 years ago
3 years ago

People

(Reporter: Matthew.Holt, Unassigned)

Tracking

31 Branch
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

3 years ago
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.
Component: Untriaged → DOM
OS: Mac OS X → All
Product: Firefox → Core
Hardware: x86 → All
Good news, we're almost finished implementing this.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 901097
You need to log in before you can comment on or make changes to this bug.