<?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>3539</bug_id>
          
          <creation_ts>2005-06-14 19:19:33 -0700</creation_ts>
          <short_desc>Array join and toString methods do not support circular references</short_desc>
          <delta_ts>2005-12-10 11:04:16 -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>412</version>
          <rep_platform>Mac</rep_platform>
          <op_sys>OS X 10.4</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</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="David Wheeler">david</reporter>
          <assigned_to name="Oliver Hunt">oliver</assigned_to>
          <cc>brendan</cc>
    
    <cc>oliver</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>12055</commentid>
    <comment_count>0</comment_count>
    <who name="David Wheeler">david</who>
    <bug_when>2005-06-14 19:19:33 -0700</bug_when>
    <thetext>If I have a circular reference in WebKit JavaScript, I can&apos;t dig into it effectively. For example, given this 
code:

  var ary = [1, 2];
  ary.push(ary);
  for (var i = 0; i &lt; ary.length; i++) {
    document.write(typeof ary[0] + &apos;: &apos; + ary[i] + &apos; &apos;);
  }

In Safari, this outputs &quot;number: 1 number: 2&quot;. In Firefox, it outputs &quot;number: 1 number: 2 number: 1,2, 
&quot;. The upshot is that I cannot access any of the elements of ary when I get at it through ary[2], but I 
should be able to. ary == ary[2] does evaluate to true, so I&apos;m not sure what&apos;s happening here.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>12067</commentid>
    <comment_count>1</comment_count>
      <attachid>2348</attachid>
    <who name="Joost de Valk (AlthA)">joost</who>
    <bug_when>2005-06-14 23:27:28 -0700</bug_when>
    <thetext>Created attachment 2348
testcase</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>12068</commentid>
    <comment_count>2</comment_count>
    <who name="Joost de Valk (AlthA)">joost</who>
    <bug_when>2005-06-14 23:28:21 -0700</bug_when>
    <thetext>I&apos;ll confirm this one, since it doesn&apos;t do the same as it does in Firefox either. But, please attach the 
testcase yourself next time :).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>12478</commentid>
    <comment_count>3</comment_count>
    <who name="David Wheeler">david</who>
    <bug_when>2005-06-17 11:54:35 -0700</bug_when>
    <thetext>I forgot to mention that the reason it does not print what&apos;s in the third slot of the array is that an 
exception is thrown. The exception is:

  TypeError – No default value
  undefined                                                        Line: 0

My guess is that this is triggered somehow by the circular reference. Also, this only comes up if I iterate 
over the array using for() or do something else like call sort(). If I just reach into the circular reference, 
like this:
  
  document.write(ary[2][1]);

things work fine.

HTH.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>13130</commentid>
    <comment_count>4</comment_count>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2005-06-25 06:29:56 -0700</bug_when>
    <thetext>Righto have been going through ECMA 262 document, and it looks like mozilla/firefox&apos;s result is non 
standard.

That said the current error given is also not ideal, and that&apos;s a result of ObjectImp::defaultValue() 
unconditionally blatting an exception.  I&apos;m attaching a patch that fixes the behaviour of defaultValue() 
so that the user gets a RangeError (specifically for a stack overflow, the root cause of this problem).

The bug is made apparent in the Array.join method which is defined to produce a string containing a 
list of each element of the array.  If an element is undefined or null then an empty string is substituted.  
Logically in the event of an exception the exception should be propogated (the spec doesn&apos;t say 
otherwise), so that&apos;s what we do. 

Is this an ideal solution?  It&apos;s what the standard says, but is it what is expected?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>13131</commentid>
    <comment_count>5</comment_count>
      <attachid>2640</attachid>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2005-06-25 06:32:11 -0700</bug_when>
    <thetext>Created attachment 2640
Patch to fix the *type* of error given to what it should be

Fixes the behaviour of ObjectImp::defaultValue() to prevent it from overriding
an already thrown exception</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>13142</commentid>
    <comment_count>6</comment_count>
    <who name="David Wheeler">david</who>
    <bug_when>2005-06-25 10:25:28 -0700</bug_when>
    <thetext>Can you cite the passage(s) in the ECSM 262 standard that demonstrate that Firefox/Mozilla&apos;s behavior is 
non-standard? It seems to me that any first-class programming language should properly support circular 
references.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>13143</commentid>
    <comment_count>7</comment_count>
    <who name="Brendan Eich">brendan</who>
    <bug_when>2005-06-25 11:32:28 -0700</bug_when>
    <thetext>ECMA-262 does not specify behavior in the case of divergence through ToString. 
This is a flaw in the standard.

Edition 3 section 16 allows extensions such as the one in Mozilla&apos;s SpiderMonkey
engine.  In 1998 or so, leading up to Edition 3 work, I implemented and proposed
toSource and sharp variables (after Common Lisp) to handle cycles and join
points in object graphs.  Example from this bug:

$ Linux_All_DBG.OBJ/js
js&gt; a = [1, 2]
1,2
js&gt; a.push(a)
3
js&gt; a
1,2,
js&gt; a.toSource()
#1=[1, 2, #1#]

In general, in SpiderMonkey, uneval(v) produces a string s such that eval(s) is
either === v if v is primitive, or an isomorphic object graph if v is an object
reference.  In the object case, uneval tries to call toSource, just as toString
is tried from [[DefaultValue]] in 262.

Some on the committee were against any such complete serialization notation,
claiming serialization was too domain-specific to capture in the standard.  That
is a cop-out: standards follow the 80/20 rule too, or should.  Do cycles and
join points fall into the hard-case 20 percent?  I think not.  Does serializing
hooks for private native data fall there?  Probably, but that&apos;s a different case
from cycles and join points.

There may also have been aesthetic objections, without counterproposals.  This
is all water under the bridge, unless some subset of ECMA TG1 rallies again for
Edition 4.

Hope this helps,

/be</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>13165</commentid>
    <comment_count>8</comment_count>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2005-06-25 22:10:41 -0700</bug_when>
    <thetext>The join operator (what an arrays ToString is implemented as) is definied in ECMA-262 15.4.4.5

