You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Inside the typeOf function, the arguments object is detected using the callee property:
if ( 'callee' in obj )
// Opera: Object.prototype.toString.call(arguments) == 'Object' :(
This creates a problem in at least two situations:
When dealing with regular objects containing the callee property, such as AST nodes resulting from parsing JavaScript by a parser conforming to Mozilla SpiderMonkey Parser API (or its successor, The ESTree Spec).
In JavaScript strict mode, which defines (5.1, 6.0) the callee getter to throw an exception. This can be demonstrated e.g. using this code in recent Chrome: (function() { "use strict"; arguments.callee; })();).
Since Object.prorotype.toString called on an arguments object returns [object Arguments] on recent versions of all common browsers (including Opera mentioned in a comment in jsDump code), I think it would be better to rewrite the detection to use it to detect arguments instead of the callee property.
The text was updated successfully, but these errors were encountered:
Inside the
typeOf
function, thearguments
object is detected using thecallee
property:This creates a problem in at least two situations:
callee
property, such as AST nodes resulting from parsing JavaScript by a parser conforming to Mozilla SpiderMonkey Parser API (or its successor, The ESTree Spec).callee
getter to throw an exception. This can be demonstrated e.g. using this code in recent Chrome:(function() { "use strict"; arguments.callee; })();
).The first case frequently bites users of the online editor at PEG.js website.
Since
Object.prorotype.toString
called on anarguments
object returns[object Arguments]
on recent versions of all common browsers (including Opera mentioned in a comment in jsDump code), I think it would be better to rewrite the detection to use it to detectarguments
instead of thecallee
property.The text was updated successfully, but these errors were encountered: