1 <!-- 2 This file is used as a control test to compare with the other Chrome Endure 3 tests in perf_endure.py. 4 5 This file creates a large DOM tree in the live document that also contains 6 event listeners. It then detaches the tree at the root. Since no JS 7 reference is kept, the tree should be collected by v8 at some point in the 8 future. As a result, if graphing DOM node and event listener count over time, 9 we expect to see a "sawtooth" pattern that does not show any overall tendency 10 to increase. 11 --> 12 13 <html> 14 <head> 15 <script type='text/javascript'> 16 function start_tests() { 17 run_detached_dom_test(); 18 } 19 20 function run_detached_dom_test() { 21 var last_node = document.createElement('div'); 22 var root_node = last_node; 23 for (i=0; i<1000; i++) { 24 var node = document.createElement('div'); 25 node.innerHTML = 'Node ' + i; 26 node.addEventListener('mousemove', mouse_move_callback, true); 27 last_node.appendChild(node); 28 last_node = node; 29 } 30 document.body.appendChild(root_node); 31 setTimeout('run_detached_dom_test2()', 500); 32 } 33 34 function run_detached_dom_test2() { 35 // Detach the dom tree that was just created (at child index 1). 36 document.body.removeChild(document.body.childNodes[1]); 37 setTimeout('run_detached_dom_test()', 500) 38 } 39 40 function mouse_move_callback(event) { 41 // Stub. 42 } 43 </script> 44 <title>Chrome Endure Control Test</title> 45 </head> 46 <body onload='start_tests()'> 47 </body> 48 </html>