on caller descriptor

Andrea Giammarchi andrea.giammarchi at gmail.com
Sun Apr 14 09:57:37 PDT 2013


generalizing means that for any generic object we should try/catch to avoid
that error ? talking about automated code ... the "whitelist" is everyday
bigger :)

Thanks for the answer


On Sun, Apr 14, 2013 at 8:07 AM, Rick Waldron <waldron.rick at gmail.com>wrote:

>
>
> On Sunday, April 14, 2013, Andrea Giammarchi wrote:
>
>> I wonder if all of this is expected:
>>
>> (function(){
>>   "use strict";
>>   function caller() {
>>     alert(caller.caller);
>>   }
>>   // error if invoked: caller();
>>   // but showing up in properties
>>   var properties = Object.getOwnPropertyNames(caller);
>>   if (properties.indexOf('caller')) {
>>     console.log(JSON.stringify(
>>       Object.getOwnPropertyDescriptor(caller, 'caller')
>>     ));
>>     // will show
>>     // enumerable: false, configurable: false
>>   }
>> }());
>>
>> same is for arguments ... so fn.arguments is there too
>>
>> Am I the only one thinking this is confusing ?
>>
>> I understand it's convenient for engines to simply put such descriptor
>> there but shouldn't these properties be hidden under use strict?
>>
>> Just wondering, thanks for any clarification.
>>
>
> This is what is meant by "poisoned". The properties are there, because the
> spec says they should be, but accessing them results in a thrown exception.
>
> Rick
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130414/54131d8b/attachment.html>


More information about the es-discuss mailing list