summaryrefslogtreecommitdiffstats
path: root/dom/plugins/test/mochitest/test_bug854082.html
blob: ff3d1e1e860080373371a5ca504dc1e815b56741 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<!doctype html>
<html>
<head>
  <title>Test for Bug 854082</title>
  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
  <script type="text/javascript" src="plugin-utils.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>

  <meta http-equiv="content-type" content="text/html; charset=utf-8">
  <base href="chrome://browser/content/">
</head>
<body>
<script type="application/javascript">
  // Tests that destroying the plugin's frame inside NPP_New does not cause a
  // crash

  SimpleTest.waitForExplicitFinish();
  setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);

  // Create an object that will spawn asynchronously
  var o = document.createElement("object");
  o.type = "application/x-test";

  // The test plugin sets pluginFoundElement on its element inside NPP_New,
  // abuse this to run arbitrary script.
  var setterCalled;
  o.__defineSetter__("pluginFoundElement", function() {
    o.style.display = "none";
    // Access clientTop to force layout flush
    o.clientTop;
    ok(true, "Setter called and did not crash");
    SimpleTest.finish();
    setterCalled = true;
  });
  document.body.appendChild(o);
</script>
</body>
</html>