May the defineProperty method of a proxy handler throw a TypeError?

David Bruant david.bruant at labri.fr
Thu May 26 10:14:24 PDT 2011


Le 26/05/2011 19:10, David Flanagan a écrit :
> On 5/26/11 9:35 AM, David Flanagan wrote:
>> On 5/26/11 6:36 AM, Tom Van Cutsem wrote:
>>> Hi David,
>>>
>>> The short answer: if you also define a 'set' trap, throwing a
>>> TypeError from defineProperty() to signal rejection is appropriate
>>
>> Thanks.  I was worried that defineProperty() was required to honor
>> property changes since getOwnPropertyDescriptor() is required to say
>> that the properties are configurable.  (I've read the justification
>> for that in the proposal multiple times, but I've never been able to
>> understand it...)
>
> Responding to my own message...  I think I now understand the
> configurable property requirement of getOwnPropertyDescriptor.  Is it
> for conformance with these paragraphs from §8.6.2 of the ECMA-262 spec?
Yes it is.
In a way, this is the equivalent of what happens for Object.freeze. If
you don't want to honor what it says, you can still throw an error
saying you don't want to.

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20110526/b18354fd/attachment.html>


More information about the es-discuss mailing list