Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / dom / gc-7.html
blobc777d76ee1632e7d9350974177fa47022c93c4b5
1 <head>
2 <script>
4 function frameLoaded()
6 // create lots of objects to force a garbage collection
7 var i = 0;
8 var s;
9 while (i < 5000) {
10 i = i+1.11;
11 s = s + " ";
14 var output= document.getElementById("output");
16 output.innerHTML += spanB.customProperty + "<BR>";
17 output.innerHTML += spanB + "<BR>";
18 output.innerHTML += spanB.parentNode + "<BR>";
19 output.innerHTML += spanB.ownerDocument + "<BR>";
21 if (window.testRunner)
22 testRunner.notifyDone();
25 function doit()
27 var frame = document.getElementById("frame");
28 frameDoc = frame.contentDocument;
29 spanB = frame.contentDocument.getElementById("span-B");
30 spanB.customProperty = "B";
31 frame.onload = frameLoaded;
32 frame.src = 'about:blank'
35 if (window.testRunner) {
36 testRunner.waitUntilDone();
37 testRunner.dumpAsText();
40 </script>
41 </head>
43 <body onload="doit()">
44 <div style="border: 1px solid red">
45 <p>
46 This test verifies that objects are protected against garbage
47 collection as long as the document is alive (for contrast with test
48 6).
49 </p>
50 <p>
51 The output should be the following pieces of text on lines by
52 themselves: "B", "[object HTMLElement]", "[object HTMLElement]", "[object HTMLDocument]".
53 </p>
54 </div>
56 <div id="output">
57 </div>
59 <iframe id="frame" src='data:text/html,<div id="div"><span id="span-A"><span id="span-B"><span id="span-C">original span</span></span></span></div>'>
60 </body>