RESOLVED INVALID136445
Assignment to a property on a primitive in strict mode should not throw
https://bugs.webkit.org/show_bug.cgi?id=136445
Summary Assignment to a property on a primitive in strict mode should not throw
Jordan Harband
Reported 2014-09-01 23:33:13 PDT
`(function () { "use strict"; 3.0.a = true; }())` `(function () { "use strict"; 'foo'.a = true; }())` `(function () { "use strict"; true.a = true; }())` None of these throw exceptions in Chrome, Firefox, Opera - but in Safari 7.1, these all throw a TypeError "Attempted to assign to readonly property.". According to the ES5 spec ( https://es5.github.io/#C ) and ES6 spec ( https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-of-ecmascript ), Safari is in error here. In addition, one of the TC39 spec maintainers confirmed via Twitter that this is a Safari bug ( https://twitter.com/awbjs/status/506687103506587648 ) Steps to Reproduce: Run any of the JS functions in the console, or any other JS mechanism: (function () { "use strict"; 3.0.a = true; }()) (function () { "use strict"; 'foo'.a = true; }()) (function () { "use strict"; true.a = true; }())
Attachments
Jordan Harband
Comment 1 2014-09-02 10:10:41 PDT
Note You need to log in before you can comment on or make changes to this bug.