JS: polyfill ArrayBuffer.isView in order to support PhantomJS

This commit is contained in:
Anton Bannykh
2017-03-29 19:55:24 +03:00
parent dac9ed4a33
commit 3eb5ce7d9a
2 changed files with 6 additions and 7 deletions
+6
View File
@@ -31,3 +31,9 @@ if (typeof String.prototype.endsWith === "undefined") {
return lastIndex !== -1 && lastIndex === position;
};
}
// For HtmlUnit and PhantomJs
if (typeof ArrayBuffer.isView === "undefined") {
ArrayBuffer.isView = function(a) {
return a != null && a.__proto__ != null && a.__proto__.__proto__ === Int8Array.prototype.__proto__;
};
}