Skip to content

Commit 230fa4c

Browse files
committed
add a workaround for V8 ~ Chrome 53 bug with non-writable prototype of some methods, close #1083
1 parent 3b9b0bf commit 230fa4c

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## Changelog
22
##### Unreleased
3-
- Nothing
3+
- Added a workaround for V8 ~ Chrome 53 bug with non-writable prototype of some methods, [#1083](https://github.com/zloirock/core-js/issues/1083)
44

55
##### [3.22.6 - 2022.05.23](https://github.com/zloirock/core-js/releases/tag/v3.22.6)
66
- Fixed possible double call of `ToNumber` conversion on arguments of `Math.{ fround, trunc }` polyfills

packages/core-js/internals/make-built-in.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,12 @@ var makeBuiltIn = module.exports = function (value, name, options) {
2929
if (CONFIGURABLE_LENGTH && options && hasOwn(options, 'arity') && value.length !== options.arity) {
3030
defineProperty(value, 'length', { value: options.arity });
3131
}
32-
if (options && hasOwn(options, 'constructor') && options.constructor) {
33-
if (DESCRIPTORS) try {
34-
defineProperty(value, 'prototype', { writable: false });
35-
} catch (error) { /* empty */ }
36-
} else value.prototype = undefined;
32+
try {
33+
if (options && hasOwn(options, 'constructor') && options.constructor) {
34+
if (DESCRIPTORS) defineProperty(value, 'prototype', { writable: false });
35+
// in V8 ~ Chrome 53, prototypes of some methods, like `Array.prototype.values`, are non-writable
36+
} else if (value.prototype) value.prototype = undefined;
37+
} catch (error) { /* empty */ }
3738
var state = enforceInternalState(value);
3839
if (!hasOwn(state, 'source')) {
3940
state.source = TEMPLATE.join(typeof name == 'string' ? name : '');

0 commit comments

Comments
 (0)