From 504b2a26d6b58081ac915ef378866d477c80967f Mon Sep 17 00:00:00 2001 From: Eli Grey Date: Tue, 30 Jul 2013 11:09:29 -0400 Subject: [PATCH] Workaround for #6 Also removing can_apply_typed_arrays stuff since the workaround makes it unused --- Blob.js | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/Blob.js b/Blob.js index 2d7dc62..8aa6731 100644 --- a/Blob.js +++ b/Blob.js @@ -50,10 +50,6 @@ else var Blob = (function (view) { , URL = real_URL , btoa = view.btoa , atob = view.atob - , can_apply_typed_arrays = false - , can_apply_typed_arrays_test = function(pass) { - can_apply_typed_arrays = !pass; - } , ArrayBuffer = view.ArrayBuffer , Uint8Array = view.Uint8Array @@ -62,11 +58,6 @@ else var Blob = (function (view) { while (file_ex_code--) { FileException.prototype[file_ex_codes[file_ex_code]] = file_ex_code + 1; } - try { - if (Uint8Array) { - can_apply_typed_arrays_test.apply(0, new Uint8Array(1)); - } - } catch (ex) {} if (!real_URL.createObjectURL) { URL = view.URL = {}; } @@ -102,19 +93,16 @@ else var Blob = (function (view) { var bb = this.data; // decode data to a binary string if (Uint8Array && (data instanceof ArrayBuffer || data instanceof Uint8Array)) { - if (can_apply_typed_arrays) { - bb.push(String.fromCharCode.apply(String, new Uint8Array(data))); - } else { - var - str = "" - , buf = new Uint8Array(data) - , i = 0 - , buf_len = buf.length - ; - for (; i < buf_len; i++) { - str += String.fromCharCode(buf[i]); - } + var + str = "" + , buf = new Uint8Array(data) + , i = 0 + , buf_len = buf.length + ; + for (; i < buf_len; i++) { + str += String.fromCharCode(buf[i]); } + bb.push(str); } else if (get_class(data) === "Blob" || get_class(data) === "File") { if (FileReaderSync) { var fr = new FileReaderSync;