js/xpconnect/tests/mochitest/test_bug661980.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/xpconnect/tests/mochitest/test_bug661980.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,61 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=661980
     1.8 +-->
     1.9 +<head>
    1.10 +  <title>Test for Bug 661980</title>
    1.11 +  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.12 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    1.13 +</head>
    1.14 +<body>
    1.15 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=661980">Mozilla Bug 661980</a>
    1.16 +<p id="display"></p>
    1.17 +<div id="content" style="display: none">
    1.18 +  
    1.19 +</div>
    1.20 +<pre id="test">
    1.21 +<script type="application/javascript">
    1.22 +
    1.23 +/** Test for Bug 661980 **/
    1.24 +
    1.25 +// While not currently needed, make this as similar as possible to a real
    1.26 +// EventTarget just to make sure that we're tripping on the wrapping and
    1.27 +// nothing else.
    1.28 +var fakeTarget = {
    1.29 +  addEventListener: function() {},
    1.30 +  removeEventListener: function() {},
    1.31 +  dispatchEvent: function() {}
    1.32 +}
    1.33 +
    1.34 +var mouseevent = document.createEvent("MouseEvent");
    1.35 +var didThrow = false;
    1.36 +dump("hello nurse");
    1.37 +try {
    1.38 +  mouseevent.initMouseEvent("mouseover",
    1.39 +                            false, false,
    1.40 +                            window,
    1.41 +                            1, 2, 3, 4, 5,
    1.42 +                            false, false, false, false,
    1.43 +                            0,
    1.44 +                            fakeTarget);
    1.45 +}
    1.46 +catch (ex) {
    1.47 +  didThrow = true;
    1.48 +}
    1.49 +ok(didThrow, "should not be able to implement EventTarget using script");
    1.50 +
    1.51 +mouseevent.initMouseEvent("mouseout",
    1.52 +                          false, false,
    1.53 +                          window,
    1.54 +                          1, 2, 3, 4, 5,
    1.55 +                          false, false, false, false,
    1.56 +                          0,
    1.57 +                          document.body);
    1.58 +is(mouseevent.type, "mouseout",
    1.59 +   "should able to implement EventTarget using Element");
    1.60 +
    1.61 +</script>
    1.62 +</pre>
    1.63 +</body>
    1.64 +</html>

mercurial