| <!-- |
| This file is used as a control test to compare with the other Chrome Endure |
| tests in perf_endure.py. |
| |
| This file creates a large DOM tree in the live document that also contains |
| event listeners. It then detaches the tree at the root. Since no JS |
| reference is kept, the tree should be collected by v8 at some point in the |
| future. As a result, if graphing DOM node and event listener count over time, |
| we expect to see a "sawtooth" pattern that does not show any overall tendency |
| to increase. |
| --> |
| |
| <html> |
| <head> |
| <script type='text/javascript'> |
| function start_tests() { |
| run_detached_dom_test(); |
| } |
| |
| function run_detached_dom_test() { |
| var last_node = document.createElement('div'); |
| var root_node = last_node; |
| for (i=0; i<1000; i++) { |
| var node = document.createElement('div'); |
| node.innerHTML = 'Node ' + i; |
| node.addEventListener('mousemove', mouse_move_callback, true); |
| last_node.appendChild(node); |
| last_node = node; |
| } |
| document.body.appendChild(root_node); |
| setTimeout('run_detached_dom_test2()', 500); |
| } |
| |
| function run_detached_dom_test2() { |
| // Detach the dom tree that was just created (at child index 1). |
| document.body.removeChild(document.body.childNodes[1]); |
| setTimeout('run_detached_dom_test()', 500) |
| } |
| |
| function mouse_move_callback(event) { |
| // Stub. |
| } |
| </script> |
| <title>Chrome Endure Control Test</title> |
| </head> |
| <body onload='start_tests()'> |
| </body> |
| </html> |