<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>138858</bug_id>
          
          <creation_ts>2014-11-18 19:05:53 -0800</creation_ts>
          <short_desc>Updating an immutable binding does not throw a TypeError exception in a strict mode</short_desc>
          <delta_ts>2014-11-19 11:16:18 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>JavaScriptCore</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Mac (Intel)</rep_platform>
          <op_sys>OS X 10.9</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Daejun Park">daejunpark</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ggaren</cc>
    
    <cc>oliver</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1049697</commentid>
    <comment_count>0</comment_count>
    <who name="Daejun Park">daejunpark</who>
    <bug_when>2014-11-18 19:05:53 -0800</bug_when>
    <thetext>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 &quot;g&quot; is an immutable binding inside the function body (according to ES5, Section 13 Function Definition, Step 3 of the third block).

&quot;use strict&quot;;
var f = function g() {
  g = 0;
}; 
f(); // TypeError

However, Safari does not report any exception, while Firefox correctly throws a TypeError exception.

I&apos;ve tested this using the Web Inspector console of Safari 7.0.4.

Thanks,
Daejun</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1049835</commentid>
    <comment_count>1</comment_count>
    <who name="Daejun Park">daejunpark</who>
    <bug_when>2014-11-19 10:41:10 -0800</bug_when>
    <thetext>For your information, this issue appears even if I wrapped the code as follows:
function x() {
  &quot;use strict&quot;;
  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?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1049844</commentid>
    <comment_count>2</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2014-11-19 11:16:18 -0800</bug_when>
    <thetext>&lt;rdar://problem/19032831&gt;</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>