Proxies: wrong "receiver" used in default "set" trap

Tom Van Cutsem tomvc.be at gmail.com
Thu Dec 20 12:12:36 PST 2012


2012/12/20 Allen Wirfs-Brock <allen at wirfs-brock.com>

> Yes, here is the new step 5 as I have just updated it in my spec. draft
> (ignore the 1, it's really 5)
>
>    1. If IsDataDescriptor(*ownDesc*) is *true*, then
>       1. If *ownDesc*.[[Writable]] is *false*, return *false*.
>       2. If Type(*Receiver*) is not Object, return *false*.
>       3. Let *existingDescriptor* be be the result of calling the
>       [[GetOwnProperty]] internal method of *Receiver* with argument *P*.
>       4. ReturnIfAbrupt(*existingDescriptor*).
>       5. If *existingDescriptor* is not *undefined*, then
>          1. Let *valueDesc* be the Property Descriptor {[[Value]]: *V*}.
>          2. Return the result of calling the [[DefineOwnProperty]]
>          internal method of *Receiver* with arguments *P* and *valueDesc*.
>       6. Else *Receiver *does not currently have a property *P*,
>          1. Return the result of performing CreateOwnDataProperty(*
>          Receiver*, *P*, *V*).
>
>
> Allen
>

Looks good!

As you note, with the introduction of a user-facing Reflect.set function,
Receiver can be an arbitrary object. Thus, it may be that
existingDescriptor denotes an accessor property, in which case the
[[DefineOwnProperty]] call will fail, but this is perfectly acceptable.

Cheers,
Tom
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20121220/ed1378da/attachment-0001.html>


More information about the es-discuss mailing list