Workaround for #6

Also removing can_apply_typed_arrays stuff since the workaround makes it unused
This commit is contained in:
Eli Grey
2013-07-30 11:09:29 -04:00
parent 107c648d6f
commit 504b2a26d6
+9 -21
View File
@@ -50,10 +50,6 @@ else var Blob = (function (view) {
, URL = real_URL , URL = real_URL
, btoa = view.btoa , btoa = view.btoa
, atob = view.atob , atob = view.atob
, can_apply_typed_arrays = false
, can_apply_typed_arrays_test = function(pass) {
can_apply_typed_arrays = !pass;
}
, ArrayBuffer = view.ArrayBuffer , ArrayBuffer = view.ArrayBuffer
, Uint8Array = view.Uint8Array , Uint8Array = view.Uint8Array
@@ -62,11 +58,6 @@ else var Blob = (function (view) {
while (file_ex_code--) { while (file_ex_code--) {
FileException.prototype[file_ex_codes[file_ex_code]] = file_ex_code + 1; 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) { if (!real_URL.createObjectURL) {
URL = view.URL = {}; URL = view.URL = {};
} }
@@ -102,19 +93,16 @@ else var Blob = (function (view) {
var bb = this.data; var bb = this.data;
// decode data to a binary string // decode data to a binary string
if (Uint8Array && (data instanceof ArrayBuffer || data instanceof Uint8Array)) { if (Uint8Array && (data instanceof ArrayBuffer || data instanceof Uint8Array)) {
if (can_apply_typed_arrays) { var
bb.push(String.fromCharCode.apply(String, new Uint8Array(data))); str = ""
} else { , buf = new Uint8Array(data)
var , i = 0
str = "" , buf_len = buf.length
, buf = new Uint8Array(data) ;
, i = 0 for (; i < buf_len; i++) {
, buf_len = buf.length str += String.fromCharCode(buf[i]);
;
for (; i < buf_len; i++) {
str += String.fromCharCode(buf[i]);
}
} }
bb.push(str);
} else if (get_class(data) === "Blob" || get_class(data) === "File") { } else if (get_class(data) === "Blob" || get_class(data) === "File") {
if (FileReaderSync) { if (FileReaderSync) {
var fr = new FileReaderSync; var fr = new FileReaderSync;