From e7f0f2ffc15db2dccfcd1724d1e65d155af44750 Mon Sep 17 00:00:00 2001 From: Mike Gerwitz Date: Fri, 28 Mar 2014 23:51:39 -0400 Subject: [PATCH] Removed fallback check on each defineSecureProp call This check was originally added because IE8's implementation is broken. However, we already perform a test in the `can_define_prop` configuration, so this is not necessary (it seems to be a relic). --- lib/util.js | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/lib/util.js b/lib/util.js index 868c6c8..d138b17 100644 --- a/lib/util.js +++ b/lib/util.js @@ -562,8 +562,8 @@ exports.defineSecureProp( exports.getPropertyDescriptor, 'canTraverse', /** - * Appropriately returns defineSecureProp implementation to avoid check on each - * invocation + * Appropriately returns defineSecureProp implementation to avoid check on + * each invocation * * @return {function( Object, string, * )} */ @@ -584,26 +584,14 @@ function getDefineSecureProp() // uses ECMAScript 5's Object.defineProperty() method return function( obj, prop, value ) { - try + Object.defineProperty( obj, prop, { - Object.defineProperty( obj, prop, - { - value: value, + value: value, - enumerable: false, - writable: false, - configurable: false, - }); - } - catch ( e ) - { - // let's not have this happen again, as repeatedly throwing - // exceptions will do nothing but slow down the system - exports.definePropertyFallback( true ); - - // there's an error (ehem, IE8); fall back - fallback( obj, prop, value ); - } + enumerable: false, + writable: false, + configurable: false, + } ); }; } }