3 <title>GC test
10</title>
5 function print(message
, color
)
7 var paragraph
= document
.createElement("div");
8 paragraph
.appendChild(document
.createTextNode(message
));
9 paragraph
.style
.fontFamily
= "monospace";
11 paragraph
.style
.color
= color
;
12 document
.getElementById("console").appendChild(paragraph
);
20 if (window
.GCController
)
22 GCController
.collect();
23 before
= GCController
.getJSObjectCount();
25 window
.frames
.myframe
.location
.reload(true);
27 GCController
.collect();
28 after
= GCController
.getJSObjectCount();
30 // Unfortunately we cannot do a strict check here because there is still very minor (3) JS object increase,
31 // likely due to temporary JS objects being created during further execution of this test function.
32 // However, the iframe document leaking everything has an addition of ~25 objects every
33 // refresh, so it still is an accurate test.
34 if (after
> (before
+ threshold
))
36 print("FAIL: " + before
+ " objects before refresh, " + after
+ " objects after refresh.", "red");
40 print("PASS: Refresh did not leak JS objects.", "green");
45 print("WARNING: Test cannot run if GCController does not exist. Thus it only runs from the test interface.", "red");
52 <body style=
"color: black" onload=
"test()">
53 <p>This page tests to make sure that the refresh of a page which holds a document reference in its DOM wrapper tree
54 does not leak all of its associated JS objects.
</p>
55 <p>If the test passes, you'll see a single 'PASS' message below.
</p>
58 <div id='console'
></div>
60 <iframe name=
"myframe" id=
"myframe" src=
"resources/gc-10-frame.html">