|
1 <!doctype html> |
|
2 <html> |
|
3 <head> |
|
4 <title>Test for Bug 852315</title> |
|
5 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
|
6 <script type="text/javascript" src="utils.js"></script> |
|
7 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
|
8 |
|
9 <meta http-equiv="content-type" content="text/html; charset=utf-8"> |
|
10 <base href="chrome://browser/content/"> |
|
11 </head> |
|
12 <body> |
|
13 <script type="application/javascript"> |
|
14 |
|
15 SimpleTest.waitForExplicitFinish(); |
|
16 setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED); |
|
17 |
|
18 // Tests that the document-inactive notification stopping plugins does not |
|
19 // fatally re-enter when adding other plugins to the document. |
|
20 |
|
21 var i = document.createElement("iframe"); |
|
22 var ob = document.body; |
|
23 i.addEventListener("load", function loadfunc() { |
|
24 var d = i.contentWindow.document; |
|
25 var e = i.contentDocument.createElement("embed"); |
|
26 var destroyran = false; |
|
27 e.type = "application/x-test"; |
|
28 i.contentDocument.body.appendChild(e); |
|
29 |
|
30 // On despawn, append an embed tag to document. |
|
31 e.callOnDestroy(function() { |
|
32 var e2 = d.createElement("embed"); |
|
33 d.body.appendChild(e2); |
|
34 destroyran = true; |
|
35 }); |
|
36 |
|
37 // Navigate the frame to cause the document with the plugin to go inactive |
|
38 i.removeEventListener("load", loadfunc); |
|
39 i.src = "about:blank"; |
|
40 SimpleTest.executeSoon(function() { |
|
41 // Ensure this event doesn't race with CheckPluginStopEvent |
|
42 SimpleTest.executeSoon(function() { |
|
43 ok(destroyran, "OnDestroy callback ran and did not crash"); |
|
44 SimpleTest.finish(); |
|
45 }); |
|
46 }); |
|
47 }); |
|
48 document.body.appendChild(i); |
|
49 |
|
50 </script> |
|
51 </body> |
|
52 </html> |