<?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>138857</bug_id>
          
          <creation_ts>2014-11-18 18:50:23 -0800</creation_ts>
          <short_desc>Updating a non-writable property of a coerced primitive object does not throw a TypeError exception in a strict mode</short_desc>
          <delta_ts>2014-11-19 10:06:57 -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>RESOLVED</bug_status>
          <resolution>INVALID</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></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>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1049694</commentid>
    <comment_count>0</comment_count>
    <who name="Daejun Park">daejunpark</who>
    <bug_when>2014-11-18 18:50:23 -0800</bug_when>
    <thetext>In a strict mode, it should throw a TypeError exception, when attempting to update a non-writable property of a coerced primitive object, but Safari does not.

According to ES5, Section 8.7.2 PutValue (V, W), [[Put]] internal method, Step 2.a,
http://es5.github.io/#x8.7.2

the following code is supposed to throw a TypeError exception, since &quot;x&quot; is not writable in the coerced number object for &quot;1&quot;:

&quot;use strict&quot;;
Object.defineProperty(Number.prototype, &quot;x&quot;, { &quot;value&quot; : 0, &quot;writable&quot; : false, &quot;enumerable&quot; : true, &quot;configurable&quot; : true });
1[&quot;x&quot;] = 10; // 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>1049818</commentid>
    <comment_count>1</comment_count>
    <who name="Daejun Park">daejunpark</who>
    <bug_when>2014-11-19 10:06:57 -0800</bug_when>
    <thetext>I&apos;m sorry for the noise. It turns out that I&apos;ve missed how Web Inspector works. The above example works correctly when I wrapped the code with a function, ensuring the strict mode, as follows:

function f() {
  &quot;use strict&quot;;
  Object.defineProperty(Number.prototype, &quot;x&quot;, { &quot;value&quot; : 0, &quot;writable&quot; : false, &quot;enumerable&quot; : true, &quot;configurable&quot; : true });
  1[&quot;x&quot;] = 10; // TypeError
}
f();

I close this issue.

Thanks,
Daejun</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>