SeaUrchinBot / closure-library

Automatically exported from code.google.com/p/closure-library
0 stars 0 forks source link

goog.fs.FileReader.readAsText does not work without explicit second parameter in Firefox #524

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago

What steps will reproduce the problem?
1. Create a goog.fs.FileReader instance
2. Listen for LOAD_END events
3. Read a file using: 
  a) .readAsText(f)
  b) .readAsText(f, null) 
  c) .readAsText(f, 'UTF-8')

A minimal example that does just that can be found at 
plus.martinmatysiak.de/closure-test/

What is the expected output? What do you see instead?

Expected: all three methods work and the LOAD_END event fires. `.getResult()` 
will return the file contents in each case. This is true for Chrome. 

On Firefox, the event is not being fired using the first method (without 
explicitly specifying the optional parameter 'opt_encoding') and the result is 
an empty string.

What version of the product are you using? On what operating system?

Closure-Library r2401
Example works in: Chrome 25.0.1364.5 dev
Does not work in: Firefox 17.0.1
Both tested under Ubuntu 12.10 (Linux version 3.5.0-21-generic)

Please provide any additional information below.

When using the FileReader object directly provided by the browser (without the 
Closure wrapper class), the same erroneous behavior can be achieved by calling 
`fileReader.readAsText(f, undefined);`. Calling `fileReader.readAsText(f);` 
works fine, though. In Chrome, both calls work.

From that I think the actual cause seems to be in the browser implementation 
rather than the closure library. But still, it _could_ be fixed here as well 
(e.g. by calling `this.reader_.readAsText(blob, opt_encoding || null);` in 
goog.fs.FileReader.readAsText). 

Original issue reported on code.google.com by kaktus621@gmail.com on 24 Dec 2012 at 10:12