dom/plugins/test/mochitest/test_bug852315.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial