Feedback on "Read-only Override Prohibition is [not a mistake]"

David Bruant bruant.d at gmail.com
Sun Jan 15 13:17:52 PST 2012


Le 15/01/2012 21:23, David Bruant a écrit :
> -----
> function C(){
>     this.length = 3;
> }
>
> function f(a,b){}
>
> C.prototype = f;
>
> var c = new C();
> console.log(c.length);
> -----
> For this code, ECMAScript 5 says:
> When doing "new C()", |this| is assigned "C.prototype" which is the
> function f (it has a non-writable, non-configurable "length" property
> with 2 as value).
> During "this.length = 3;", [[CanPut]] should return
> "inherited.[[Writable]]" (step 8.b). In this case, it should return false.
>
> Firefox 9, 11 (Aurora) (...) log 3 (non-compliant)
Apparently, Firefox logs 2, my mistake.

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


More information about the es-discuss mailing list