[Bug 17560] readonly binding unspecified for ECMAScript

https://www.w3.org/Bugs/Public/show_bug.cgi?id=17560

Boris Zbarsky <bzbarsky@mit.edu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bzbarsky@mit.edu

--- Comment #1 from Boris Zbarsky <bzbarsky@mit.edu> 2012-06-20 21:11:03 UTC ---
This is perfectly well defined
http://dev.w3.org/2006/webapi/WebIDL/#es-attributes which says that the
property descriptor looks like this:

  { [[Get]]: G, [[Set]]: S, [[Enumerable]]: true, [[Configurable]]:
configurable }

where S is undefined if the attribute is readonly.

So when you're setting a readonly attribute, you end up in ECMA-262 section
8.12.5, call [[CanPut]] which lands you in 8.12.4, get to step 2,
IsAccessorDescriptor returns true in step 2a, desc.[[Set]] is undefined, so
[[CanPut]] returns false.  Back in [[Put]], this means that the set is silently
ignored if "Throw" is false, otherwise a TypeError is thrown.

If you care to unwind some more, basically in strict mode TypeError is thrown
an otherwise the set silently does nothing.

> mapped to the ECMAScript ReadOnly property attribute

There is no such thing.  There is a [[Writable]] property attribute, but it
only applies to data descriptors, not accessor descriptors.  Setting it in an
accessor descriptor is an error.

-- 
Configure bugmail: https://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

Received on Wednesday, 20 June 2012 21:11:38 UTC