diff --git a/js/js.libraries/src/js/polyfills.js b/js/js.libraries/src/js/polyfills.js
index 60e8593cc2e..47ee982a247 100644
--- a/js/js.libraries/src/js/polyfills.js
+++ b/js/js.libraries/src/js/polyfills.js
@@ -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__;
+ };
+}
\ No newline at end of file
diff --git a/libraries/tools/kotlin-js-tests/src/test/web/index.html b/libraries/tools/kotlin-js-tests/src/test/web/index.html
index c56f59c7193..1bc0bf976b6 100644
--- a/libraries/tools/kotlin-js-tests/src/test/web/index.html
+++ b/libraries/tools/kotlin-js-tests/src/test/web/index.html
@@ -10,13 +10,6 @@
-