Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
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>
6 <body>
7 <script class="testbody" type="application/javascript">
8 SimpleTest.waitForExplicitFinish();
9 setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
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 }
18 SimpleTest.expectChildProcessCrash();
20 // the default timeout is annoying high for mochitest runs
21 var timeoutPref = "dom.ipc.plugins.timeoutSecs";
22 SpecialPowers.setIntPref(timeoutPref, 5);
24 var iframe = document.getElementById('iframe1');
25 var p = iframe.contentDocument.getElementById('plugin1');
27 p.setColor("FFFF00FF");
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 }
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 }
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 }
55 try {
56 SpecialPowers.clearUserPref(timeoutPref);
57 }
58 catch(e) {
59 ok(false, "Couldn't reset timeout pref");
60 }
62 SimpleTest.finish();
63 }
65 iframe.contentWindow.location.reload();
66 }
68 </script>
69 <iframe id="iframe1" src="crashing_subpage.html" width="600" height="600"></iframe>