<?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>33053</bug_id>
          
          <creation_ts>2009-12-30 06:58:15 -0800</creation_ts>
          <short_desc>JSON.stringify and JSON.parse implementations needlessly process properties in the prototype chain</short_desc>
          <delta_ts>2010-04-24 20:29:20 -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>PC</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>ES5</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Kent Hansen">kent.hansen</reporter>
          <assigned_to name="Kent Hansen">kent.hansen</assigned_to>
          <cc>commit-queue</cc>
    
    <cc>eric</cc>
    
    <cc>erights</cc>
    
    <cc>oliver</cc>
    
    <cc>pmuellr</cc>
    
    <cc>webkit.review.bot</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>175910</commentid>
    <comment_count>0</comment_count>
    <who name="Kent Hansen">kent.hansen</who>
    <bug_when>2009-12-30 06:58:15 -0800</bug_when>
    <thetext>ES5 section 15.12.3, abstract Operation JO(value), step 6:  &quot;Let K be an internal List of Strings consisting of the names of all the own properties of value [...]&quot;.
The JavaScriptCore implementation is calling JSObject::getPropertyNames(), whereas it could be calling JSObject::getOwnPropertyNames() instead.

Making this change does not affect the final output (the prototype-inherited properties are ignored anyways, since getOwnPropertySlot() subsequently returns false for them), but could make the implementation faster and use less memory.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>175914</commentid>
    <comment_count>1</comment_count>
      <attachid>45662</attachid>
    <who name="Kent Hansen">kent.hansen</who>
    <bug_when>2009-12-30 07:05:02 -0800</bug_when>
    <thetext>Created attachment 45662
Proposed patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>175915</commentid>
    <comment_count>2</comment_count>
    <who name="WebKit Review Bot">webkit.review.bot</who>
    <bug_when>2009-12-30 07:06:34 -0800</bug_when>
    <thetext>style-queue ran check-webkit-style on attachment 45662 without any errors.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>175918</commentid>
    <comment_count>3</comment_count>
    <who name="Kent Hansen">kent.hansen</who>
    <bug_when>2009-12-30 07:24:29 -0800</bug_when>
    <thetext>Hmm, there should probably be a check to see if the OverridesGetPropertyNames flag is on, and in that case call getPropertyNames() as before.

It scares me a bit that there are now two virtual functions for getting property names. Can&apos;t we just make getPropertyNames() non-virtual now that there is getOwnPropertyNames()? Then rename the OverridesGetPropertyNames flag to OverridesGetOwnPropertyNames and update the bindings accordingly. I can do the refactoring if that sounds sensible.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>175929</commentid>
    <comment_count>4</comment_count>
    <who name="Patrick Mueller">pmuellr</who>
    <bug_when>2009-12-30 08:47:47 -0800</bug_when>
    <thetext>If you&apos;re doing some refactoring in this area, there may be some issues relating to bug 32242 - which needs to obtain the non-enumerable properties of an object.  I&apos;m very unfamiliar with the JSC code, but attempted to look into this support anyway, and found I was going to have to hit a lot of code to go the first route I attempted (see the bug for details).  May well be it&apos;s a n00b issue for me, but if you&apos;re in the middle of property-retrieval refactorings, something to think about it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>176125</commentid>
    <comment_count>5</comment_count>
      <attachid>45662</attachid>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2009-12-30 22:56:50 -0800</bug_when>
    <thetext>Comment on attachment 45662
Proposed patch

