Bug 138858

Summary: Updating an immutable binding does not throw a TypeError exception in a strict mode
Product: WebKit Reporter: Daejun Park <daejunpark>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: NEW    
Severity: Normal CC: ggaren, oliver, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Mac (Intel)   
OS: OS X 10.9   

Daejun Park
Reported 2014-11-18 19:05:53 PST
In a strict mode, it should throw a TypeError exception, when attempting to update an immutable binding, but Safari does not. According to ES5, Section 10.2.1.1.3 SetMutableBinding (N,V,S), Step 4, http://es5.github.io/#x10.2.1.1.3 the following code is supposed to throw a TypeError exception, since "g" is an immutable binding inside the function body (according to ES5, Section 13 Function Definition, Step 3 of the third block). "use strict"; var f = function g() { g = 0; }; f(); // TypeError However, Safari does not report any exception, while Firefox correctly throws a TypeError exception. I've tested this using the Web Inspector console of Safari 7.0.4. Thanks, Daejun
Attachments
Daejun Park
Comment 1 2014-11-19 10:41:10 PST
For your information, this issue appears even if I wrapped the code as follows: function x() { "use strict"; var f = function g() { g = 0; }; f(); // TypeError } x(); Also, I reported this issue for v8: https://code.google.com/p/v8/issues/detail?id=3704 but it turns out that it was duplicate: https://code.google.com/p/v8/issues/detail?id=2243 and it will not be fixed because ES6 will consider this as a syntax error. Do you have the same decision for this?
Radar WebKit Bug Importer
Comment 2 2014-11-19 11:16:18 PST
Note You need to log in before you can comment on or make changes to this bug.