RESOLVED WORKSFORME 48632
ES5 Strict mode: Assignment to readonly custom properties should throw a TypeError
https://bugs.webkit.org/show_bug.cgi?id=48632
Summary ES5 Strict mode: Assignment to readonly custom properties should throw a Type...
Asen Bozhilov
Reported 2010-10-29 07:03:01 PDT
The follow test case has been used: /** * Assignment to an undeclared identifier or otherwise unresolvable reference does not create a * property in the global object. When a simple assignment occurs within strict mode code, its * LeftHandSide must not evaluate to an unresolvable Reference. If it does a ReferenceError * exception is thrown (8.7.2). The LeftHandSide also may not be a reference to a data property * with the attribute value {[[Writable]]:false}, to an accessor property with the attribute value * {[[Set]]:undefined}, nor to a non-existent property of an object whose [[Extensible]] internal * property has the value false. In these cases a TypeError exception is thrown (11.13.1). */ var testDesc = 'Assignment to property with [[Writable]] false must produce a TypeError: '; try { eval('"use strict"; (function(){}).length = 20;'); util.printLine(testDesc + 'FALSE'); } catch (e) { if (e instanceof TypeError) { util.printLine(testDesc + 'TRUE'); } else { util.printLine(testDesc + 'UNDEFINED BEHAVIOR'); } }
Attachments
Oliver Hunt
Comment 1 2010-10-29 10:33:41 PDT
This a problem specific to function.length and other similar properties that use magic logic to determine their actual value.
Gavin Barraclough
Comment 2 2012-03-12 01:06:23 PDT
Function/Array/Arguments/String/RegExp all look like they should work correctly. If there are any custom read-only properties I've missed that don't throw, please reopen. cheers, G.
Note You need to log in before you can comment on or make changes to this bug.