blob: aa4f66cffa12e7e6730374e8b49f7e235f22e88b [file] [log] [blame]
<body onload="test()">
<p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=33815">bug 33815</a>: Crash when using DOMTimer from a detached frame.</p>
<p>Pass if no crash.</p>
<iframe src="about:blank"></iframe>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
function gc()
{
if (window.GCController)
return GCController.collect();
for (var i = 0; i < 10000; i++) { // > force garbage collection (FF requires about 9K allocations before a collect)
var s = new String("");
}
}
function test()
{
var w = frames[0];
var w_setTimeout = w.setTimeout;
var w_clearTimeout = w.clearTimeout;
var w_setInterval = w.setInterval;
var w_clearInterval = w.clearInterval;
document.body.removeChild(document.getElementsByTagName("iframe")[0]);
setTimeout(function() {
gc();
try { w_setTimeout.call(w, "alert('FAIL: timeout ran');", 0); } catch (ex) { }
try { w_clearTimeout.call(w, 0) } catch (ex) { }
try { w_setInterval.call(w, "alert('FAIL: interval ran');", 0); } catch (ex) { }
try { w_clearInterval.call(w, 0) } catch (ex) { }
if (window.testRunner)
testRunner.notifyDone();
}, 0);
}
</script>