for easy reference:
&lt;quote&gt;
Ar r a y . pr o t o t y pe . j o i n ( s e pa r a t o r ) 
The el ement s of t he ar r ay ar e conver t ed t o st r i ngs, and t hese st r i ngs ar e t hen concat enat 
ed, separ at ed 
by occur r ences of t he separat or. I f no separ at or i s pr ovi ded, a si ngl e comma i s used as t he 
separ at or . 
The join met hod t akes one ar gument , separat or, and per f or ms t he f ol l owi ng st eps: 
1. Cal l t he [ [ Get ]] met hod of t hi s obj ect wi t h ar gument &quot;length&quot;. 
2. Cal l ToUi nt 32( Resul t ( 1) ) . 
3. I f separat or i s undef i ned, l et separat or be t he si ngl e- char act er st r i ng &quot;,&quot;. 
4. Cal l ToSt r i ng( separat or) . 
5. If Resul t (2) i s zero, ret urn t he empt y st ri ng. 
6. Cal l t he [ [ Get ]] met hod of t hi s obj ect wi t h ar gument &quot;0&quot;. 
7. If Resul t (6) i s undef i ned or nul l , use t he empt y st r i ng; ot her wi se, cal l ToSt r i ng( Resul t 
( 6) ) . 
8. Let R be Resul t ( 7) . 
9. Let k be 1. 
10. I f k equal s Resul t ( 2) , r et ur n R. 
11. Let S be a st r i ng val ue pr oduced by concat enat i ng R and Resul t ( 4) . 
12. Cal l t he [ [ Get ]] met hod of t hi s obj ect wi t h ar gument ToSt r i ng( k) . 
13. I f Resul t ( 12) i s undef i ned or nul l , use t he empt y st r i ng; ot her wi se, cal l ToSt r i ng( Resul 
t ( 12) ) . 
14. Let R be a st r i ng val ue pr oduced by concat enat i ng S and Resul t ( 13) . 
15. I ncr ease k by 1. 
16. Go t o st ep 10. 
The length pr oper t y of t he join met hod i s 1. 
NOTE 
The join f unct i on i s i nt ent i onal l y generi c; i t does not requi re t hat i t s t hi s val ue be an Array 
obj ect . 
Theref ore, i t can be t ransf erred t o ot her ki nds of obj ect s f or use as a met hod. Whet her t he join 
f unct i on can be appl i ed successf ul l y t o a host obj ect i s i mpl ement at i on- dependent . 
&lt;/quote&gt;

Given it does not specifically handle exceptions then tthe behaviour should match standard 
programming semantics -- the exception should be propogated.

Brendan: does mozilla just track each object ToString/join has been called in? or does it have a more 
elegant way of killing off self-recursion?

David: JavaScript handles the self recursion easily -- ToString is a recursive function, and it behaves in 
exactly the same way any language would behave in this case...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>13166</commentid>
    <comment_count>9</comment_count>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2005-06-25 22:21:11 -0700</bug_when>
    <thetext>Given firefox/ie behave the same, and conversation in #webkit, will provide a fix to match firefox/IE 
behaviour

</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>13197</commentid>
    <comment_count>10</comment_count>
      <attachid>2649</attachid>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2005-06-25 23:21:38 -0700</bug_when>
    <thetext>Created attachment 2649
Patch to match behaviour of firefox and IE

Okay this patch is a somewhat inelegant solution, but it matches the behaviour
of firefox and IE

I&apos;m not obsoleting the old patch as a i believe it does fix a bug anyway</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>13201</commentid>
    <comment_count>11</comment_count>
      <attachid>2651</attachid>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2005-06-26 00:19:43 -0700</bug_when>
    <thetext>Created attachment 2651
edge case test for patch

sample file demonstrating an array of depth larger than the stack allows --
people running firefox/mac may want to be careful on this one... firefox
doesn&apos;t seem to like it at all.

In this case we just get a straight stack overflow which raises the question of
what we should do if toString encounters an exception...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>13202</commentid>
    <comment_count>12</comment_count>
    <who name="Brendan Eich">brendan</who>
    <bug_when>2005-06-26 01:03:41 -0700</bug_when>
    <thetext>
