| OLD | NEW |
| (Empty) |
| 1 <script> | |
| 2 // The test works by first navigating iframe to a page that allocates a lot of J
S objects | |
| 3 // and then creates a long timeout. Then iframe is navigated to about:blank and
the number of JS | |
| 4 // objects is verified - there should be a significant drop in their number. | |
| 5 | |
| 6 var objectCountBefore; | |
| 7 function start() { | |
| 8 if (window.testRunner && window.GCController) { | |
| 9 testRunner.dumpAsText(); | |
| 10 testRunner.waitUntilDone(); | |
| 11 window.GCController.collect(); | |
| 12 objectCountBefore = window.GCController.getJSObjectCount(); | |
| 13 var iframeElement = document.getElementById("iframe"); | |
| 14 iframeElement.setAttribute("onload", "loadBlank()"); | |
| 15 iframeElement.src = "resources/long_timeout.html"; | |
| 16 } | |
| 17 } | |
| 18 | |
| 19 var objectCountAfterLoad; | |
| 20 function loadBlank() { | |
| 21 window.GCController.collect(); | |
| 22 objectCountAfterLoad = window.GCController.getJSObjectCount(); | |
| 23 var iframeElement = document.getElementById("iframe"); | |
| 24 iframeElement.setAttribute("onload", "verify()"); | |
| 25 iframeElement.src = "about:blank"; | |
| 26 } | |
| 27 | |
| 28 function verify() | |
| 29 { | |
| 30 var allocatedObjects = 1000; // Number of allocated objects in "resources/long
_timeout.html". | |
| 31 var threshold = allocatedObjects / 2; | |
| 32 | |
| 33 window.GCController.collect(); | |
| 34 var objectCountAfter = window.GCController.getJSObjectCount(); | |
| 35 // Some number of objects is still not released (possibly related to executi
on of this script). | |
| 36 // Use a threshold which is less then the numebr of allocated objects in "re
sources/long_timeout.html" to account for this. | |
| 37 var success = (objectCountAfter - objectCountBefore) < threshold; | |
| 38 document.getElementById("result").innerText = (success ? "PASS" : "FAIL" + | |
| 39 ", before:
" + objectCountBefore + | |
| 40 ", after l
oad: " + objectCountAfterLoad + | |
| 41 ", after:
" + objectCountAfter); | |
| 42 testRunner.notifyDone(); | |
| 43 } | |
| 44 </script> | |
| 45 <body onload="start()"> | |
| 46 <p>This test verifies that an active timeout that didn't yet fire does not preve
nt a Document from releasing (bug https://bugs.webkit.org/show_bug.cgi?id=22710)
. Test can only run in DumpRenderTree since it needs GCController. Test is succe
ssful if it prints 'PASS'.</p> | |
| 47 <div id="result"></div> | |
| 48 <iframe id="iframe"></iframe> | |
| 49 </body> | |
| OLD | NEW |