dom/plugins/test/mochitest/test_instantiation.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/plugins/test/mochitest/test_instantiation.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,33 @@
     1.4 +<head>
     1.5 +  <title>Plugin instantiation</title>
     1.6 +  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     1.7 +  <script type="application/javascript" src="utils.js"></script>
     1.8 +
     1.9 +<body onload="mainLoaded()">
    1.10 +  <iframe id="iframe1" src="about:blank" width="600" height="600"></iframe>
    1.11 +
    1.12 +  <script class="testbody" type="application/javascript">
    1.13 +  SimpleTest.waitForExplicitFinish();
    1.14 +  setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
    1.15 +
    1.16 +  var iframe = document.getElementById('iframe1');
    1.17 +
    1.18 +  function mainLoaded() {
    1.19 +    var p = iframe.contentDocument.createElement('embed');
    1.20 +    p.setAttribute('id', 'plugin1');
    1.21 +    p.setAttribute('type', 'application/x-test');
    1.22 +    p.setAttribute('width', '400');
    1.23 +    p.setAttribute('height', '400');
    1.24 +    p.setAttribute('drawmode', 'solid');
    1.25 +    p.setAttribute('color', 'FF00FFFF');
    1.26 +    iframe.contentDocument.body.appendChild(p);
    1.27 +
    1.28 +    // Plugin instantiation happens asynchronously
    1.29 +    SimpleTest.executeSoon(function() {
    1.30 +      SimpleTest.executeSoon(function() {
    1.31 +        ok(p.setColor !== undefined, "Dynamic plugin instantiation.");
    1.32 +        SimpleTest.finish();
    1.33 +      })
    1.34 +    });
    1.35 +  }
    1.36 +  </script>

mercurial