From 3eb5ce7d9a4d118a262e05cf2eb096feca4fe7b2 Mon Sep 17 00:00:00 2001 From: Anton Bannykh Date: Wed, 29 Mar 2017 19:55:24 +0300 Subject: [PATCH] JS: polyfill ArrayBuffer.isView in order to support PhantomJS --- js/js.libraries/src/js/polyfills.js | 6 ++++++ libraries/tools/kotlin-js-tests/src/test/web/index.html | 7 ------- 2 files changed, 6 insertions(+), 7 deletions(-) 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 @@ -