dom/plugins/test/mochitest/test_bug852315.html

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     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"/>
     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">
    15 SimpleTest.waitForExplicitFinish();
    16 setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
    18 // Tests that the document-inactive notification stopping plugins does not
    19 // fatally re-enter when adding other plugins to the document.
    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);
    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   });
    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);
    50 </script>
    51 </body>
    52 </html>

mercurial