Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / dom / Window / timer-null-script-execution-context.html
blobaa4f66cffa12e7e6730374e8b49f7e235f22e88b
1 <body onload="test()">
2 <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>
3 <p>Pass if no crash.</p>
4 <iframe src="about:blank"></iframe>
6 <script>
7 if (window.testRunner) {
8 testRunner.dumpAsText();
9 testRunner.waitUntilDone();
12 function gc()
14 if (window.GCController)
15 return GCController.collect();
17 for (var i = 0; i < 10000; i++) { // > force garbage collection (FF requires about 9K allocations before a collect)
18 var s = new String("");
23 function test()
25 var w = frames[0];
26 var w_setTimeout = w.setTimeout;
27 var w_clearTimeout = w.clearTimeout;
28 var w_setInterval = w.setInterval;
29 var w_clearInterval = w.clearInterval;
30 document.body.removeChild(document.getElementsByTagName("iframe")[0]);
31 setTimeout(function() {
32 gc();
33 try { w_setTimeout.call(w, "alert('FAIL: timeout ran');", 0); } catch (ex) { }
34 try { w_clearTimeout.call(w, 0) } catch (ex) { }
35 try { w_setInterval.call(w, "alert('FAIL: interval ran');", 0); } catch (ex) { }
36 try { w_clearInterval.call(w, 0) } catch (ex) { }
38 if (window.testRunner)
39 testRunner.notifyDone();
40 }, 0);
42 </script>