<!DOCTYPE html>
<body>
<script src="../../resources/js-test-pre.js"></script>
<script>
description("Test that we don't crash if a throttled timer is still running when the document is destroyed.");
jsTestIsAsync = true;

var frameLoadedCount = 0;

function removeFrames()
{
  document.body.removeChild(document.getElementById("testFrame1"));
  document.body.removeChild(document.getElementById("testFrame2"));
  gc();
  testPassed("Did not crash.");
  finishJSTest();
}

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>
