Wrap support.nonEnumArgs assignment in a try-catch to avoid errors in Ringo, Rhino, and Narwhal.

This commit is contained in:
John-David Dalton
2014-04-02 01:42:43 -07:00
parent 7f9a2a2d34
commit 9f2bea8ac1

View File

@@ -875,21 +875,6 @@
*/
support.funcNames = typeof Function.name == 'string';
/**
* Detect if `arguments` object indexes are non-enumerable
* (Firefox < 4, IE < 9, PhantomJS, Safari < 5.1).
*
* Chrome < 25 and Node.js < 0.11.0 will treat `arguments` object indexes
* that exceed their function's formal parameters and whose associated
* values are `0` as non-enumerable and incorrectly return `false` from
* `Object#hasOwnProperty`.
*
* @memberOf _.support
* @type boolean
*/
support.nonEnumArgs = !(argsKey == '1' && hasOwnProperty.call(arguments, '1') &&
propertyIsEnumerable.call(arguments, '1'));
/**
* Detect if string indexes are non-enumerable
* (IE < 9, RingoJS, Rhino, Narwhal).
@@ -972,6 +957,25 @@
} catch(e) {
support.nodeClass = true;
}
/**
* Detect if `arguments` object indexes are non-enumerable
* (Firefox < 4, IE < 9, PhantomJS, Safari < 5.1).
*
* Chrome < 25 and Node.js < 0.11.0 will treat `arguments` object indexes
* that exceed their function's formal parameters and whose associated
* values are `0` as non-enumerable and incorrectly return `false` from
* `Object#hasOwnProperty`.
*
* @memberOf _.support
* @type boolean
*/
try {
support.nonEnumArgs = !(argsKey == '1' && hasOwnProperty.call(arguments, '1') &&
propertyIsEnumerable.call(arguments, '1'));
} catch(e) {
support.nonEnumArgs = true;
}
}(0, 0));
/**