Fix #59, issue with the android default browser #60

Merged
merged 1 commit into from Oct 5, 2013

Projects

None yet

2 participants

@dduponchel
Collaborator

The default android browser shows some weird behavior... On some
versions String.fromCharCode.apply on a ArrayBuffer/Uint8Array will
fail, on other versions subarray returns wrong results
(u8with4elements.subarray(0, 65536) = u8with22elements).

@dduponchel dduponchel Fix #59, issue with android default browser
The default android browser shows some weird behavior... On some
versions String.fromCharCode.apply on a ArrayBuffer/Uint8Array will
fail, on other versions subarray return wrong results
(u8with4elements.subarray(0, 65536) = u8with22elements).

At least, I can test this on the android emulator on linux.
aa7cb81
@Stuk Stuk commented on the diff Aug 10, 2013
@@ -1120,12 +1120,36 @@ JSZip.support = {
var chunk = 65536;
var result = [], len = array.length, type = JSZip.utils.getTypeOf(array), k = 0;
+ var canUseApply = true;
+ try {
+ switch(type) {
+ case "uint8array":
+ String.fromCharCode.apply(null, new Uint8Array(0));
+ break;
+ case "nodebuffer":
+ String.fromCharCode.apply(null, new Buffer(0));
+ break;
+ }
+ } catch(e) {
+ canUseApply = false;
+ }
@Stuk
Stuk Aug 10, 2013 Owner

Wow, what's broken with apply?

@dduponchel
dduponchel Aug 10, 2013 Collaborator

Some versions of the default android browser (4.x, tested in the emulator) doesn't accept ArrayBuffer or Uint8Array for apply, only arrays : I get a TypeError: Function.prototype.apply: Arguments list has wrong type.

@Stuk Stuk merged commit 5da7854 into Stuk:master Oct 5, 2013
@dduponchel dduponchel deleted the dduponchel:issue59 branch Oct 30, 2013
@dduponchel dduponchel referenced this pull request Jan 30, 2014
Closed

node 0.8 file name issue #84

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment