OLD | NEW |
1 <body onload="test()"> | 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> | 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> | 3 <p>Pass if no crash.</p> |
4 <iframe src="about:blank"></iframe> | 4 <iframe src="about:blank"></iframe> |
5 | 5 <script src="../../../resources/gc.js"></script> |
6 <script> | 6 <script> |
7 if (window.testRunner) { | 7 if (window.testRunner) { |
8 testRunner.dumpAsText(); | 8 testRunner.dumpAsText(); |
9 testRunner.waitUntilDone(); | 9 testRunner.waitUntilDone(); |
10 } | 10 } |
11 | 11 |
12 function gc() | |
13 { | |
14 if (window.GCController) | |
15 return GCController.collect(); | |
16 | |
17 for (var i = 0; i < 10000; i++) { // > force garbage collection (FF requires
about 9K allocations before a collect) | |
18 var s = new String(""); | |
19 } | |
20 } | |
21 | |
22 | |
23 function test() | 12 function test() |
24 { | 13 { |
25 var w = frames[0]; | 14 var w = frames[0]; |
26 var w_setTimeout = w.setTimeout; | 15 var w_setTimeout = w.setTimeout; |
27 var w_clearTimeout = w.clearTimeout; | 16 var w_clearTimeout = w.clearTimeout; |
28 var w_setInterval = w.setInterval; | 17 var w_setInterval = w.setInterval; |
29 var w_clearInterval = w.clearInterval; | 18 var w_clearInterval = w.clearInterval; |
30 document.body.removeChild(document.getElementsByTagName("iframe")[0]); | 19 document.body.removeChild(document.getElementsByTagName("iframe")[0]); |
31 setTimeout(function() { | 20 setTimeout(function() { |
32 gc(); | 21 gc(); |
33 try { w_setTimeout.call(w, "alert('FAIL: timeout ran');", 0); } catch (e
x) { } | 22 try { w_setTimeout.call(w, "alert('FAIL: timeout ran');", 0); } catch (e
x) { } |
34 try { w_clearTimeout.call(w, 0) } catch (ex) { } | 23 try { w_clearTimeout.call(w, 0) } catch (ex) { } |
35 try { w_setInterval.call(w, "alert('FAIL: interval ran');", 0); } catch
(ex) { } | 24 try { w_setInterval.call(w, "alert('FAIL: interval ran');", 0); } catch
(ex) { } |
36 try { w_clearInterval.call(w, 0) } catch (ex) { } | 25 try { w_clearInterval.call(w, 0) } catch (ex) { } |
37 | 26 |
38 if (window.testRunner) | 27 if (window.testRunner) |
39 testRunner.notifyDone(); | 28 testRunner.notifyDone(); |
40 }, 0); | 29 }, 0); |
41 } | 30 } |
42 </script> | 31 </script> |
OLD | NEW |