Fixed shims from not displaying debug information.

This commit is contained in:
Richard Moore 2021-03-07 17:37:49 -05:00
parent c5a53d6911
commit a953f71752
No known key found for this signature in database
GPG Key ID: 665176BE8E9DC651

@ -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");
}