From f40efd833f748b3619f37c1a3dfdf1d5c0819813 Mon Sep 17 00:00:00 2001 From: Denis Pushkarev Date: Mon, 9 Apr 2018 09:41:52 +0700 Subject: [PATCH] fix #392, #393 --- modules/es6.reflect.set.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/es6.reflect.set.js b/modules/es6.reflect.set.js index e2a89816c3f3..d809d7a4ef4e 100644 --- a/modules/es6.reflect.set.js +++ b/modules/es6.reflect.set.js @@ -20,9 +20,11 @@ function set(target, propertyKey, V /* , receiver */) { } if (has(ownDesc, 'value')) { if (ownDesc.writable === false || !isObject(receiver)) return false; - existingDescriptor = gOPD.f(receiver, propertyKey) || createDesc(0); - existingDescriptor.value = V; - dP.f(receiver, propertyKey, existingDescriptor); + if (existingDescriptor = gOPD.f(receiver, propertyKey)) { + if (existingDescriptor.get || existingDescriptor.set || existingDescriptor.writable === false) return false; + existingDescriptor.value = V; + dP.f(receiver, propertyKey, existingDescriptor); + } else dP.f(receiver, propertyKey, createDesc(0, V)); return true; } return ownDesc.set === undefined ? false : (ownDesc.set.call(receiver, V), true);