From 4af6233ac66ecf0c9d0c9802e96abe065511bd34 Mon Sep 17 00:00:00 2001 From: Denis Pushkarev Date: Tue, 27 Oct 2020 21:04:09 +0700 Subject: [PATCH] add a workaround for 3rd party `Reflect.set` polyfill bug, #847 --- CHANGELOG.md | 1 + packages/core-js/modules/es.reflect.set.js | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 76ce94948edf..48af8af2f6c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ##### Unreleased - `String#replaceAll` moved to the stable ES, [per Jun TC39 meeting](https://github.com/tc39/notes/blob/master/meetings/2020-06/june-2.md#stringprototypereplaceall-for-stage-4) - `process.nextTick` have a less priority when `Promise` in the microtask implementation, [#855](https://github.com/zloirock/core-js/issues/855) +- Added a workaround for 3rd party `Reflect.set` polyfill bug, [#847](https://github.com/zloirock/core-js/issues/847) ##### 3.6.5 - 2020.04.09 - Updated Browserlist [#755](https://github.com/zloirock/core-js/issues/755) diff --git a/packages/core-js/modules/es.reflect.set.js b/packages/core-js/modules/es.reflect.set.js index a16b762e168f..9949bb3afcaa 100644 --- a/packages/core-js/modules/es.reflect.set.js +++ b/packages/core-js/modules/es.reflect.set.js @@ -35,9 +35,10 @@ function set(target, propertyKey, V /* , receiver */) { // MS Edge 17-18 Reflect.set allows setting the property to object // with non-writable property on the prototype var MS_EDGE_BUG = fails(function () { - var object = definePropertyModule.f({}, 'a', { configurable: true }); + var Constructor = function () { /* empty */ }; + var object = definePropertyModule.f(new Constructor(), 'a', { configurable: true }); // eslint-disable-next-line no-undef - return Reflect.set(getPrototypeOf(object), 'a', 1, object) !== false; + return Reflect.set(Constructor.prototype, 'a', 1, object) !== false; }); $({ target: 'Reflect', stat: true, forced: MS_EDGE_BUG }, {