From 023fde82f959343f06e65b135367dcd096499e7e Mon Sep 17 00:00:00 2001 From: "Namhyeon, Go" Date: Wed, 28 Apr 2021 11:08:44 +0900 Subject: [PATCH] [Fix] in WSH, `Object.getPrototypeOf([].values())` is falsy Closes https://github.com/es-shims/es5-shim/issues/476. --- es6-shim.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/es6-shim.js b/es6-shim.js index 0d99719a..45458836 100644 --- a/es6-shim.js +++ b/es6-shim.js @@ -1268,7 +1268,10 @@ // Chrome defines keys/values/entries on Array, but doesn't give us // any way to identify its iterator. So add our own shimmed field. if (Object.getPrototypeOf) { - addIterator(Object.getPrototypeOf([].values())); + var ChromeArrayIterator = Object.getPrototypeOf([].values()); + if (ChromeArrayIterator) { // in WSH, this is `undefined` + addIterator(ChromeArrayIterator); + } } // note: this is positioned here because it relies on Array#entries