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