dom/plugins/test/mochitest/test_bug854082.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/plugins/test/mochitest/test_bug854082.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,41 @@
     1.4 +<!doctype html>
     1.5 +<html>
     1.6 +<head>
     1.7 +  <title>Test for Bug 854082</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 +  // Tests that destroying the plugin's frame inside NPP_New does not cause a
    1.18 +  // crash
    1.19 +
    1.20 +  SimpleTest.waitForExplicitFinish();
    1.21 +  setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
    1.22 +
    1.23 +  // Create an object that will spawn asynchronously
    1.24 +  var o = document.createElement("object");
    1.25 +  o.type = "application/x-test";
    1.26 +
    1.27 +  // The test plugin sets pluginFoundElement on its element inside NPP_New,
    1.28 +  // abuse this to run arbitrary script.
    1.29 +  var setterCalled;
    1.30 +  o.__defineSetter__("pluginFoundElement", function() {
    1.31 +    o.style.display = "none";
    1.32 +    // Access clientTop to force layout flush
    1.33 +    o.clientTop;
    1.34 +    setterCalled = true;
    1.35 +  });
    1.36 +  document.body.appendChild(o);
    1.37 +
    1.38 +  SimpleTest.executeSoon(function() {
    1.39 +    ok(setterCalled, "Setter called and did not crash");
    1.40 +    SimpleTest.finish();
    1.41 +  });
    1.42 +</script>
    1.43 +</body>
    1.44 +</html>

mercurial