Can you determine what correct spec behaviour is given:
javascript:a={__proto__:{foo:&quot;bar&quot;}, get b() { this.foo=&quot;PASS&quot;; }}; alert(JSON.stringify(a))</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>176603</commentid>
    <comment_count>6</comment_count>
    <who name="Kent Hansen">kent.hansen</who>
    <bug_when>2010-01-04 01:43:48 -0800</bug_when>
    <thetext>(In reply to comment #5)
&gt; (From update of attachment 45662 [details])
&gt; Can you determine what correct spec behaviour is given:
&gt; javascript:a={__proto__:{foo:&quot;bar&quot;}, get b() { this.foo=&quot;PASS&quot;; }};
&gt; alert(JSON.stringify(a))

Thanks, that&apos;s a good test case to include.
Fairly sure it should be &quot;{}&quot;, as per 15.12.3.JO.6. The prototype should not be consulted.
SpiderMonkey produces &quot;{}&quot; with both the built-in JSON.stringify and http://www.json.org/json2.js.
JSC produces &quot;{&quot;foo&quot;:&quot;PASS&quot;}&quot; without the patch, &quot;{}&quot; with the patch.

JSC produces &quot;{&quot;foo&quot;:&quot;PASS&quot;}&quot; even with json2.js. That code uses for..in in combination with hasOwnProperty() to only process &quot;own&quot; properties of the object. This means it _will_ see the property name &quot;b&quot; before hasOwnProperty() rejects it, but that shouldn&apos;t cause the _getter_ itself to be invoked. Uh-oh, maybe it&apos;s because the JSObject::hasOwnProperty() implementation calls getOwnPropertySlot()? It should probably be calling getOwnPropertyDescriptor(). I&apos;ll investigate and spin off a separate bug report.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>176615</commentid>
    <comment_count>7</comment_count>
    <who name="Kent Hansen">kent.hansen</who>
    <bug_when>2010-01-04 02:10:50 -0800</bug_when>
    <thetext>(In reply to comment #6)

Sorry, I misread the test input. b of course _is_ an &quot;own&quot; property.
But yeah, what&apos;s happening is, &quot;foo&quot; will be the last item in the PropertyNameArray after the call to getPropertyNames(), even though the property is not an &quot;own&quot; property; after the call to the &quot;b&quot; getter, however, &quot;foo&quot; will be an own property, so it won&apos;t be rejected by the next call to hasOwnProperty(), hence the side-effect-generated &quot;foo&quot; property ends up in the output.
Again, coming back to the spec, the propertylist is initialized before the property values are stringified, so I believe properties added during the stringification should not be part of the output.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>176619</commentid>
    <comment_count>8</comment_count>
    <who name="Kent Hansen">kent.hansen</who>
    <bug_when>2010-01-04 02:33:56 -0800</bug_when>
    <thetext>(In reply to comment #6)
&gt; JSC produces &quot;{&quot;foo&quot;:&quot;PASS&quot;}&quot; even with json2.js. That code uses for..in in
&gt; combination with hasOwnProperty() to only process &quot;own&quot; properties of the
&gt; object.

Looks like a bug in the for..in implementation.

SpiderMonkey:
js&gt; a={__proto__:{foo:&quot;bar&quot;}, get b() { this.foo=&quot;PASS&quot;; }};
({get b () {this.foo = &quot;PASS&quot;;}})
js&gt; for (var p in a) print(p, a[p], a.hasOwnProperty(p))
b undefined true

JSC:
&gt; a={__proto__:{foo:&quot;bar&quot;}, get b() { this.foo=&quot;PASS&quot;; }}
[object Object]
&gt; for (var p in a) print(p, a[p], a.hasOwnProperty(p))
b undefined true
foo PASS true

ES5 section 12.6.4 states that &quot;if new properties are added to the object being enumerated during enumeration, the newly added properties are guaranteed not to be visited in the active enumeration.&quot; So, the &quot;foo&quot; added by the b getter should not be included in the enumeration.
The reason the &quot;foo&quot; in the prototype should not be included is because of the &quot;no-shadowing&quot; rule, also given in section 12.6.4. I.e. it looks like even though newly added properties are not included in the enumeration, they do affect shadowing (at least if you take SpiderMonkey&apos;s implementation to be &quot;correct&quot;).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>176654</commentid>
    <comment_count>9</comment_count>
    <who name="Kent Hansen">kent.hansen</who>
    <bug_when>2010-01-04 03:29:19 -0800</bug_when>
    <thetext>(In reply to comment #8)
&gt; Looks like a bug in the for..in implementation.
&gt; 
&gt; ES5 section 12.6.4 states that &quot;if new properties are added to the object being
&gt; enumerated during enumeration, the newly added properties are guaranteed not to
&gt; be visited in the active enumeration.&quot;

Ugh, I was looking at a previous draft of the spec. In the final draft, the order of &quot;guaranteed&quot; and &quot;not&quot; has been swapped again, back to how it was in ES3 (makes a big difference, huh!):

http://www.mail-archive.com/es-discuss@mozilla.org/msg03118.html

So arguably json2.js is buggy because it relies on non-standard behavior. Ideally building the property list and stringifying the values should be decoupled, like it is in the ES5 algorithm. It&apos;d be nice to have a test that sanctions this for-in behavior in JSC, though.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>176757</commentid>
    <comment_count>10</comment_count>
    <who name="Kent Hansen">kent.hansen</who>
    <bug_when>2010-01-04 10:58:20 -0800</bug_when>
    <thetext>(In reply to comment #3)
&gt; Hmm, there should probably be a check to see if the OverridesGetPropertyNames
&gt; flag is on, and in that case call getPropertyNames() as before.
&gt; 
&gt; It scares me a bit that there are now two virtual functions for getting
&gt; property names. Can&apos;t we just make getPropertyNames() non-virtual now that
&gt; there is getOwnPropertyNames()? Then rename the OverridesGetPropertyNames flag
&gt; to OverridesGetOwnPropertyNames and update the bindings accordingly. I can do
&gt; the refactoring if that sounds sensible.

I created https://bugs.webkit.org/show_bug.cgi?id=33159 to get some feedback on this issue.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>176762</commentid>
    <comment_count>11</comment_count>
    <who name="Kent Hansen">kent.hansen</who>
    <bug_when>2010-01-04 11:09:27 -0800</bug_when>
    <thetext>(In reply to comment #4)
&gt; If you&apos;re doing some refactoring in this area, there may be some issues
&gt; relating to bug 32242 - which needs to obtain the non-enumerable properties of
&gt; an object.  I&apos;m very unfamiliar with the JSC code, but attempted to look into
&gt; this support anyway, and found I was going to have to hit a lot of code to go
&gt; the first route I attempted (see the bug for details).  May well be it&apos;s a n00b
&gt; issue for me, but if you&apos;re in the middle of property-retrieval refactorings,
&gt; something to think about it.

Yeah, see Maciej&apos;s latest comment. I&apos;m pursuing the &quot;add extra flag argument to get(Own)PropertyNames&quot; approach. It should be orthogonal to this change, though.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>178629</commentid>
    <comment_count>12</comment_count>
      <attachid>46130</attachid>
    <who name="Kent Hansen">kent.hansen</who>
    <bug_when>2010-01-08 03:58:33 -0800</bug_when>
    <thetext>Created attachment 46130
Revised patch (adds tests)

I haven&apos;t added the checks for overridesGetPropertyNames() as I mentioned in comment #3, because that would still mean the behavior would be broken for classes that do override it (and there are quite a few). If a class reimplements getPropertyNames(), it should reimplement getOwnPropertyNames() too (i.e. the OverridesGetPropertyNames should imply that both of the property name functions are reimplemented). I can&apos;t think of a use case where it&apos;s meaningful to only reimplement getPropertyNames(), at least.

The difference between the result created by json2.js (subject to the for-in issue) and the native implementation has been marked as FAIL.
I&apos;m not sure how to best proceed:
1) Acknowledge that the for-in behavior is a bug in JSC, and make it a blocker for this bug; or
2) Try to convince Crockford that json2.js should be updated to work around this behavior (i.e. detect for-in behavior for injected properties and fall back to a slower codepath); or
3) Accept that the native JSON and json2.js results will differ in this case.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>178632</commentid>
    <comment_count>13</comment_count>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2010-01-08 04:09:42 -0800</bug_when>
    <thetext>Due to the two recent rollouts, I must as:   Did you run run-javascriptcore-tests with this patch?

I&apos;ve filed bug 33376 about the commit-queue running run-javascriptcore-tests in the future.  (note, you&apos;re not the only one who has found this split confusing.  bug 5253 is one bug on the subject.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>178647</commentid>
    <comment_count>14</comment_count>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2010-01-08 05:01:29 -0800</bug_when>
    <thetext>the commit-queue is now running run-javascriptcore-tests before committing, so we won&apos;t have rollouts again like we had this evening. :)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>178650</commentid>
    <comment_count>15</comment_count>
    <who name="Kent Hansen">kent.hansen</who>
    <bug_when>2010-01-08 05:34:53 -0800</bug_when>
    <thetext>(In reply to comment #14)
&gt; the commit-queue is now running run-javascriptcore-tests before committing, so
&gt; we won&apos;t have rollouts again like we had this evening. :)

Much appreciated!
Regarding the patch for this bug, I&apos;ve run the javascriptcore tests after applying it, and there is no change.
JSON is a feature introduced in ES5 anyway, and JavaScriptCore/tests/mozilla doesn&apos;t yet contain the ecma_5/ directory that&apos;s present in mozilla trunk. Like we discussed online, I want to investigate bringing all tests under JavaScriptCore/tests/mozilla up-to-date.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>179229</commentid>
    <comment_count>16</comment_count>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2010-01-10 19:45:16 -0800</bug_when>
    <thetext>Sorry for delayed response, i&apos;ve been on holiday, and am now back again
(In reply to comment #8)
&gt; (In reply to comment #6)
&gt; &gt; JSC produces &quot;{&quot;foo&quot;:&quot;PASS&quot;}&quot; even with json2.js. That code uses for..in in
&gt; &gt; combination with hasOwnProperty() to only process &quot;own&quot; properties of the
&gt; &gt; object.
&gt; 
&gt; Looks like a bug in the for..in implementation.
&gt; 
&gt; SpiderMonkey:
&gt; js&gt; a={__proto__:{foo:&quot;bar&quot;}, get b() { this.foo=&quot;PASS&quot;; }};
&gt; ({get b () {this.foo = &quot;PASS&quot;;}})
&gt; js&gt; for (var p in a) print(p, a[p], a.hasOwnProperty(p))
&gt; b undefined true
&gt; 
&gt; JSC:
&gt; &gt; a={__proto__:{foo:&quot;bar&quot;}, get b() { this.foo=&quot;PASS&quot;; }}
&gt; [object Object]
&gt; &gt; for (var p in a) print(p, a[p], a.hasOwnProperty(p))
&gt; b undefined true
&gt; foo PASS true
&gt; 
&gt; ES5 section 12.6.4 states that &quot;if new properties are added to the object being
&gt; enumerated during enumeration, the newly added properties are guaranteed not to
&gt; be visited in the active enumeration.&quot; So, the &quot;foo&quot; added by the b getter
&gt; should not be included in the enumeration.

actually the foo added by the b getter should be included.  Evaluation of for-in is

for (i in o) if (o.hasOwnProperty(i)) log(o[i])

names = getPropertyNames(o) -&gt; [&quot;b&quot; /* from o */, &quot;foo&quot; /* from o.__proto__ */]
for (_i = 0; _i &lt; names.length; _i++) {
    var i = names[_i];
    if (o.hasOwnProperty(i))
    log(o[i])
}

The first iteration of this will be i == &quot;b&quot;, o[i] then results in the o.b getter being called which then creates o.foo (no prototype involved in assignment), in the next loop foo will now be directly on the object so will be visited.  I am unsure why it is not working in firefox</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>179735</commentid>
    <comment_count>17</comment_count>
    <who name="Kent Hansen">kent.hansen</who>
    <bug_when>2010-01-12 01:46:31 -0800</bug_when>
    <thetext>(In reply to comment #16)
&gt; actually the foo added by the b getter should be included.  Evaluation of
&gt; for-in is
&gt; 
&gt; for (i in o) if (o.hasOwnProperty(i)) log(o[i])
&gt; 
&gt; names = getPropertyNames(o) -&gt; [&quot;b&quot; /* from o */, &quot;foo&quot; /* from o.__proto__ */]
&gt; for (_i = 0; _i &lt; names.length; _i++) {
&gt;     var i = names[_i];
&gt;     if (o.hasOwnProperty(i))
&gt;     log(o[i])
&gt; }
&gt; 
&gt; The first iteration of this will be i == &quot;b&quot;, o[i] then results in the o.b
&gt; getter being called which then creates o.foo (no prototype involved in
&gt; assignment), in the next loop foo will now be directly on the object so will be
&gt; visited.  I am unsure why it is not working in firefox

It&apos;s because of the no-shadowing rule that I mentioned.
From ES5 section 12.6.4: &quot;Enumerating the properties of an object includes enumerating properties of its prototype, and the prototype of
the prototype, and so on, recursively; but a property of a prototype is not enumerated if it is “shadowed”
because some previous object in the prototype chain has a property with the same name.&quot;

Pseudo-code execution:
1. Get own properties of o -&gt; [&quot;b&quot;]
2. Enumerate &quot;b&quot; (one pass through the for-in body); as a side-effect, this will create &quot;foo&quot; on o
3. Recurse: Get own properties of o.__proto__ -&gt; [&quot;foo&quot;].
4. Check if some previous object in the prototype chain has the property &quot;foo&quot; -&gt; yes, o has a property called &quot;foo&quot;, so &quot;foo&quot; is not visited. (The fact that &quot;foo&quot; has not actually been enumerated before does not matter.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>179876</commentid>
    <comment_count>18</comment_count>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2010-01-12 10:14:34 -0800</bug_when>
    <thetext>(In reply to comment #17)
&gt; (In reply to comment #16)
&gt; &gt; actually the foo added by the b getter should be included.  Evaluation of
&gt; &gt; for-in is
&gt; &gt; 
&gt; &gt; for (i in o) if (o.hasOwnProperty(i)) log(o[i])
&gt; &gt; 
&gt; &gt; names = getPropertyNames(o) -&gt; [&quot;b&quot; /* from o */, &quot;foo&quot; /* from o.__proto__ */]
&gt; &gt; for (_i = 0; _i &lt; names.length; _i++) {
&gt; &gt;     var i = names[_i];
&gt; &gt;     if (o.hasOwnProperty(i))
&gt; &gt;     log(o[i])
&gt; &gt; }
&gt; &gt; 
&gt; &gt; The first iteration of this will be i == &quot;b&quot;, o[i] then results in the o.b
&gt; &gt; getter being called which then creates o.foo (no prototype involved in
&gt; &gt; assignment), in the next loop foo will now be directly on the object so will be
&gt; &gt; visited.  I am unsure why it is not working in firefox
&gt; 
&gt; It&apos;s because of the no-shadowing rule that I mentioned.
&gt; From ES5 section 12.6.4: &quot;Enumerating the properties of an object includes
&gt; enumerating properties of its prototype, and the prototype of
&gt; the prototype, and so on, recursively; but a property of a prototype is not
&gt; enumerated if it is “shadowed”
&gt; because some previous object in the prototype chain has a property with the
&gt; same name.&quot;
&gt; 
&gt; Pseudo-code execution:
&gt; 1. Get own properties of o -&gt; [&quot;b&quot;]
&gt; 2. Enumerate &quot;b&quot; (one pass through the for-in body); as a side-effect, this
&gt; will create &quot;foo&quot; on o
&gt; 3. Recurse: Get own properties of o.__proto__ -&gt; [&quot;foo&quot;].
&gt; 4. Check if some previous object in the prototype chain has the property &quot;foo&quot;
&gt; -&gt; yes, o has a property called &quot;foo&quot;, so &quot;foo&quot; is not visited. (The fact that
&gt; &quot;foo&quot; has not actually been enumerated before does not matter.)

No, you&apos;re misunderstanding the purpose of that rule -- it prevents you from visiting the same property name multiple times, the algorithm is
1. names = getPropertyNames(o);
2. for each name in names
    i. if !o.hasProperty(name) goto step 2
    ii. do loop body

getPropertyNames(o)
1. names = [];
2. while (o)
     i. temp = getOwnPropertyNames(o)
     ii. for each name in temp
         a. if names.indexOf(name) != -1 goto 2.ii
         b. names.push(name)
3. return names

Eg. the list of property names for an object is a uniqued ordered list</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>180123</commentid>
    <comment_count>19</comment_count>
    <who name="Kent Hansen">kent.hansen</who>
    <bug_when>2010-01-13 01:25:32 -0800</bug_when>
    <thetext>(In reply to comment #18)
&gt; No, you&apos;re misunderstanding the purpose of that rule -- it prevents you from
&gt; visiting the same property name multiple times, the algorithm is
&gt; 1. names = getPropertyNames(o);
&gt; 2. for each name in names
&gt;     i. if !o.hasProperty(name) goto step 2
&gt;     ii. do loop body
&gt; 
&gt; getPropertyNames(o)
&gt; 1. names = [];
&gt; 2. while (o)
&gt;      i. temp = getOwnPropertyNames(o)
&gt;      ii. for each name in temp
&gt;          a. if names.indexOf(name) != -1 goto 2.ii
&gt;          b. names.push(name)
&gt; 3. return names
&gt; 
&gt; Eg. the list of property names for an object is a uniqued ordered list

Where does that algorithm come from? I&apos;m just following the ECMA-262 wording. Some more interesting cases:

Case 1: try swapping out the __proto__ property while o is being enumerated.

SpiderMonkey:
js&gt; o = { a : 1, __proto__: { b : 2 } };
({a:1})
js&gt; for (var p in o) { if (p == &quot;a&quot;) o.__proto__ = { c : 3 }; print(p); }
a
c

JSC:
&gt; o = { a : 1, __proto__: { b : 2 } };
[object Object]
&gt; for (var p in o) { if (p == &quot;a&quot;) o.__proto__ = { c : 3 }; print(p); }
a

Case 2: add a property to o.__proto__ while o is being enumerated.

SpiderMonkey:
js&gt; o = { a : 1, __proto__: {} };
({a:1})
js&gt; for (var p in o) { if (p == &quot;a&quot;) { o.__proto__.b = 2; }; print(p); }
a
b

JSC:
&gt; o = { a : 1, __proto__: { } };
[object Object]
&gt; for (var p in o) { if (p == &quot;a&quot;) { o.__proto__.b = 2; }; print(p); }
a

Case 3: delete a property on o and add a property with the same name on o.__proto__ before o.__proto__ is being enumerated.

SpiderMonkey:
js&gt; o = { a : 1, __proto__: { b : 2 } };
({a:1})
js&gt; for (var p in o) { if ((p == &quot;a&quot;) &amp;&amp; o.hasOwnProperty(&quot;a&quot;)) { delete o.a; o.__proto__.a = 3; }; print(p); }
a
b
a

JSC:
&gt; o = { a : 1, __proto__: { b : 2 } };
[object Object]
&gt; for (var p in o) { if ((p == &quot;a&quot;) &amp;&amp; o.hasOwnProperty(&quot;a&quot;)) { delete o.a; o.__proto__.a = 3; }; print(p); }
a
b

Again, I find the SpiderMonkey behavior fits with the ECMA-262 wording in all three cases. So maybe I&apos;m misunderstanding the _purpose_ of the rule, but the question is whether it should be implemented as it&apos;s currently worded.
I&apos;ll probably fire off a mail to es-discuss@ about this, once I&apos;ve been able to check the behavior on IE8. (Attempt on Opera 10.10 was futile because it doesn&apos;t seem to support the __proto__ extension.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>180544</commentid>
    <comment_count>20</comment_count>
      <attachid>46130</attachid>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2010-01-13 22:18:33 -0800</bug_when>
    <thetext>Comment on attachment 46130
Revised patch (adds tests)

Okay, i think the for..in enumeration issue can be considered separate from this.  So r=me</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>180547</commentid>
    <comment_count>21</comment_count>
      <attachid>46130</attachid>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2010-01-13 22:37:20 -0800</bug_when>
    <thetext>Comment on attachment 46130
Revised patch (adds tests)

Clearing flags on attachment: 46130

Committed r53239: &lt;http://trac.webkit.org/changeset/53239&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>180548</commentid>
    <comment_count>22</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2010-01-13 22:37:27 -0800</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>45662</attachid>
            <date>2009-12-30 07:05:02 -0800</date>
            <delta_ts>2010-01-08 03:58:33 -0800</delta_ts>
            <desc>Proposed patch</desc>
            <filename>JSONstringify.diff</filename>
            <type>text/plain</type>
            <size>1855</size>
            <attacher name="Kent Hansen">kent.hansen</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL0phdmFTY3JpcHRDb3JlL0NoYW5nZUxvZyBiL0phdmFTY3JpcHRDb3JlL0No
YW5nZUxvZwppbmRleCAwYjVmZTc4Li5kOTFkZjgyIDEwMDY0NAotLS0gYS9KYXZhU2NyaXB0Q29y
ZS9DaGFuZ2VMb2cKKysrIGIvSmF2YVNjcmlwdENvcmUvQ2hhbmdlTG9nCkBAIC0xLDMgKzEsMTQg
QEAKKzIwMDktMTItMzAgIEtlbnQgSGFuc2VuICA8a2VudC5oYW5zZW5Abm9raWEuY29tPgorCisg
ICAgICAgIFJldmlld2VkIGJ5IE5PQk9EWSAoT09QUyEpLgorCisgICAgICAgIEpTT04uc3RyaW5n
aWZ5IGFuZCBKU09OLnBhcnNlIG5lZWRsZXNzbHkgcHJvY2VzcyBwcm9wZXJ0aWVzIGluIHRoZSBw
cm90b3R5cGUgY2hhaW4KKyAgICAgICAgaHR0cHM6Ly9idWdzLndlYmtpdC5vcmcvc2hvd19idWcu
Y2dpP2lkPTMzMDUzCisKKyAgICAgICAgKiBydW50aW1lL0pTT05PYmplY3QuY3BwOgorICAgICAg
ICAoSlNDOjpTdHJpbmdpZmllcjo6SG9sZGVyOjphcHBlbmROZXh0UHJvcGVydHkpOgorICAgICAg
ICAoSlNDOjpXYWxrZXI6OndhbGspOgorCiAyMDA5LTEyLTI4ICBTaHUgQ2hhbmcgIDxDaGFuZy5T
aHVAbm9raWEuY29tPgogCiAgICAgICAgIFJldmlld2VkIGJ5IExhc3psbyBHb21ib3MuCmRpZmYg
LS1naXQgYS9KYXZhU2NyaXB0Q29yZS9ydW50aW1lL0pTT05PYmplY3QuY3BwIG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AgIG9iamVjdFN0YWNrLmFwcGVuZChvYmplY3QpOwogICAgICAgICAgICAgICAgIGluZGV4
U3RhY2suYXBwZW5kKDApOwogICAgICAgICAgICAgICAgIHByb3BlcnR5U3RhY2suYXBwZW5kKFBy
b3BlcnR5TmFtZUFycmF5KG1fZXhlYykpOwotICAgICAgICAgICAgICAgIG9iamVjdC0+Z2V0UHJv
cGVydHlOYW1lcyhtX2V4ZWMsIHByb3BlcnR5U3RhY2subGFzdCgpKTsKKyAgICAgICAgICAgICAg
ICBvYmplY3QtPmdldE93blByb3BlcnR5TmFtZXMobV9leGVjLCBwcm9wZXJ0eVN0YWNrLmxhc3Qo
KSk7CiAgICAgICAgICAgICAgICAgLy8gZmFsbHRocm91Z2gKICAgICAgICAgICAgIH0KICAgICAg
ICAgICAgIG9iamVjdFN0YXJ0VmlzaXRNZW1iZXI6Cg==
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>46130</attachid>
            <date>2010-01-08 03:58:33 -0800</date>
            <delta_ts>2010-01-13 22:37:20 -0800</delta_ts>
            <desc>Revised patch (adds tests)</desc>
            <filename>JSONstringify2.diff</filename>
            <type>text/plain</type>
            <size>15597</size>
            <attacher name="Kent Hansen">kent.hansen</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL0phdmFTY3JpcHRDb3JlL0NoYW5nZUxvZyBiL0phdmFTY3JpcHRDb3JlL0No
YW5nZUxvZwppbmRleCAwMTdjMGRhLi5lYjUwZDdlIDEwMDY0NAotLS0gYS9KYXZhU2NyaXB0Q29y
ZS9DaGFuZ2VMb2cKKysrIGIvSmF2YVNjcmlwdENvcmUvQ2hhbmdlTG9nCkBAIC0xLDMgKzEsMTQg
QEAKKzIwMTAtMDEtMDcgIEtlbnQgSGFuc2VuICA8a2VudC5oYW5zZW5Abm9raWEuY29tPgorCisg
ICAgICAgIFJldmlld2VkIGJ5IE5PQk9EWSAoT09QUyEpLgorCisgICAgICAgIEpTT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nJheVdpdGhQcm90bywgbnVsbCwgNCk7CisgICAgfSk7CisgICAgcmVz
dWx0LnB1c2goZnVuY3Rpb24oanNvbk9iamVjdCl7CisgICAgICAgIHJldHVybiBqc29uT2JqZWN0
LnN0cmluZ2lmeShzaW1wbGVBcnJheVdpdGhQcm90bywgbnVsbCwgImFiIik7CisgICAgfSk7Cisg
ICAgcmVzdWx0LnB1c2goZnVuY3Rpb24oanNvbk9iamVjdCl7CisgICAgICAgIHJldHVybiBqc29u
T2JqZWN0LnN0cmluZ2lmeShzaW1wbGVBcnJheVdpdGhQcm90bywgbnVsbCwgNCk7CisgICAgfSk7
CisgICAgcmVzdWx0LnB1c2goZnVuY3Rpb24oanNvbk9iamVjdCl7CisgICAgICAgIHJldHVybiBq
c29uT2JqZWN0LnN0cmluZ2lmeShzaW1wbGVPYmplY3RXaXRoUHJvdG8sIG51bGwsICIgICIpOwor
ICAgIH0pOworICAgIHJlc3VsdC5wdXNoKGZ1bmN0aW9uKGpzb25PYmplY3QpeworICAgICAgICBy
ZXR1cm4ganNvbk9iamVjdC5zdHJpbmdpZnkoc2ltcGxlT2JqZWN0V2l0aFByb3RvLCBudWxsLCA0
KTsKKyAgICB9KTsKKyAgICByZXN1bHQucHVzaChmdW5jdGlvbihqc29uT2JqZWN0KXsKKyAgICAg
ICAgcmV0dXJuIGpzb25PYmplY3Quc3RyaW5naWZ5KHNpbXBsZU9iamVjdFdpdGhQcm90bywgbnVs
bCwgImFiIik7CisgICAgfSk7CisgICAgcmVzdWx0LnB1c2goZnVuY3Rpb24oanNvbk9iamVjdCl7
CisgICAgICAgIHJldHVybiBqc29uT2JqZWN0LnN0cmluZ2lmeShzaW1wbGVPYmplY3RXaXRoUHJv
dG8sIG51bGwsIDQpOworICAgIH0pOworICAgIHJlc3VsdC5wdXNoKGZ1bmN0aW9uKGpzb25PYmpl
Y3QpeworICAgICAgICByZXR1cm4ganNvbk9iamVjdC5zdHJpbmdpZnkoc2ltcGxlT2JqZWN0V2l0
aF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KGpzb25PYmplY3QpeworICAgICAgICByZXR1cm4g
anNvbk9iamVjdC5zdHJpbmdpZnkoY29tcGxleEFycmF5V2l0aFByb3RvLCBudWxsLCA0KTsKKyAg
ICB9KTsKKyAgICByZXN1bHQucHVzaChmdW5jdGlvbihqc29uT2JqZWN0KXsKKyAgICAgICAgcmV0
dXJuIGpzb25PYmplY3Quc3RyaW5naWZ5KGNvbXBsZXhBcnJheVdpdGhQcm90bywgbnVsbCwgImFi
Iik7CisgICAgfSk7CisgICAgcmVzdWx0LnB1c2goZnVuY3Rpb24oanNvbk9iamVjdCl7CisgICAg
ICAgIHJldHVybiBqc29uT2JqZWN0LnN0cmluZ2lmeShjb21wbGV4QXJyYXlXaXRoUHJvdG8sIG51
bGwsIDQpOworICAgIH0pOworICAgIHJlc3VsdC5wdXNoKGZ1bmN0aW9uKGpzb25PYmplY3Qpewor
ICAgICAgICByZXR1cm4ganNvbk9iamVjdC5zdHJpbmdpZnkoY29tcGxleE9iamVjdFdpdGhQcm90
bywgbnVsbCwgIiAgIik7CisgICAgfSk7CisgICAgcmVzdWx0LnB1c2goZnVuY3Rpb24oanNvbk9i
amVjdCl7CisgICAgICAgIHJldHVybiBqc29uT2JqZWN0LnN0cmluZ2lmeShjb21wbGV4T2JqZWN0
V2l0aFByb3RvLCBudWxsLCA0KTsKKyAgICB9KTsKKyAgICByZXN1bHQucHVzaChmdW5jdGlvbihq
c29uT2JqZWN0KXsKKyAgICAgICAgcmV0dXJuIGpzb25PYmplY3Quc3RyaW5naWZ5KGNvbXBsZXhP
YmplY3RXaXRoUHJvdG8sIG51bGwsICJhYiIpOworICAgIH0pOworICAgIHJlc3VsdC5wdXNoKGZ1
bmN0aW9uKGpzb25PYmplY3QpeworICAgICAgICByZXR1cm4ganNvbk9iamVjdC5zdHJpbmdpZnko
Y29tcGxleE9iamVjdFdpdGhQcm90bywgbnVsbCwgNCk7CisgICAgfSk7CisgICAgcmVzdWx0LnB1
c2goZnVuY3Rpb24oanNvbk9iamVjdCl7CisgICAgICAgIHJldHVybiBqc29uT2JqZWN0LnN0cmlu
Z2lmeShvYmplY3RXaXRoU2lkZUVmZmVjdEdldHRlcik7CisgICAgfSk7CisgICAgcmVzdWx0LnB1
c2goZnVuY3Rpb24oanNvbk9iamVjdCl7CisgICAgICAgIHJldHVybiBqc29uT2JqZWN0LnN0cmlu
Z2lmeShvYmplY3RXaXRoU2lkZUVmZmVjdEdldHRlckFuZFByb3RvKTsKKyAgICB9KTsKKyAgICBy
ZXN1bHQucHVzaChmdW5jdGlvbihqc29uT2JqZWN0KXsKKyAgICAgICAgcmV0dXJuIGpzb25PYmpl
Y3Quc3RyaW5naWZ5KGFycmF5V2l0aFNpZGVFZmZlY3RHZXR0ZXIpOworICAgIH0pOworICAgIHJl
c3VsdC5wdXNoKGZ1bmN0aW9uKGpzb25PYmplY3QpeworICAgICAgICByZXR1cm4ganNvbk9iamVj
dC5zdHJpbmdpZnkoYXJyYXlXaXRoU2lkZUVmZmVjdEdldHRlckFuZFByb3RvKTsKKyAgICB9KTsK
ICAgICB2YXIgcmVwbGFjZVRyYWNrZXI7CiAgICAgZnVuY3Rpb24gcmVwbGFjZUZ1bmMoa2V5LCB2
YWx1ZSkgewogICAgICAgICByZXBsYWNlVHJhY2tlciArPSBrZXkgKyAiKCIrKHR5cGVvZiBrZXkp
KyIpIiArIEpTT04uc3RyaW5naWZ5KHZhbHVlKSArICI7IjsK
</data>

          </attachment>
      

    </bug>

</bugzilla>