OLD | NEW |
| (Empty) |
1 <html> | |
2 <head> | |
3 <script src="../js/resources/js-test-pre.js"></script> | |
4 <script> | |
5 | |
6 window.jsTestIsAsync = true; | |
7 | |
8 var iteration = 0; | |
9 var sheet, rules; | |
10 | |
11 function step1(opt_media) | |
12 { | |
13 var doc = document.implementation.createHTMLDocument(); | |
14 var style = doc.createElement('style'); | |
15 doc.head.appendChild(style); | |
16 sheet = style.sheet; | |
17 if (opt_media) { | |
18 sheet.insertRule('@media screen { body { background: red; } p { color: w
hite; } }', 0); | |
19 rules = sheet.rules[0]; | |
20 sheet.removeRule(0); | |
21 sheet = 0; | |
22 } | |
23 | |
24 doc.head.removeChild(style); | |
25 document.adoptNode(style); | |
26 delete doc; | |
27 gc(); | |
28 setTimeout(opt_media ? step2a : step2b, 10); | |
29 } | |
30 | |
31 function step2a() | |
32 { | |
33 try { | |
34 rules.insertRule('a { }', 1); | |
35 if (iteration++ == 10) { | |
36 iteration = 0; | |
37 step1(true); | |
38 return; | |
39 } | |
40 | |
41 setTimeout('step1(false)', 0); | |
42 } | |
43 catch(e) { | |
44 document.body.innerText = 'FAIL, threw exception.'; | |
45 if (window.layoutTestController) | |
46 layoutTestController.notifyDone(); | |
47 | |
48 } | |
49 } | |
50 | |
51 function step2b() | |
52 { | |
53 try { | |
54 sheet.insertRule('a { }', 0); | |
55 if (iteration++ == 10) { | |
56 document.body.innerText = 'PASS'; | |
57 if (window.layoutTestController) | |
58 layoutTestController.notifyDone(); | |
59 return; | |
60 } | |
61 | |
62 setTimeout('step1(true)', 0); | |
63 } | |
64 catch(e) { | |
65 document.body.innerText = 'FAIL, threw exception.'; | |
66 if (window.layoutTestController) | |
67 layoutTestController.notifyDone(); | |
68 | |
69 } | |
70 } | |
71 | |
72 </script> | |
73 <script src="../js/resources/js-test-post.js"></script> | |
74 </head> | |
75 <body onload="step1()"> | |
76 Running... | |
77 </body> | |
78 </html> | |
OLD | NEW |