(In reply to comment #8)
&gt; 13. If Result (12) is undefined or null, use the empty string; otherwise,
&gt;     call ToString(Result(12)).
[snip]
&gt; Given it does not specifically handle exceptions then the behaviour should
&gt; match standard programming semantics -- the exception should be propogated.

Section 16, the second item in the second unordered list, allows extensions to
conceal errors.  It&apos;s also striking that runaway recursion under toString is not
dealt with by the spec -- that&apos;s a flaw, again, IMO.

&gt; Brendan: does mozilla just track each object ToString/join has been called in?
&gt; or does it have a more elegant way of killing off self-recursion?

The only way to implement this correctly is to map all objects reached by the
depth-first search being done by join or toString, using storage local to the
current activation to hold the map.  See
http://lxr.mozilla.org/mozilla/search?string=EnterSharpObject.

/be</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>13203</commentid>
    <comment_count>13</comment_count>
      <attachid>2652</attachid>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2005-06-26 01:12:40 -0700</bug_when>
    <thetext>Created attachment 2652
Another edge case, slightly less ugly than previous

This is another test case, partly to see what firefox does if an exception
occurs during Array.toString
firefox/mac doesn&apos;t behave well with this one either</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>13204</commentid>
    <comment_count>14</comment_count>
    <who name="Brendan Eich">brendan</who>
    <bug_when>2005-06-26 01:57:06 -0700</bug_when>
    <thetext>Firefox 1.0.3 on Linux behaves well enough on those tests, considering.  Deer
Park alpha 1 on Linux fails immediately with out of memory from document.write
-- I&apos;m not sure why.

/be</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>13294</commentid>
    <comment_count>15</comment_count>
      <attachid>2665</attachid>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2005-06-27 04:54:20 -0700</bug_when>
    <thetext>Created attachment 2665
test case for cyclic references in array.toString

test case that works within the webkit test suite</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>13295</commentid>
    <comment_count>16</comment_count>
      <attachid>2666</attachid>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2005-06-27 04:56:11 -0700</bug_when>
    <thetext>Created attachment 2666
expected results of cyclic reference testcase

expected results for webkit testcase</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>13302</commentid>
    <comment_count>17</comment_count>
      <attachid>2669</attachid>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2005-06-27 05:30:22 -0700</bug_when>
    <thetext>Created attachment 2669
testcase for tostring with non-cyclic, but deep hierarchies

This test requires the first patch (which allows the correct exception to be
propogated)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>13303</commentid>
    <comment_count>18</comment_count>
      <attachid>2670</attachid>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2005-06-27 05:31:38 -0700</bug_when>
    <thetext>Created attachment 2670
expected output from the deep hierarchies test</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>13304</commentid>
    <comment_count>19</comment_count>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2005-06-27 05:35:26 -0700</bug_when>
    <thetext>Should the two patches be merged into one?  Strictly speaking the first patch fixes the type of exception 
the user would see, so might not be considered part of this bug... on the otherhand it does obscure the 
actual error that has occured.

Otherwise if no one has any complaints i&apos;ll flag these for review</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>13326</commentid>
    <comment_count>20</comment_count>
    <who name="David Wheeler">david</who>
    <bug_when>2005-06-27 10:19:25 -0700</bug_when>
    <thetext>FWIW, I saw this bug with .sort(), too. If that just uses toString(), then it&apos;s the same bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>13373</commentid>
    <comment_count>21</comment_count>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2005-06-27 15:35:03 -0700</bug_when>
    <thetext>I did a quick test, and sort seems to work fine -- you sure it wasn&apos;t a cycle in the array causing toString to 
die?  With the patches applied it doesn&apos;t crash and burn at all, which seem to imply that any problems 
were in the output...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>13375</commentid>
    <comment_count>22</comment_count>
      <attachid>2676</attachid>
    <who name="David Wheeler">david</who>
    <bug_when>2005-06-27 15:45:45 -0700</bug_when>
    <thetext>Created attachment 2676
sort() Test Case

No, I&apos;m not sure, but this new test case demonstrates the problem using sort().
If it&apos;s just failing because sort uses toString() internally, then great. If
not, then is it related at all?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>13376</commentid>
    <comment_count>23</comment_count>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2005-06-27 15:57:25 -0700</bug_when>
    <thetext>Yep that passes with the patches applied -- so sort is using either array.tostring or array.join, either way it 
works.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>13386</commentid>
    <comment_count>24</comment_count>
      <attachid>2640</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2005-06-27 17:24:59 -0700</bug_when>
    <thetext>Comment on attachment 2640
Patch to fix the *type* of error given to what it should be

Looks like a good change, but it&apos;s not formatted correctly. Please look at
&lt;http://webkit.opendarwin.org/coding/coding-style.html&gt;.

Also, it would be better if this patch had a separate bug report, and a test
case demonstrating it&apos;s fixed, rather than being part of the &quot;does not support
circular references&quot; bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>13387</commentid>
    <comment_count>25</comment_count>
      <attachid>2649</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2005-06-27 17:36:28 -0700</bug_when>
    <thetext>Comment on attachment 2649
Patch to match behaviour of firefox and IE

Looks like this is on the right track.

Formatting is not really right
&lt;http://webkit.opendarwin.org/coding/coding-style.html&gt;.

Before landing this, we need to figure out exactly which tests to land with it;
at the moment there are lots of different tests attached to the bug and they
need to be put in layout test form.

I&apos;m not comfortable with using a giant global array as part of the solution
here. I suggest we make a small fixed-size global array, then switch over to
using a hash table instead once we pass a certain recursion threshold to avoid
O(n^2) behavior. That also has the pleasant quality of making the global much
smaller.

Is it OK to share a single array between both Join and ToString? I&apos;d like to
see a test that checks for that.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>13395</commentid>
    <comment_count>26</comment_count>
      <attachid>2670</attachid>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2005-06-27 18:41:33 -0700</bug_when>
    <thetext>Comment on attachment 2670
expected output from the deep hierarchies test

Moved to bug 3743</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>13396</commentid>
    <comment_count>27</comment_count>
      <attachid>2669</attachid>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2005-06-27 18:42:38 -0700</bug_when>
    <thetext>Comment on attachment 2669
testcase for tostring with non-cyclic, but deep hierarchies

Moved to bug 3743</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>13397</commentid>
    <comment_count>28</comment_count>
      <attachid>2640</attachid>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2005-06-27 18:44:40 -0700</bug_when>
    <thetext>Comment on attachment 2640
Patch to fix the *type* of error given to what it should be

Moved to bug 3743</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>13398</commentid>
    <comment_count>29</comment_count>
    <who name="David Wheeler">david</who>
    <bug_when>2005-06-27 18:51:43 -0700</bug_when>
    <thetext>(In reply to comment #25)

&gt; Before landing this, we need to figure out exactly which tests to land with it;
&gt; at the moment there are lots of different tests attached to the bug and they
&gt; need to be put in layout test form.

For my future reference, what is &quot;layout test form&quot;? Is it documented somewhere I can find it so that I can 
submit future tests using it?

Thanks!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>13399</commentid>
    <comment_count>30</comment_count>
      <attachid>2651</attachid>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2005-06-27 19:01:01 -0700</bug_when>
    <thetext>Comment on attachment 2651
edge case test for patch

obsoleted by layout tests</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>13400</commentid>
    <comment_count>31</comment_count>
      <attachid>2652</attachid>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2005-06-27 19:02:19 -0700</bug_when>
    <thetext>Comment on attachment 2652
Another edge case, slightly less ugly than previous

obsoleted by layout tests</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>13402</commentid>
    <comment_count>32</comment_count>
      <attachid>2669</attachid>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2005-06-27 19:04:22 -0700</bug_when>
    <thetext>Comment on attachment 2669
testcase for tostring with non-cyclic, but deep hierarchies

moved to bug 3743</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>13403</commentid>
    <comment_count>33</comment_count>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2005-06-27 19:24:32 -0700</bug_when>
    <thetext>attachment 2665 and attachment 2666 seem to match the layout format -- at least
they fit in with the the standard webkit tests</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>13415</commentid>
    <comment_count>34</comment_count>
      <attachid>2683</attachid>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2005-06-28 03:51:04 -0700</bug_when>
    <thetext>Created attachment 2683
Quick test for join and toString operating concurrently

Here&apos;s a test that demonstrates the use of join and toString in a big unholy
mess.  Not a webkit test atm, but should be sometime early tomorrow (NZST).  

toString just falls through to the join method in an Array so given the absence
of concurrent execution in kjs they are fine anyway.  Each call to
join/toString increases the stack depth, and we currently allocate enough space
to fit the entire maximum call depth.

Darin: re: the hashmap should i just switch over to using that now? rather than
applying the current array driven look up? and what should i be using as a
hashmap implementation, from irc it sounds like there&apos;s an internal one we
should be using...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>15177</commentid>
    <comment_count>35</comment_count>
    <who name="Geoffrey Garen">ggaren</who>
    <bug_when>2005-07-25 14:13:21 -0700</bug_when>
    <thetext>I have landed the patch for bug #3991.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>15180</commentid>
    <comment_count>36</comment_count>
    <who name="David Wheeler">david</who>
    <bug_when>2005-07-25 14:41:04 -0700</bug_when>
    <thetext>(In reply to comment #35)
&gt; I have landed the patch for bug #3991.

Uh, does that mean that this issue has been fixed?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>23293</commentid>
    <comment_count>37</comment_count>
      <attachid>4532</attachid>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2005-10-29 21:52:39 -0700</bug_when>
    <thetext>Created attachment 4532
Reimplemented patch with HashSet

Okay, now HashSet is available in JSC I&apos;ve got round to rewriting patch to use
it.

Needs to be reindented, and needs a half-decent testcase, but it&apos;s here now :)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>23846</commentid>
    <comment_count>38</comment_count>
      <attachid>4532</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2005-11-09 07:39:33 -0800</bug_when>
    <thetext>Comment on attachment 4532
Reimplemented patch with HashSet

I don&apos;t understand why it&apos;s necessary to copy thisObj into a second local
variable currentRef. Lets just use thisObj directly unless there&apos;s a reason not
to.

I think it would be easier to read this if the code said:

    if (visitedElems.contains(thisObj))
	return String(&quot;&quot;);

before anything else (even before declaring separator and str), rather than
indenting all the code inside an if statement. That would also probably make
the diff smaller and easier to verify.

Also, I think the HashSet should be:

    HashSet&lt; ObjectImp*, PointerHash&lt;ObjectImp*&gt; &gt;

There&apos;s an advantage to HashSet&lt;void*&gt;, in that we&apos;re guaranteed all such sets
are a single template expansion, preventing any possible code bloat. But a
disadvantage to HashSet&lt;void*&gt; is that without type safety, it&apos;s possible to
make certain mistakes with a set (for example, adding and removing the same
object, but a pointer to a different part in the case of multiple inheritance).
In this case, I think the code is simple enough that I don&apos;t think there are
any real problems, but I&apos;d prefer to get off on the right foot using this
class.

There are a few minor formatting problems, for example:

    ObjectImp *currentRef=thisObj;

the above needs spaces around the &quot;=&quot;. And:

+    if(!visitedElems.contains(currentRef)) {	 

the above needs a space after the if and before the opening parenthesis. And:

+	 if ( exec-&gt;hadException() )
+	   break;

if you&apos;re going to modify the code, you should fix the format of that by
removing the extra spaces inside the parentheses.

Also, there are a number of 1-line if and else statements with braces; style
guide says not to use braces in these cases.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>25167</commentid>
    <comment_count>39</comment_count>
      <attachid>4860</attachid>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2005-11-29 17:07:36 -0800</bug_when>
    <thetext>Created attachment 4860
Hopefully the final patch

Reformatted and implemented darins suggestion</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>25168</commentid>
    <comment_count>40</comment_count>
      <attachid>4861</attachid>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2005-11-29 17:25:37 -0800</bug_when>
    <thetext>Created attachment 4861
Fixed HashMap to be typesafe</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>25169</commentid>
    <comment_count>41</comment_count>
      <attachid>4862</attachid>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2005-11-29 17:49:30 -0800</bug_when>
    <thetext>Created attachment 4862
Testcase for toString on arrays with self references

New testcase</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>25172</commentid>
    <comment_count>42</comment_count>
      <attachid>4863</attachid>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2005-11-29 18:28:38 -0800</bug_when>
    <thetext>Created attachment 4863
Testcase, though it needs a better name</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>25173</commentid>
    <comment_count>43</comment_count>
      <attachid>4864</attachid>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2005-11-29 18:29:29 -0800</bug_when>
    <thetext>Created attachment 4864
Expected output from testcase</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>25261</commentid>
    <comment_count>44</comment_count>
      <attachid>4861</attachid>
    <who name="Maciej Stachowiak">mjs</who>
    <bug_when>2005-11-30 23:45:57 -0800</bug_when>
    <thetext>Comment on attachment 4861
Fixed HashMap to be typesafe

r=me</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>25262</commentid>
    <comment_count>45</comment_count>
      <attachid>4861</attachid>
    <who name="Maciej Stachowiak">mjs</who>
    <bug_when>2005-11-30 23:45:58 -0800</bug_when>
    <thetext>Comment on attachment 4861
Fixed HashMap to be typesafe

r=me</thetext>
  </long_desc>
      
          <attachment
              isobsolete="1"
              ispatch="0"
              isprivate="0"
          >
            <attachid>2348</attachid>
            <date>2005-06-14 23:27:28 -0700</date>
            <delta_ts>2005-11-29 17:49:30 -0800</delta_ts>
            <desc>testcase</desc>
            <filename>testcase-javascript-circular-reference.html</filename>
            <type>text/html</type>
            <size>264</size>
            <attacher name="Joost de Valk (AlthA)">joost</attacher>
            
              <data encoding="base64">PGh0bWw+CjxoZWFkPgoJPHRpdGxlPlRlc3RjYXNlIGZvciBiZyAzNTM3PC90aXRsZT4KPC9oZWFk
PgoKPGJvZHk+CjxzY3JpcHQgdHlwZT0idGV4dC9qYXZhc2NyaXB0Ij4KICB2YXIgYXJ5ID0gWzEs
IDJdOwogIGFyeS5wdXNoKGFyeSk7CiAgZm9yICh2YXIgaSA9IDA7IGkgPCBhcnkubGVuZ3RoOyBp
KyspIHsKICAgIGRvY3VtZW50LndyaXRlKHR5cGVvZiBhcnlbMF0gKyAnOiAnICsgYXJ5W2ldICsg
JyAnKTsKICB9Cjwvc2NyaXB0Pgo8L2JvZHk+CjwvaHRtbD4K
</data>

          </attachment>
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>2640</attachid>
            <date>2005-06-25 06:32:11 -0700</date>
            <delta_ts>2005-06-27 18:44:40 -0700</delta_ts>
            <desc>Patch to fix the *type* of error given to what it should be</desc>
            <filename>bug3539patch</filename>
            <type>text/plain</type>
            <size>641</size>
            <attacher name="Oliver Hunt">oliver</attacher>
            
              <data encoding="base64">SW5kZXg6IC4vSmF2YVNjcmlwdENvcmUva2pzL29iamVjdC5jcHAKPT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQpSQ1MgZmls
ZTogL2N2cy9yb290L0phdmFTY3JpcHRDb3JlL2tqcy9vYmplY3QuY3BwLHYKcmV0cmlldmluZyBy
ZXZpc2lvbiAxLjQzCmRpZmYgLXAgLXUgLXIxLjQzIC4vSmF2YVNjcmlwdENvcmUva2pzL29iamVj
dC5jcHAKLS0tIC4vSmF2YVNjcmlwdENvcmUva2pzL29iamVjdC5jcHAJMjAwNS8wNi8yMiAwMDo0
ODo0NwkxLjQzCisrKyAuL0phdmFTY3JpcHRDb3JlL2tqcy9vYmplY3QuY3BwCTIwMDUvMDYvMjUg
MTM6MTg6MzIKQEAgLTM4NCw3ICszODQsMTIgQEAgVmFsdWUgT2JqZWN0SW1wOjpkZWZhdWx0VmFs
dWUoRXhlY1N0YXRlIAogICAgICAgfQogICAgIH0KICAgfQotCisgIAorICBpZihleGVjLT5oYWRF
eGNlcHRpb24oKSl7CisgICAgICByZXR1cm4gZXhlYy0+ZXhjZXB0aW9uKCk7CisgIH0KKyAgCisg
ICAgICAKICAgT2JqZWN0IGVyciA9IEVycm9yOjpjcmVhdGUoZXhlYywgVHlwZUVycm9yLCBJMThO
X05PT1AoIk5vIGRlZmF1bHQgdmFsdWUiKSk7CiAgIGV4ZWMtPnNldEV4Y2VwdGlvbihlcnIpOwog
ICByZXR1cm4gZXJyOwo=
</data>
<flag name="review"
          id="122"
          type_id="1"
          status="-"
          setter="darin"
    />
          </attachment>
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>2649</attachid>
            <date>2005-06-25 23:21:38 -0700</date>
            <delta_ts>2005-10-29 21:52:39 -0700</delta_ts>
            <desc>Patch to match behaviour of firefox and IE</desc>
            <filename>bug3539patch2</filename>
            <type>text/plain</type>
            <size>2418</size>
            <attacher name="Oliver Hunt">oliver</attacher>
            
              <data encoding="base64">SW5kZXg6IC4vSmF2YVNjcmlwdENvcmUva2pzL2FycmF5X29iamVjdC5jcHAKPT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQpS
Q1MgZmlsZTogL2N2cy9yb290L0phdmFTY3JpcHRDb3JlL2tqcy9hcnJheV9vYmplY3QuY3BwLHYK
cmV0cmlldmluZyByZXZpc2lvbiAxLjQxCmRpZmYgLXAgLXUgLXIxLjQxIC4vSmF2YVNjcmlwdENv
cmUva2pzL2FycmF5X29iamVjdC5jcHAKLS0tIC4vSmF2YVNjcmlwd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yYXkKKyAgICAgIHZpc2l0ZWRSZWZzW2pvaW5EZXB0aCsrXT1jdXJyZW50UmVmOworICAg
ICAgaWYgKGFyZ3NbMF0udHlwZSgpICE9IFVuZGVmaW5lZFR5cGUpCisgICAgICAgIHNlcGFyYXRv
ciA9IGFyZ3NbMF0udG9TdHJpbmcoZXhlYyk7CisgICAgICBmb3IgKHVuc2lnbmVkIGludCBrID0g
MDsgayA8IGxlbmd0aDsgaysrKSB7CisgICAgICAgIGlmIChrID49IDEpCisgICAgICAgICAgc3Ry
ICs9IHNlcGFyYXRvcjsKKyAgICAgICAgVmFsdWUgZWxlbWVudCA9IHRoaXNPYmouZ2V0KGV4ZWMs
ayk7CisgICAgICAgIGlmIChlbGVtZW50LnR5cGUoKSAhPSBVbmRlZmluZWRUeXBlICYmIGVsZW1l
bnQudHlwZSgpICE9IE51bGxUeXBlKQorICAgICAgICAgIHN0ciArPSBlbGVtZW50LnRvU3RyaW5n
KGV4ZWMpOworICAgICAgICBpZiAoIGV4ZWMtPmhhZEV4Y2VwdGlvbigpICkKKyAgICAgICAgICBi
cmVhazsKKyAgICAgIH0KKyAgICAgIGpvaW5EZXB0aC0tOwogICAgIH0KICAgICByZXN1bHQgPSBT
dHJpbmcoc3RyKTsKICAgICBicmVhazsK
</data>
<flag name="review"
          id="123"
          type_id="1"
          status="-"
          setter="darin"
    />
          </attachment>
          <attachment
              isobsolete="1"
              ispatch="0"
              isprivate="0"
          >
            <attachid>2651</attachid>
            <date>2005-06-26 00:19:43 -0700</date>
            <delta_ts>2005-06-27 19:01:01 -0700</delta_ts>
            <desc>edge case test for patch</desc>
            <filename>Testcase for bg 3537.html</filename>
            <type>text/html</type>
            <size>295</size>
            <attacher name="Oliver Hunt">oliver</attacher>
            
              <data encoding="base64">PGh0bWw+CjxoZWFkPgoJPHRpdGxlPlRlc3RjYXNlIGZvciBKUyBiYWRuZXNzPC90aXRsZT4KPC9o
ZWFkPgoKPGJvZHk+CjxzY3JpcHQgdHlwZT0idGV4dC9qYXZhc2NyaXB0Ij4KICB2YXIgZWxlbT1b
XTsKICBmb3IodmFyIGk9MDsgaTwxMDAwOyBpKyspCiAgewogICAgZWxlbS5wdXNoKFtpXSk7CiAg
fQogIGZvcih2YXIgaT0wOyBpPDEwMDA7IGkrKykKICB7CiAgICBlbGVtW2ldLnB1c2goZWxlbVso
aSsxKSUxMDAwXSk7CiAgfQogIGRvY3VtZW50LndyaXRlKGVsZW0pOwo8L3NjcmlwdD4KPC9ib2R5
Pgo8L2h0bWw+Cg==
</data>

          </attachment>
          <attachment
              isobsolete="1"
              ispatch="0"
              isprivate="0"
          >
            <attachid>2652</attachid>
            <date>2005-06-26 01:12:40 -0700</date>
            <delta_ts>2005-06-27 19:02:19 -0700</delta_ts>
            <desc>Another edge case, slightly less ugly than previous</desc>
            <filename>Testcase for bg 3537.html</filename>
            <type>text/html</type>
            <size>243</size>
            <attacher name="Oliver Hunt">oliver</attacher>
            
              <data encoding="base64">PGh0bWw+CjxoZWFkPgoJPHRpdGxlPlRlc3RjYXNlIGZvciBKUyBiYWRuZXNzPC90aXRsZT4KPC9o
ZWFkPgoKPGJvZHk+CjxzY3JpcHQgdHlwZT0idGV4dC9qYXZhc2NyaXB0Ij4KICB2YXIgZWxlbT1b
MF07CiAgZm9yKHZhciBpPTE7IGk8PTEwMDAwOyBpKyspCiAgewogICAgdmFyIGFyeT1bZWxlbSwg
aV07CiAgICBlbGVtPWFyeTsKICB9CiAgZG9jdW1lbnQud3JpdGUoZWxlbSk7Cjwvc2NyaXB0Pgo8
L2JvZHk+CjwvaHRtbD4K
</data>

          </attachment>
          <attachment
              isobsolete="1"
              ispatch="0"
              isprivate="0"
          >
            <attachid>2665</attachid>
            <date>2005-06-27 04:54:20 -0700</date>
            <delta_ts>2005-11-29 17:49:30 -0800</delta_ts>
            <desc>test case for cyclic references in array.toString</desc>
            <filename>cyclic-references.html</filename>
            <type>text/html</type>
            <size>952</size>
            <attacher name="Oliver Hunt">oliver</attacher>
            
              <data enco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0cj4KCQkJCTx0ZCBpZD0icjBj
MCI+Jm5ic3A7PC90ZD4KCQkJPC90cj4KCQkJPHRyPgoJCQkJPHRkIGlkPSJyMWMwIj4mbmJzcDs8
L3RkPgoJCQk8L3RyPgoJCQk8dHI+CgkJCQk8dGQgaWQ9InIyYzAiPiZuYnNwOzwvdGQ+CgkJCTwv
dHI+CgkJPC90Ym9keT4KCTwvdGFibGU+CjwvYm9keT4KPC9odG1sPg==
</data>

          </attachment>
          <attachment
              isobsolete="1"
              ispatch="0"
              isprivate="0"
          >
            <attachid>2666</attachid>
            <date>2005-06-27 04:56:11 -0700</date>
            <delta_ts>2005-11-29 17:49:30 -0800</delta_ts>
            <desc>expected results of cyclic reference testcase</desc>
            <filename>cyclic-references-expected.txt</filename>
            <type>text/plain</type>
            <size>80</size>
            <attacher name="Oliver Hunt">oliver</attacher>
            
              <data encoding="base64">VGhpcyB3aWxsIHRlc3QgQXJyYXkudG9TdHJpbmcgd2l0aCBjeWNsaWMgcmVmZXJlbmNlcy4KMSwy
LAoxLDIsMyw0LAoxLDIsMyw0LCw1Cgo=
</data>

          </attachment>
          <attachment
              isobsolete="1"
              ispatch="0"
              isprivate="0"
          >
            <attachid>2669</attachid>
            <date>2005-06-27 05:30:22 -0700</date>
            <delta_ts>2005-06-27 19:04:22 -0700</delta_ts>
            <desc>testcase for tostring with non-cyclic, but deep hierarchies</desc>
            <filename>tostring-deep-hierarchy.html</filename>
            <type>text/html</type>
            <size>925</size>
            <attacher name="Oliver Hunt">oliver</attacher>
            
              <data encoding="base64">PCFET0NUWVBFIEhUTUwgUFVCTElDICItLy9XM0MvL0RURCBIVE1MIDQuMDEvL0VOIiAiaHR0cDov
L3d3dy53My5vcmcvVFIvaHRtbDQvc3RyaWN0LmR0ZCI+CjxodG1sPgo8aGVhZD4KPHRpdGxlPlRl
c3RpbmcgZGVlcCBoaWVyYXJjaGllcyB3aXRoIEFycmF5LnRvU3RyaW5nPC90aXRsZT4KPHNjcmlw
dCBsYW5ndWFnZT0iamF2YXNjcmlwdCI+CmZ1bmN0aW9uIGluaXQoKXsKICB2YXIgYXJ5MT1bMF07
CiAgZm9yKHZhciBpPTE7IGk8MTA7IGkrKykKICAgIGFyeTE9W2FyeTEsIGldCiAgZG9jdW1lbnQu
Z2V0RWxlbWVudEJ5SWQoInIwYzAiKS5maXJzdENoaWxkLm5vZGVWYWx1ZSA9IGFyeTE7CiAgCiAg
dmFyIGFyeTI9WzBdOwogIGZvcih2YXIgaT0xOyBpPDEwMDAwOyBpKyspCiAgICBhcnkyPVthcnky
LCBpXTsKICAgIAogIHZhciBvdXQ7CiAgdHJ5ewogICAgb3V0PWFyeTIudG9TdHJpbmcoKTsKICB9
Y2F0Y2goZSl7CiAgICBvdXQ9ZTsKICB9CiAgZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoInIxYzAi
KS5maXJzdENoaWxkLm5vZGVWYWx1ZSA9IG91dDsKICBpZiAod2luZG93LmxheW91dFRlc3RDb250
cm9sbGVyKSB7CiAgICB3aW5kb3cubGF5b3V0VGVzdENvbnRyb2xsZXIuZHVtcEFzVGV4dCgpOwog
IH0KfQo8L3NjcmlwdD4KPC9oZWFkPgo8Ym9keSBvbmxvYWQ9ImluaXQoKSI+CiAgICBUaGlzIHdp
bGwgdGVzdCBBcnJheS50b1N0cmluZyB3aXRoIGRlZXAgaGllcmFyY2hpZXMuCiAgICA8dGFibGUg
Y2VsbHBhZGRpbmc9IjIiIGNlbGxzcGFjaW5nPSIyIiBib3JkZXI9IjEiPgoJCTx0Ym9keT4KCQkJ
PHRyPgoJCQkJPHRkIGlkPSJyMGMwIj4mbmJzcDs8L3RkPgoJCQk8L3RyPgoJCQk8dHI+CgkJCQk8
dGQgaWQ9InIxYzAiPiZuYnNwOzwvdGQ+CgkJCTwvdHI+CgkJPC90Ym9keT4KCTwvdGFibGU+Cjwv
Ym9keT4KPC9odG1sPg==
</data>

          </attachment>
          <attachment
              isobsolete="1"
              ispatch="0"
              isprivate="0"
          >
            <attachid>2670</attachid>
            <date>2005-06-27 05:31:38 -0700</date>
            <delta_ts>2005-06-27 18:41:33 -0700</delta_ts>
            <desc>expected output from the deep hierarchies test</desc>
            <filename>tostring-deep-hierarchy-expected.txt</filename>
            <type>text/plain</type>
            <size>121</size>
            <attacher name="Oliver Hunt">oliver</attacher>
            
              <data encoding="base64">VGhpcyB3aWxsIHRlc3QgQXJyYXkudG9TdHJpbmcgd2l0aCBkZWVwIGhpZXJhcmNoaWVzLgowLDEs
MiwzLDQsNSw2LDcsOCw5ClJhbmdlRXJyb3IgLSBNYXhpbXVtIGNhbGwgc3RhY2sgc2l6ZSBleGNl
ZWRlZC4KCg==
</data>

          </attachment>
          <attachment
              isobsolete="1"
              ispatch="0"
              isprivate="0"
          >
            <attachid>2676</attachid>
            <date>2005-06-27 15:45:45 -0700</date>
            <delta_ts>2005-11-29 17:49:30 -0800</delta_ts>
            <desc>sort() Test Case</desc>
            <filename>try.html</filename>
            <type>text/html</type>
            <size>286</size>
            <attacher name="David Wheeler">david</attacher>
            
              <data encoding="base64">PGh0bWw+CjxoZWFkPgoJPHRpdGxlPlRlc3RjYXNlIGZvciBiZyAzNTM3IChzb3J0KCkpPC90aXRs
ZT4KPC9oZWFkPgoKPGJvZHk+CjxzY3JpcHQgdHlwZT0idGV4dC9qYXZhc2NyaXB0Ij4KICB2YXIg
YXJ5ID0gWzEsIDJdOwogIGFyeS5wdXNoKGFyeSk7CiAgYXJ5LnNvcnQoKTsgLy8gQ29tbWVudCBv
dXQgdGhpcyBsaW5lIHRvIGdldCB3b3JraW5nIGFnYWluLgogIGRvY3VtZW50LndyaXRlKCJ0aGlz
IHNob3VsZCBiZSBvdXRwdXQsIGJ1dCBpc24ndCIpOwo8L3NjcmlwdD4KPC9ib2R5Pgo8L2h0bWw+
Cg==
</data>

          </attachment>
          <attachment
              isobsolete="1"
              ispatch="0"
              isprivate="0"
          >
            <attachid>2683</attachid>
            <date>2005-06-28 03:51:04 -0700</date>
            <delta_ts>2005-11-29 17:49:30 -0800</delta_ts>
            <desc>Quick test for join and toString operating concurrently</desc>
            <filename>jsjointest.html</filename>
            <type>text/html</type>
            <size>414</size>
            <attacher name="Oliver Hunt">oliver</attacher>
            
              <data encoding="base64">PGh0bWw+CjxoZWFkPgoJPHRpdGxlPlRlc3RjYXNlIGZvciBiZyAzNTM5PC90aXRsZT4KPC9oZWFk
PgoKPGJvZHk+CjxzY3JpcHQgdHlwZT0idGV4dC9qYXZhc2NyaXB0Ij4KICBmdW5jdGlvbiBBcnlS
ZWYoYXJ5LCBpKXsKICAgIHRoaXMuYXJ5PVtpLCBhcnksIGldOwogICAgdGhpcy50b1N0cmluZz10
ZXN0VG9TdHJpbmc7CiAgfQogIGZ1bmN0aW9uIHRlc3RUb1N0cmluZygpewogICAgcmV0dXJuICIo
Iit0aGlzLmFyeS5qb2luKCJ8IikrIikiOwogIH0KICB2YXIgYXJ5PVtdOwogIHZhciBhPW5ldyBB
cnlSZWYoYXJ5KTsKICBhcnkucHVzaChhKTsKICBmb3IodmFyIGk9MTsgaTwxMDsgaSsrKXsKICAg
IGE9bmV3IEFyeVJlZihhLCBpKTsKICB9CiAgZG9jdW1lbnQud3JpdGUoYSk7Cjwvc2NyaXB0Pgo8
L2JvZHk+CjwvaHRtbD4K
</data>

          </attachment>
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>4532</attachid>
            <date>2005-10-29 21:52:39 -0700</date>
            <delta_ts>2005-11-29 17:07:36 -0800</delta_ts>
            <desc>Reimplemented patch with HashSet</desc>
            <filename>selfreference.patch</filename>
            <type>text/plain</type>
            <size>3740</size>
            <attacher name="Oliver Hunt">oliver</attacher>
            
              <data encoding="base64">SW5kZXg6IGtqcy9hcnJheV9vYmplY3QuY3BwCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KUkNTIGZpbGU6IC9jdnMvcm9v
dC9KYXZhU2NyaXB0Q29yZS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250YWlucyhjdXJyZW50UmVmKSkg
eyAgICAKKyAgICAgIHZpc2l0ZWRFbGVtcy5pbnNlcnQoY3VycmVudFJlZik7CisgICAgICBpZiAo
IWFyZ3NbMF0tPmlzVW5kZWZpbmVkKCkpCisgICAgICAgIHNlcGFyYXRvciA9IGFyZ3NbMF0tPnRv
U3RyaW5nKGV4ZWMpOworICAgICAgZm9yICh1bnNpZ25lZCBpbnQgayA9IDA7IGsgPCBsZW5ndGg7
IGsrKykgeworICAgICAgICBpZiAoayA+PSAxKQorICAgICAgICAgIHN0ciArPSBzZXBhcmF0b3I7
CisgICAgICAgCisgICAgICAgIFZhbHVlSW1wICplbGVtZW50ID0gdGhpc09iai0+Z2V0KGV4ZWMs
IGspOworICAgICAgICBpZiAoZWxlbWVudC0+aXNVbmRlZmluZWRPck51bGwoKSkKKyAgICAgICAg
ICBjb250aW51ZTsKKworICAgICAgICBib29sIGZhbGxiYWNrID0gZmFsc2U7CisgICAgICAgIGlm
IChpZCA9PSBUb0xvY2FsZVN0cmluZykgeworICAgICAgICAgIE9iamVjdEltcCAqbyA9IGVsZW1l
bnQtPnRvT2JqZWN0KGV4ZWMpOworICAgICAgICAgIFZhbHVlSW1wICpjb252ZXJzaW9uRnVuY3Rp
b24gPSBvLT5nZXQoZXhlYywgdG9Mb2NhbGVTdHJpbmdQcm9wZXJ0eU5hbWUpOwogICAgICAgICAg
IGlmIChjb252ZXJzaW9uRnVuY3Rpb24tPmlzT2JqZWN0KCkgJiYgc3RhdGljX2Nhc3Q8T2JqZWN0
SW1wICo+KGNvbnZlcnNpb25GdW5jdGlvbiktPmltcGxlbWVudHNDYWxsKCkpIHsKICAgICAgICAg
ICAgIHN0ciArPSBzdGF0aWNfY2FzdDxPYmplY3RJbXAgKj4oY29udmVyc2lvbkZ1bmN0aW9uKS0+
Y2FsbChleGVjLCBvLCBMaXN0KCkpLT50b1N0cmluZyhleGVjKTsKICAgICAgICAgICB9IGVsc2Ug
ewotICAgICAgICAgICAgcmV0d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ywgUmFuZ2VF
cnJvciwgIkNhbid0IGNvbnZlcnQgIiArIG8tPmNsYXNzTmFtZSgpICsgIiBvYmplY3QgdG8gc3Ry
aW5nIik7CisgICAgICAgICAgICB9CisgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIHN0
ciArPSBlbGVtZW50LT50b1N0cmluZyhleGVjKTsKKyAgICAgICAgICB9CisgICAgICAgIH0KKwor
ICAgICAgICBpZiAoIGV4ZWMtPmhhZEV4Y2VwdGlvbigpICkKKyAgICAgICAgICBicmVhazsKKyAg
ICAgIH0KKyAgICAgIHZpc2l0ZWRFbGVtcy5yZW1vdmUoY3VycmVudFJlZik7CiAgICAgfQogICAg
IHJlc3VsdCA9IFN0cmluZyhzdHIpOwogICAgIGJyZWFrOwo=
</data>
<flag name="review"
          id="831"
          type_id="1"
          status="-"
          setter="darin"
    />
          </attachment>
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>4860</attachid>
            <date>2005-11-29 17:07:36 -0800</date>
            <delta_ts>2005-11-29 17:23:37 -0800</delta_ts>
            <desc>Hopefully the final patch</desc>
            <filename>circrefs.patch</filename>
            <type>text/plain</type>
            <size>1095</size>
            <attacher name="Oliver Hunt">oliver</attacher>
            
              <data encoding="base64">SW5kZXg6IGtqcy9hcnJheV9vYmplY3QuY3BwCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KUkNTIGZpbGU6IC9jdnMvcm9v
dC9KYXZhU2NyaXB0Q29yZS9ranMvYXJyYXlfb2JqZWN0LmNwcCx2CnJldHJpZXZpbmcgcmV2aXNp
b24gMS41NApkaWZmIC1wIC11IC1yMS41NCBranMvYXJyYXlfb2JqZWN0LmNwcAotLS0ga2pzL2Fy
cmF5X29iamVjdC5jcHAJMTYgT2N0IDIwMDUgMDA6NDY6MjEgLTAwMDAJMS41NAorKysga2pzL2Fy
cmF5X29iamVjdC5jcHAJMzAgTm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>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>4861</attachid>
            <date>2005-11-29 17:25:37 -0800</date>
            <delta_ts>2005-11-30 23:45:57 -0800</delta_ts>
            <desc>Fixed HashMap to be typesafe</desc>
            <filename>circrefs.patch</filename>
            <type>text/plain</type>
            <size>1128</size>
            <attacher name="Oliver Hunt">oliver</attacher>
            
              <data encoding="base64">SW5kZXg6IGtqcy9hcnJheV9vYmplY3QuY3BwCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KUkNTIGZpbGU6IC9jdnMvcm9v
dC9KYXZhU2NyaXB0Q29yZS9ranMvYXJyYXlfb2JqZWN0LmNwcCx2CnJldHJpZXZpbmcgcmV2aXNp
b24gMS41NApkaWZmIC1wIC11IC1yMS41NCBranMvYXJyYXlfb2JqZWN0LmNwcAotLS0ga2pzL2Fy
cmF5X29iamVjdC5jcHAJMTYgT2N0IDIwMDUgMDA6NDY6MjEgLTAwMDAJMS41NAorKysga2pzL2Fy
cmF5X29iamVjdC5jcHAJMzAgTm92IDIwMDUgMDE6Mjk6MzEgLTAwMDAKQEAgLTMxLDYgKzMxLDcg
QEAKICNpbmNsdWRlICJyZWZlcmVuY2VfbGlzdC5oIgogI2luY2x1ZGUgInR5cGVzLmgiCiAjaW5j
bHVkZSAidmFsdWUuaCIKKyNpbmNsdWRlICJIYXNoU2V0LmgiCiAKICNpbmNsdWRlICJhcnJheV9v
YmplY3QubHV0LmgiCiAKQEAgLTQ0Niw5ICs0NDcsMTMgQEAgVmFsdWVJbXAgKkFycmF5UHJvdG9G
dW5jSW1wOjpjYWxsQXNGdW5jdAogCiAgICAgLy8gZmFsbCB0aHJvdWdoCiAgIGNhc2UgSm9pbjog
eworICAgIHN0YXRpYyBIYXNoU2V0PE9iamVjdEltcCAqLCBQb2ludGVySGFzaDxPYmplY3RJbXAg
Kj4gPiB2aXNpdGVkRWxlbXM7CisgICAgaWYgKHZpc2l0ZWRFbGVtcy5jb250YWlucyh0aGlzT2Jq
KSkKKyAgICAgIHJldHVybiBTdHJpbmcoIiIpOwogICAgIFVTdHJpbmcgc2VwYXJhdG9yID0gIiwi
OwogICAgIFVTdHJpbmcgc3RyID0gIiI7CiAKKyAgICB2aXNpdGVkRWxlbXMuaW5zZXJ0KHRoaXNP
YmopOwogICAgIGlmICghYXJnc1swXS0+aXNVbmRlZmluZWQoKSkKICAgICAgIHNlcGFyYXRvciA9
IGFyZ3NbMF0tPnRvU3RyaW5nKGV4ZWMpOwogICAgIGZvciAodW5zaWduZWQgaW50IGsgPSAwOyBr
IDwgbGVuZ3RoOyBrKyspIHsKQEAgLTQ4OCw2ICs0OTMsNyBAQCBWYWx1ZUltcCAqQXJyYXlQcm90
b0Z1bmNJbXA6OmNhbGxBc0Z1bmN0CiAgICAgICBpZiAoIGV4ZWMtPmhhZEV4Y2VwdGlvbigpICkK
ICAgICAgICAgYnJlYWs7CiAgICAgfQorICAgIHZpc2l0ZWRFbGVtcy5yZW1vdmUodGhpc09iaik7
CiAgICAgcmVzdWx0ID0gU3RyaW5nKHN0cik7CiAgICAgYnJlYWs7CiAgIH0K
</data>
<flag name="review"
          id="919"
          type_id="1"
          status="+"
          setter="mjs"
    />
          </attachment>
          <attachment
              isobsolete="1"
              ispatch="0"
              isprivate="0"
          >
            <attachid>4862</attachid>
            <date>2005-11-29 17:49:30 -0800</date>
            <delta_ts>2005-11-29 18:28:38 -0800</delta_ts>
            <desc>Testcase for toString on arrays with self references</desc>
            <filename>cyclicreftest.html</filename>
            <type>text/html</type>
            <size>1523</size>
            <attacher name="Oliver Hunt">oliver</attacher>
            
              <data encoding="base64">PCFET0NUWVBFIEhUTUwgUFVCTElDICItLy9XM0MvL0RURCBIVE1MIDQuMDEvL0VOIiAiaHR0cDov
L3d3dy53My5vcmcvVFIvaHRtbDQvc3RyaWN0LmR0ZCI+CjxodG1sPgo8aGVhZD4KPHRpdGxlPnRl
c3QgY3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SBzZWxmIHJlZmVy
ZW5jZSBpcyBhdCB0aGUgZW5kIG9mIHRoZSBhcnJheSkgb3IgJywsJyAKICAgIGlmIHRoZSBzZWxm
IHJlZmVyZW5jZSBpcyBjb250YWluZWQgYXQgc29tZSBtaWQgcG9pbnQgaW4gdGhlIGFycmF5Lgog
ICAgPHRhYmxlIGNlbGxwYWRkaW5nPSIyIiBjZWxsc3BhY2luZz0iMiIgYm9yZGVyPSIxIj4KCQk8
dGJvZHk+CgkJCTx0cj4KCQkJCTx0ZD5BcnJheSBDb250ZW50czwvdGQ+PHRkPkV4cGVjdGVkIE91
dHB1dDwvdGQ+PHRkPkFjdHVhbCBPdXRwdXQ8L3RkPgoJCQk8L3RyPgoJCQk8dHI+CgkJCQk8dGQ+
WzEsIDIsIHNlbGZdPC90ZD48dGQgaWQ9InIwYzAiPjEsMiw8L3RkPjx0ZCBpZD0icjBjMSI+Jm5i
c3A7PC90ZD4KCQkJPC90cj4KCQkJPHRyPgoJCQkJPHRkPlsxLCAyLCBbMywgNCwgcGFyZW50XV08
L3RkPjx0ZCBpZD0icjFjMCI+MSwyLDMsNCw8L3RkPjx0ZCBpZD0icjFjMSI+Jm5ic3A7PC90ZD4K
CQkJPC90cj4KCQkJPHRyPgoJCQkJPHRkPlsxLCAyLCBbMywgNCwgcGFyZW50XSwgNV08L3RkPjx0
ZCBpZD0icjJjMCI+MSwyLDMsNCwsNTwvdGQ+PHRkIGlkPSJyMmMxIj4mbmJzcDs8L3RkPgoJCQk8
L3RyPgoJCTwvdGJvZHk+Cgk8L3RhYmxlPgo8L2JvZHk+CjwvaHRtbD4=
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>4863</attachid>
            <date>2005-11-29 18:28:38 -0800</date>
            <delta_ts>2005-11-29 18:28:38 -0800</delta_ts>
            <desc>Testcase, though it needs a better name</desc>
            <filename>cyclicreftest.html</filename>
            <type>text/html</type>
            <size>1538</size>
            <attacher name="Oliver Hun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solete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>4864</attachid>
            <date>2005-11-29 18:29:29 -0800</date>
            <delta_ts>2005-11-29 18:29:29 -0800</delta_ts>
            <desc>Expected output from testcase</desc>
            <filename>cyclicreftest-expected.txt</filename>
            <type>text/plain</type>
            <size>512</size>
            <attacher name="Oliver Hunt">oliver</attacher>
            
              <data encoding="base64">VGhpcyB3aWxsIHRlc3QgQXJyYXkudG9TdHJpbmcgd2l0aCBjaXJjdWxhciByZWZlcmVuY2VzLiBJ
ZiBhbiBlbGVtZW50IGNvbnRhaW5zIGEgcmVmZXJlbmNlIHRvIGl0c2VsZiBvciBvbmUgb2YgaXRz
IGNoaWxkcmVuIChhdCBhbnkgZGVwdGgpIGNvbnRhaW5zIGEgcmVmZXJlbmNlIHRvIGl0LCBpdCB3
aWxsIGJlIHNraXBwZWQuIFRoaXMgY2FuIHJlc3VsdCBpbiBlaXRoZXIgYSB0cmFpbGluZyAnLCcg
KGlmIHRoZSBzZWxmIHJlZmVyZW5jZSBpcyBhdCB0aGUgZW5kIG9mIHRoZSBhcnJheSkgb3IgJyws
JyBpZiB0aGUgc2VsZiByZWZlcmVuY2UgaXMgY29udGFpbmVkIGF0IHNvbWUgbWlkIHBvaW50IGlu
IHRoZSBhcnJheS4KQXJyYXkgQ29udGVudHMJRXhwZWN0ZWQgT3V0cHV0CUFjdHVhbCBPdXRwdXQK
WzEsIDIsIHNlbGZdCTEsMiwJMSwyLApbMSwgMiwgWzMsIDQsIHBhcmVudF1dCTEsMiwzLDQsCTEs
MiwzLDQsClsxLCAyLCBbMywgNCwgcGFyZW50XSwgNV0JMSwyLDMsNCwsNQkxLDIsMyw0LCw1Cgo=
</data>

          </attachment>
      

    </bug>

</bugzilla>