WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED INVALID
136445
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
Add attachment
proposed patch, testcase, etc.
Jordan Harband
Comment 1
2014-09-02 10:10:41 PDT
Sorry for the noise - turns out Safari is the only browser doing this correctly.
https://twitter.com/awbjs/status/506845194025594881
https://code.google.com/p/v8/issues/detail?id=3088
and
https://bugzilla.mozilla.org/show_bug.cgi?id=779682
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug