| <head> |
| <script> |
| function gc() { |
| if (window.GCController) |
| GCController.collect(); |
| } |
| |
| function numberOfLiveDocuments() { |
| if (window.internals) |
| return window.internals.numberOfLiveDocuments(); |
| return 1; |
| } |
| |
| gc(); |
| |
| iterationsToRun = 10; |
| iterationsRemaining = iterationsToRun; |
| if (window.testRunner) { |
| testRunner.dumpAsText(); |
| testRunner.waitUntilDone(); |
| } |
| |
| function test() { |
| var f = document.getElementById("frame"); |
| f.onload = function() { |
| f.contentDocument.open(); |
| f.contentDocument.close(); |
| --iterationsRemaining; |
| if (iterationsRemaining) |
| setTimeout("test()", 0); |
| else { |
| gc(); |
| var numberOfLiveDocumentsDelta = numberOfLiveDocuments() - numberOfLiveDocumentsAtStart; |
| var out = document.getElementById("out"); |
| if (numberOfLiveDocumentsDelta < iterationsToRun) |
| out.innerText += "PASS: Less than " + iterationsToRun + " new documents since test began."; |
| else |
| out.innerText += "FAIL: Too many new documents since test began: " + numberOfLiveDocumentsDelta; |
| if (window.testRunner) |
| testRunner.notifyDone(); |
| } |
| } |
| f.setAttribute("src", "resources/apple.gif"); |
| } |
| |
| function begin() { |
| numberOfLiveDocumentsAtStart = numberOfLiveDocuments(); |
| test(); |
| } |
| </script> |
| </head> |
| <body onload="begin()"> |
| <p>Test that ImageDocuments don't leak their world. </p> |
| <pre id="out"></pre> |
| <iframe id="frame"></iframe> |
| </body> |