Minor type confusion in proxies proposal?

Sean Eagan seaneagan1 at gmail.com
Tue Jul 5 11:36:06 PDT 2011

Just noticed that David Bruant already proposed
Object.prototype.toPropertyDescriptor for this exact same reason in
apologies.  I think it is better as a static (class) method since it
is reflection-related, and to avoid attackers from defining a bogus
"toPropertyDescriptor" method on property descriptors.

On Tue, Jul 5, 2011 at 12:55 PM, Sean Eagan <seaneagan1 at gmail.com> wrote:
> On Tue, Jul 5, 2011 at 9:45 AM, Sean Eagan <seaneagan1 at gmail.com> wrote:
>> I think if an "Object.toPropertyDescriptor" function were introduced,
>> then this protection burden may be sufficiently small.  This would be
>> similar to the FixedHandler approach of providing *optional* builtin
>> invariant maintenance support.  The first argument to this function
>> would be the object to convert to a property descriptor,  and there
>> could potentially be a second argument which could be a boolean as to
>> whether to keep non-standard attributes.
> Object.toPropertyDescriptor could also allow us to directly return
> "getOwnPropertyDescriptor" trap return values, as this value could
> then be tamed by proxy consumers in a standard, efficient, and
> convenient manner.
> Cheers,
> Sean Eagan

Sean Eagan

More information about the es-discuss mailing list