1
0
Fork 0

Altered secure property test to work properly in IE8, which falls back due to its incomplete implementation of Object.defineProperty()

closure/master
Mike Gerwitz 2010-12-28 13:45:33 -05:00
parent 7b69a09a5a
commit 1fc791fa31
1 changed files with 19 additions and 0 deletions

View File

@ -32,6 +32,25 @@ var obj = {},
var expected = ( ( Object.defineProperty instanceof Function ) ? false : true ),
fallback = util.secureFallback();
// IE 8 will fall back on first failure
if ( !expected && fallback )
{
try
{
util.secureFallback( false );
util.defineSecureProp( {}, 'foo', 1 );
// If the fallback was changed on us, then there was a problem (and this
// is likely IE8). Change the value we're expecting so our tests don't
// fail.
if ( util.secureFallback() === true )
{
expected = true;
}
}
catch ( e ) {}
}
assert.equal(
expected,
fallback,