Last Comment Bug 1051150 - FileReader is not defined in web workers
: FileReader is not defined in web workers
Status: RESOLVED DUPLICATE of bug 901097
Product: Core
Classification: Components
Component: DOM (show other bugs)
: 31 Branch
: All All
-- normal (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
: Andrew Overholt [:overholt]
Depends on:
  Show dependency treegraph
Reported: 2014-08-08 20:02 PDT by Matthew.Holt
Modified: 2014-08-09 09:44 PDT (History)
2 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Description User image Matthew.Holt 2014-08-08 20:02:26 PDT
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.
Comment 1 User image Kyle Huey [:khuey] (Exited; not receiving bugmail, email if necessary) 2014-08-09 09:44:32 PDT
Good news, we're almost finished implementing this.

*** This bug has been marked as a duplicate of bug 901097 ***

Note You need to log in before you can comment on or make changes to this bug.