dom/plugins/test/mochitest/test_instance_unparent1.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/plugins/test/mochitest/test_instance_unparent1.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,43 @@
     1.4 +<!DOCTYPE html>
     1.5 +<html>
     1.6 +<head>
     1.7 +  <title>Test removing an instance's DOM node</title>
     1.8 +  <script type="text/javascript" src="/MochiKit/packed.js"></script>
     1.9 +  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.10 +  <script type="text/javascript" src="utils.js"></script>
    1.11 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
    1.12 +</head>
    1.13 +<body onload="startTest()">
    1.14 +  <script type="application/javascript;version=1.8">
    1.15 +  SimpleTest.waitForExplicitFinish();
    1.16 +  setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
    1.17 +
    1.18 +  var destroyed = false;
    1.19 +  function onDestroy() {
    1.20 +    destroyed = true;
    1.21 +  }
    1.22 +
    1.23 +  function checkPluginAlreadyDestroyed() {
    1.24 +    is(destroyed, true, "Plugin instance should have been destroyed.");
    1.25 +    SimpleTest.finish();
    1.26 +  }
    1.27 +
    1.28 +  function startTest() {
    1.29 +    var p1 = document.getElementById('plugin1');
    1.30 +    var d1 = document.getElementById('div1');
    1.31 +
    1.32 +    p1.callOnDestroy(onDestroy);
    1.33 +
    1.34 +    setTimeout(checkPluginAlreadyDestroyed, 0);
    1.35 +
    1.36 +    d1.removeChild(p1);
    1.37 +  }
    1.38 +  </script>
    1.39 +
    1.40 +  <p id="display"></p>
    1.41 +
    1.42 +  <div id="div1">
    1.43 +    <embed id="plugin1" type="application/x-test" width="200" height="200"></embed>
    1.44 +  </div>
    1.45 +</body>
    1.46 +</html>

mercurial