dom/plugins/test/mochitest/test_npruntime_construct.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/plugins/test/mochitest/test_npruntime_construct.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,32 @@
     1.4 +<!DOCTYPE html>
     1.5 +<html>
     1.6 +<head>
     1.7 +  <title>Test whether windowless plugins receive correct visible/invisible notifications.</title>
     1.8 +  <script type="text/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 +<body>
    1.13 +  <script type="text/javascript">
    1.14 +    setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
    1.15 +  </script>
    1.16 +
    1.17 +  <p id="display"></p>
    1.18 +
    1.19 +  <embed id="theplugin" type="application/x-test"></embed>
    1.20 +
    1.21 +  <script type="application/javascript">
    1.22 +    function MyFunc(arg) {
    1.23 +      is(arg, "hi", "Argument passed to constructor function");
    1.24 +      this.localProp = 'local';
    1.25 +    }
    1.26 +    MyFunc.prototype.protoProp = 't';
    1.27 +
    1.28 +    var theplugin = document.getElementById('theplugin');
    1.29 +
    1.30 +    ok(theplugin.constructObject(Array) instanceof Array, "Constructed Array");
    1.31 +    var o = theplugin.constructObject(MyFunc, "hi");
    1.32 +    ok(o instanceof MyFunc, "Constructed MyFunc");
    1.33 +    is(o.localProp, 'local', "this property correct");
    1.34 +    is(o.protoProp, 't', "prototype property correct");
    1.35 +  </script>

mercurial