Fixed shims from not displaying debug information.
This commit is contained in:
parent
c5a53d6911
commit
a953f71752
@ -85,27 +85,25 @@
|
||||
var fr = new FileReader();
|
||||
try {
|
||||
fr.readAsArrayBuffer(new Blob([ "hello" ], { type: "text/plain" }));
|
||||
return;
|
||||
} catch (error) { }
|
||||
|
||||
shims.push("FileReader.prototype.readAsArrayBuffer");
|
||||
FileReader.prototype.readAsArrayBuffer = function (blob) {
|
||||
if (this.readyState === this.LOADING) throw new Error("InvalidStateError");
|
||||
this._setReadyState(this.LOADING);
|
||||
this._result = null;
|
||||
this._error = null;
|
||||
var fr = new FileReader();
|
||||
fr.onloadend = () => {
|
||||
var content = atob(fr.result.split(",").pop().trim());
|
||||
var buffer = new ArrayBuffer(content.length);
|
||||
var view = new Uint8Array(buffer);
|
||||
view.set(Array.from(content).map(c => c.charCodeAt(0)));
|
||||
this._result = buffer;
|
||||
this._setReadyState(this.DONE);
|
||||
};
|
||||
fr.readAsDataURL(blob);
|
||||
} catch (error) {
|
||||
shims.push("FileReader.prototype.readAsArrayBuffer");
|
||||
FileReader.prototype.readAsArrayBuffer = function (blob) {
|
||||
if (this.readyState === this.LOADING) { throw new Error("InvalidStateError"); }
|
||||
this._setReadyState(this.LOADING);
|
||||
this._result = null;
|
||||
this._error = null;
|
||||
var fr = new FileReader();
|
||||
fr.onloadend = () => {
|
||||
var content = atob(fr.result.split(",").pop().trim());
|
||||
var buffer = new ArrayBuffer(content.length);
|
||||
var view = new Uint8Array(buffer);
|
||||
view.set(Array.from(content).map(c => c.charCodeAt(0)));
|
||||
this._result = buffer;
|
||||
this._setReadyState(this.DONE);
|
||||
};
|
||||
fr.readAsDataURL(blob);
|
||||
}
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.log("Missing FileReader; unsupported platform");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user