Throttled DOMTimers can prevent their document from being garbage collected
[WebKit-https.git] / LayoutTests / fast / dom / throttled-timer-running-on-document-destruction.html
index b28fde4..cdf4b9c 100644 (file)
@@ -1,22 +1,31 @@
 <!DOCTYPE html>
 <body>
 <script src="../../resources/js-test-pre.js"></script>
-<iframe id="testFrame" src="resources/frame-with-throttled-timer.html"></iframe>
-
 <script>
 description("Test that we don't crash if a throttled timer is still running when the document is destroyed.");
 jsTestIsAsync = true;
 
-function removeFrame()
+var frameLoadedCount = 0;
+
+function removeFrames()
 {
-  document.body.removeChild(document.getElementById("testFrame"));
+  document.body.removeChild(document.getElementById("testFrame1"));
+  document.body.removeChild(document.getElementById("testFrame2"));
   gc();
   testPassed("Did not crash.");
   finishJSTest();
 }
 
-setTimeout(removeFrame, 300);
+function frameLoaded()
+{
+  ++frameLoadedCount;
+  if (frameLoadedCount == 2)
+    setTimeout(removeFrames, 100);
+}
 
 </script>
+<iframe id="testFrame1" src="resources/frame-with-throttled-timer-animating-element-same-document.html" onload="frameLoaded()"></iframe>
+<iframe id="testFrame2" src="resources/frame-with-throttled-timer-animating-element-other-document.html" onload="frameLoaded()"></iframe>
+
 <script src="../../resources/js-test-post.js"></script>
 </body>