dom/plugins/test/mochitest/test_bug852315.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/plugins/test/mochitest/test_bug852315.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,52 @@
     1.4 +<!doctype html>
     1.5 +<html>
     1.6 +<head>
     1.7 +  <title>Test for Bug 852315</title>
     1.8 +  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     1.9 +  <script type="text/javascript" src="utils.js"></script>
    1.10 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    1.11 +
    1.12 +  <meta http-equiv="content-type" content="text/html; charset=utf-8">
    1.13 +  <base href="chrome://browser/content/">
    1.14 +</head>
    1.15 +<body>
    1.16 +<script type="application/javascript">
    1.17 +
    1.18 +SimpleTest.waitForExplicitFinish();
    1.19 +setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
    1.20 +
    1.21 +// Tests that the document-inactive notification stopping plugins does not
    1.22 +// fatally re-enter when adding other plugins to the document.
    1.23 +
    1.24 +var i = document.createElement("iframe");
    1.25 +var ob = document.body;
    1.26 +i.addEventListener("load", function loadfunc() {
    1.27 +  var d = i.contentWindow.document;
    1.28 +  var e = i.contentDocument.createElement("embed");
    1.29 +  var destroyran = false;
    1.30 +  e.type = "application/x-test";
    1.31 +  i.contentDocument.body.appendChild(e);
    1.32 +
    1.33 +  // On despawn, append an embed tag to document.
    1.34 +  e.callOnDestroy(function() {
    1.35 +    var e2 = d.createElement("embed");
    1.36 +    d.body.appendChild(e2);
    1.37 +    destroyran = true;
    1.38 +  });
    1.39 +
    1.40 +  // Navigate the frame to cause the document with the plugin to go inactive
    1.41 +  i.removeEventListener("load", loadfunc);
    1.42 +  i.src = "about:blank";
    1.43 +  SimpleTest.executeSoon(function() {
    1.44 +    // Ensure this event doesn't race with CheckPluginStopEvent
    1.45 +    SimpleTest.executeSoon(function() {
    1.46 +      ok(destroyran, "OnDestroy callback ran and did not crash");
    1.47 +      SimpleTest.finish();
    1.48 +    });
    1.49 +  });
    1.50 +});
    1.51 +document.body.appendChild(i);
    1.52 +
    1.53 +</script>
    1.54 +</body>
    1.55 +</html>

mercurial