|
1 <head> |
|
2 <title>Plugin hanging</title> |
|
3 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
|
4 <script type="application/javascript" src="utils.js"></script> |
|
5 |
|
6 <body> |
|
7 <script class="testbody" type="application/javascript"> |
|
8 SimpleTest.waitForExplicitFinish(); |
|
9 setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED); |
|
10 |
|
11 window.frameLoaded = function frameLoaded_toCrash() { |
|
12 if (!SimpleTest.testPluginIsOOP()) { |
|
13 ok(true, "Skipping this test when test plugin is not OOP."); |
|
14 SimpleTest.finish(); |
|
15 return; |
|
16 } |
|
17 |
|
18 SimpleTest.expectChildProcessCrash(); |
|
19 |
|
20 // the default timeout is annoying high for mochitest runs |
|
21 var timeoutPref = "dom.ipc.plugins.timeoutSecs"; |
|
22 SpecialPowers.setIntPref(timeoutPref, 5); |
|
23 |
|
24 var iframe = document.getElementById('iframe1'); |
|
25 var p = iframe.contentDocument.getElementById('plugin1'); |
|
26 |
|
27 p.setColor("FFFF00FF"); |
|
28 |
|
29 try { |
|
30 p.hang(); |
|
31 ok(false, "p.hang() should throw an exception"); |
|
32 } |
|
33 catch (e) { |
|
34 ok(true, "p.hang() should throw an exception"); |
|
35 } |
|
36 |
|
37 try { |
|
38 p.setColor("FFFF0000"); |
|
39 ok(false, "p.setColor should throw after the plugin crashes"); |
|
40 } |
|
41 catch (e) { |
|
42 ok(true, "p.setColor should throw after the plugin crashes"); |
|
43 } |
|
44 |
|
45 window.frameLoaded = function reloaded() { |
|
46 var p = iframe.contentDocument.getElementById('plugin1'); |
|
47 try { |
|
48 p.setColor('FF00FF00'); |
|
49 ok(true, "Reloading worked"); |
|
50 } |
|
51 catch (e) { |
|
52 ok(false, "Reloading didn't give us a usable plugin"); |
|
53 } |
|
54 |
|
55 try { |
|
56 SpecialPowers.clearUserPref(timeoutPref); |
|
57 } |
|
58 catch(e) { |
|
59 ok(false, "Couldn't reset timeout pref"); |
|
60 } |
|
61 |
|
62 SimpleTest.finish(); |
|
63 } |
|
64 |
|
65 iframe.contentWindow.location.reload(); |
|
66 } |
|
67 |
|
68 </script> |
|
69 <iframe id="iframe1" src="crashing_subpage.html" width="600" height="600"></iframe> |