From d5f37f294e670ab32fab13455d448f9488a05a3a Mon Sep 17 00:00:00 2001 From: Mike Gerwitz Date: Tue, 21 Dec 2010 14:37:34 -0500 Subject: [PATCH] IE8 does not support Object.defineProperty on non-DOM objects (see http://stackoverflow.com/questions/3830800/object-defineproperty-in-es5) --- lib/util.js | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/lib/util.js b/lib/util.js index c257f8f..f8b7cc5 100644 --- a/lib/util.js +++ b/lib/util.js @@ -104,14 +104,22 @@ exports.defineSecureProp = function( obj, prop, value ) } else { - Object.defineProperty( obj, prop, + try { - value: value, + Object.defineProperty( obj, prop, + { + value: value, - enumerable: false, - writable: false, - configurable: false, - }); + enumerable: false, + writable: false, + configurable: false, + }); + } + catch ( e ) + { + // if there's an error (ehem, IE8), fall back + obj[ prop ] = value; + } } }