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
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?
<rdar://problem/19032831>