<?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>42801</bug_id>
          
          <creation_ts>2010-07-21 18:56:02 -0700</creation_ts>
          <short_desc>[ES5] index setters on Array.prototype not run when index set on array instance</short_desc>
          <delta_ts>2012-09-17 00:34:41 -0700</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>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>96596</dup_id>
          
          <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="Brendan Eich">brendan</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>barraclough</cc>
    
    <cc>jwalden+bwo</cc>
    
    <cc>oliver</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>254628</commentid>
    <comment_count>0</comment_count>
    <who name="Brendan Eich">brendan</who>
    <bug_when>2010-07-21 18:56:02 -0700</bug_when>
    <thetext>From a SpiderMonkey shell:

js&gt; Array.prototype.__defineSetter__(&quot;foo&quot;, function() { print(&quot;Foo!&quot;); });
js&gt; Array.prototype.__defineSetter__(0, function() { print(&quot;Zero!&quot;); });
js&gt; var a = Array();
js&gt; a.foo = 0;
Foo!
js&gt; a[0] = 0;
Zero!

In a JSC shell:

&gt; Array.prototype.__defineSetter__(&quot;foo&quot;, function() { print(&quot;Foo!&quot;); });
undefined
&gt; Array.prototype.__defineSetter__(0, function() { print(&quot;Zero!&quot;); });
undefined
&gt; var a = Array();
undefined
&gt; a.foo = 0;
Foo!
0
&gt; a[0] = 0;
0

V8 matches JSC. The __defineSetter__ stuff predates ES5, but ES5 codifies what Mozilla promulgated for __defineSetter__:

8.12.5 [[Put]] ( P, V, Throw )
 . . .
1. If the result of calling the [[CanPut]] internal method of O with argument P is false, then
   a. If Throw is true, then throw a TypeError exception.
   b. Else return.
2. Let ownDesc be the result of calling the [[GetOwnProperty]] internal method of O with argument P.
3. If IsDataDescriptor(ownDesc) is true, then
   a. Let valueDesc be the Property Descriptor {[[Value]]: V}.
   b. Call the [[DefineOwnProperty]] internal method of O passing P, valueDesc, and Throw as arguments.
   c. Return.
4. Let desc be the result of calling the [[GetProperty]] internal method of O with argument P. This may be either an own or inherited accessor property descriptor or an inherited data property descriptor.5. If IsAccessorDescriptor(desc) is true, then
   a. Let setter be desc.[[Set]] which cannot be undefined.
   b. Call the [[Call]] internal method of setter providing O as the this value and providing V as the sole argument.
5. If IsAccessorDescriptor(desc) is true, then
   a. Let setter be desc.[[Set]] which cannot be undefined.
   b. Call the [[Call]] internal method of setter providing O as the this value and providing V as the sole argument.
6. Else, create a named data property named P on object O as follows
   a. Let newDesc be the Property Descriptor {[[Value]]: V, [[Writable]]: true, [[Enumerable]]: true, [[Configurable]]: true}.
   b. Call the [[DefineOwnProperty]] internal method of O passing P, newDesc, and Throw as arguments.
7. Return.

/be</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>721726</commentid>
    <comment_count>1</comment_count>
    <who name="Gavin Barraclough">barraclough</who>
    <bug_when>2012-09-17 00:34:41 -0700</bug_when>
    <thetext>

*** This bug has been marked as a duplicate of bug 96596 ***</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>