diff --git a/CHANGELOG.md b/CHANGELOG.md index e391210ee435..4826ec6499c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ ## Changelog ##### Unreleased -- Nothing +- Added a workaround for V8 ~ Chrome 53 bug with non-writable prototype of some methods, [#1083](https://github.com/zloirock/core-js/issues/1083) ##### [3.22.6 - 2022.05.23](https://github.com/zloirock/core-js/releases/tag/v3.22.6) - Fixed possible double call of `ToNumber` conversion on arguments of `Math.{ fround, trunc }` polyfills diff --git a/packages/core-js/internals/make-built-in.js b/packages/core-js/internals/make-built-in.js index 684e9ab09688..5963b2cda625 100644 --- a/packages/core-js/internals/make-built-in.js +++ b/packages/core-js/internals/make-built-in.js @@ -29,11 +29,12 @@ var makeBuiltIn = module.exports = function (value, name, options) { if (CONFIGURABLE_LENGTH && options && hasOwn(options, 'arity') && value.length !== options.arity) { defineProperty(value, 'length', { value: options.arity }); } - if (options && hasOwn(options, 'constructor') && options.constructor) { - if (DESCRIPTORS) try { - defineProperty(value, 'prototype', { writable: false }); - } catch (error) { /* empty */ } - } else value.prototype = undefined; + try { + if (options && hasOwn(options, 'constructor') && options.constructor) { + if (DESCRIPTORS) defineProperty(value, 'prototype', { writable: false }); + // in V8 ~ Chrome 53, prototypes of some methods, like `Array.prototype.values`, are non-writable + } else if (value.prototype) value.prototype = undefined; + } catch (error) { /* empty */ } var state = enforceInternalState(value); if (!hasOwn(state, 'source')) { state.source = TEMPLATE.join(typeof name == 'string' ? name : '');