satazor / js-spark-md5

Lightning fast normal and incremental md5 for javascript
Do What The F*ck You Want To Public License
2.46k stars 469 forks source link

Wrong opera results with the new array buffer class #7

Closed satazor closed 11 years ago

satazor commented 11 years ago

Investigate this issue.

stakach commented 11 years ago

Solved the issue - opera requires you to instantiate a new FileReader for every call to readAsArrayBuffer otherwise it returns the same results as the first call for every subsequent call.

So really the issue is with the tests / a bug in opera.

I'll request a pull a bit later in the week.

satazor commented 11 years ago

@stakach I've updated the examples. Is this bug reported to opera?

stakach commented 11 years ago

Yeah, sent a report. Took forever to find, I often forget to test things against Opera. Crashed every time I tried to inspect any ArrayBuffer.

In fact, line 93 e.target.result.byteLength; of file_reader.html is how I confirmed the bug. (Could be removed)

The only inspect-able difference between Chrome and Opera was that the _length variable was a different size in the final state.

satazor commented 11 years ago

@stakach My only concern with the current example code is that a FileReader is being instantiated in each iteration for every browser. Is there a way for us to test if the bug exists and provide different loadNext() functions (one that instantiates, and other that does not)? Maybe by analyzing the e.target.result.byteLength? If not, we will need to wait until we see the Opera release that fixes the issue and provide the slower loadNext() only for Opera's older than that release.

Can you please provide me the link of the report?

stakach commented 11 years ago

Not sure if it is the most detectable behaviour. Very surprising. They don't really give you a link:

Dear Opera User,

This is to acknowledge that we have received your bug report, with the ID: DSK-379396. You may wish to keep this ID for future reference.

All bug reports are read and handled by our staff. However, please note that you will not receive a personal reply to the bug report, unless we need more information to investigate the bug.

We are not able to respond to questions and queries through the bug tracking system. To get help with Opera, please visit http://www.opera.com/support/.

You can use this e-mail address (or reply to this e-mail) to update your report with more information, such as screenshots, crash logs, code examples, and so on:

DSK-379396@bugs.opera.com.

Summary: fileReader.readAsArrayBuffer only works once

URL: https://github.com/satazor/SparkMD5/pull/9

Steps to reproduce

  1. Instantiate an instance of FileReader
  2. Read a segment of a file using readAsArrayBuffer
  3. Read a different segment of a file using the same instance
  4. You'll notice the results are always the same.
  5. Instantiate a new instance of FileReader
  6. The different segment is now actually different

Expected result

Each call to readAsArrayBuffer should return different results if different parts of a file are being requested

Actual result

The result returned in the first call is always returned no matter the parameters supplied in subsequent calls

satazor commented 11 years ago

Really? Nice one opera..

I might update the example code to provide the slower loadNext() only for Opera.. Going to create a separate issue for this.

Thanks a lot!

satazor commented 11 years ago

@stakach Any news regarding the bug in Opera? Did they fixed it?