| OLD | NEW |
| (Empty) |
| 1 <html> | |
| 2 <head> | |
| 3 <title>GC test 10</title> | |
| 4 <script> | |
| 5 function print(message, color) | |
| 6 { | |
| 7 var paragraph = document.createElement("div"); | |
| 8 paragraph.appendChild(document.createTextNode(message)); | |
| 9 paragraph.style.fontFamily = "monospace"; | |
| 10 if (color) | |
| 11 paragraph.style.color = color; | |
| 12 document.getElementById("console").appendChild(paragraph); | |
| 13 } | |
| 14 | |
| 15 var threshold = 5; | |
| 16 | |
| 17 function test() | |
| 18 { | |
| 19 if (window.GCController) | |
| 20 { | |
| 21 global = window.frames.myframe.location.reload; // Eagerly construct the
se properties so they don't influence test outcome. | |
| 22 | |
| 23 GCController.collect(); | |
| 24 var before = GCController.getJSObjectCount(); | |
| 25 | |
| 26 window.frames.myframe.location.reload(true); | |
| 27 window.frames.myframe.location.reload(true); | |
| 28 window.frames.myframe.location.reload(true); | |
| 29 | |
| 30 GCController.collect(); | |
| 31 var after = GCController.getJSObjectCount(); | |
| 32 | |
| 33 // Unfortunately we cannot do a strict check here because there is still
very minor (3) JS object increase, | |
| 34 // likely due to temporary JS objects being created during further execu
tion of this test function. | |
| 35 // However, the iframe document leaking everything has an addition of ~2
5 objects every | |
| 36 // refresh, so it still is an accurate test. | |
| 37 if (after > (before + threshold)) | |
| 38 { | |
| 39 print("FAIL: " + before + " objects before refresh, " + after + " ob
jects after refresh.", "red"); | |
| 40 } | |
| 41 else | |
| 42 { | |
| 43 print("PASS: Refresh did not leak JS objects.", "green"); | |
| 44 } | |
| 45 } | |
| 46 else | |
| 47 { | |
| 48 print("WARNING: Test cannot run if GCController does not exist. Thus it
only runs from the test interface.", "red"); | |
| 49 } | |
| 50 } | |
| 51 | |
| 52 </script> | |
| 53 </head> | |
| 54 | |
| 55 <body style="color: black" onload="test()"> | |
| 56 <p>This page tests to make sure that the refresh of a page which holds a documen
t reference in its DOM wrapper tree | |
| 57 does not leak all of its associated JS objects.</p> | |
| 58 <p>If the test passes, you'll see a single 'PASS' message below.</p> | |
| 59 <hr> | |
| 60 | |
| 61 <div id='console'></div> | |
| 62 | |
| 63 <iframe name="myframe" id="myframe" src="resources/gc-10-frame.html"> | |
| 64 </body> | |
| 65 </html> | |
| OLD | NEW |