blob: eac6e42bef9b245718dd2bad28b2ef4258696f97 (
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
|
<head>
<title>Plugin crashing</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="plugin-utils.js"></script>
<body>
<script class="testbody" type="application/javascript">
SimpleTest.waitForExplicitFinish();
setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
window.frameLoaded = function frameLoaded_toCrash() {
SimpleTest.expectChildProcessCrash();
var iframe = document.getElementById('iframe1');
var p = iframe.contentDocument.getElementById('plugin1');
p.setColor("FFFF00FF");
try {
p.crash();
ok(false, "p.crash() should throw an exception");
}
catch (e) {
ok(true, "p.crash() should throw an exception");
}
// Create random identifiers to test bug 560213
for (var i = 0; i < 5; ++i) {
var r = 'rid_' + Math.floor(Math.random() * 10000 + 1);
try {
ok(!(r in p), "unknown identifier in crashed plugin should fail silently");
}
catch (e) {
ok(false, "unknown identifier check threw");
}
}
try {
p.setColor("FFFF0000");
ok(false, "p.setColor should throw after the plugin crashes");
}
catch (e) {
ok(true, "p.setColor should throw after the plugin crashes");
}
window.frameLoaded = function reloaded() {
var p = iframe.contentDocument.getElementById('plugin1');
try {
p.setColor('FF00FF00');
ok(true, "Reloading worked");
}
catch (e) {
ok(false, "Reloading didn't give us a usable plugin");
}
SimpleTest.finish();
}
iframe.contentWindow.location.reload();
}
</script>
<iframe id="iframe1" src="crashing_subpage.html" width="600" height="600"></iframe>
|