|
1 <!DOCTYPE HTML> |
|
2 <html> |
|
3 <!-- |
|
4 https://bugzilla.mozilla.org/show_bug.cgi?id=777098 |
|
5 --> |
|
6 <head> |
|
7 <meta charset="utf-8"> |
|
8 <title>Test for Bug 777098</title> |
|
9 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
|
10 <script type="application/javascript" src="utils.js"></script> |
|
11 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
|
12 </head> |
|
13 <body onload="go();"> |
|
14 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=777098">Mozilla Bug 777098</a> |
|
15 <pre id="test"> |
|
16 <script type="application/javascript"> |
|
17 |
|
18 /** Test for passing dead NPObjects back into plugins. **/ |
|
19 SimpleTest.waitForExplicitFinish(); |
|
20 setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED); |
|
21 |
|
22 function go() { |
|
23 var plugin = document.getElementById('plugin'); |
|
24 |
|
25 // Get wrapped npobject from plugin (plugin.__proto__) |
|
26 var val = plugin.getObjectValue(); |
|
27 |
|
28 // Force a re-instantiate by re-setting dummy uri, |
|
29 // making val a wrapper for a dead plugin |
|
30 plugin.data = plugin.data; |
|
31 |
|
32 // The correct behavior is an exception, if plugin.checkObjectValue succeeds |
|
33 // the plugin wasn't torn down for some reason, and if we crash... that's bad |
|
34 function pluginCheck() { |
|
35 try { |
|
36 plugin.checkObjectValue(val); |
|
37 } catch (e) { |
|
38 return true; |
|
39 } |
|
40 return false; |
|
41 } |
|
42 |
|
43 // Spin the event loop so the instantiation can complete |
|
44 window.setTimeout(function () { |
|
45 ok(pluginCheck(), "Shouldn't explode"); |
|
46 |
|
47 // All done. |
|
48 SimpleTest.finish(); |
|
49 }, 0); |
|
50 } |
|
51 |
|
52 </script> |
|
53 </pre> |
|
54 |
|
55 <object data="data:text/plain,a" width=200 height=200 type="application/x-test" id="plugin"></object> |
|
56 |
|
57 </body> |
|
58 </html> |