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

David Flanagan dflanagan at mozilla.com
Mon Aug 8 14:20:48 PDT 2011


On 6/20/11 1:13 AM, Tom Van Cutsem wrote 
[https://mail.mozilla.org/pipermail/es-discuss/2011-June/015352.html]:
> But my question remains: how important is it for a Proxy to be able to 
> faithfully emulate the reject behavior of assignment in non-strict 
> code? If it is important then we should probably have the 
> defineProperty trap return a success value, just like delete or set.

No one seems to have answered the question. Maybe that means it is not 
so important. The one data point I'd like to add is that WebIDL (§4.7.3 
and elsewhere) is written to use the ECMA-262 Reject operation. If Proxy 
can't correctly emulate reject behavior in non-strict code, then I can't 
correctly implement the DOM in JavaScript.

On 6/17/11, Cameron McCormack wrote 
[http://lists.w3.org/Archives/Public/public-script-coord/2011AprJun/0209.html]:
> It seems like proxies should allow throwing/ignoring based on strict
> modeness of the caller.  I’ll leave the requirements to Reject in there
> for now.
Since WebIDL is in last-call status, this is probably a good time to 
decide whether the proxy proposal should change to allow faithful 
emulation of Reject, or whether WebIDL should change to throw a 
TypeError instead of using Reject...

David


More information about the es-discuss mailing list