tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_bug661980.html (1731B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=661980
      5 -->
      6 <head>
      7  <title>Test for Bug 661980</title>
      8  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      9  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
     10 </head>
     11 <body>
     12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=661980">Mozilla Bug 661980</a>
     13 <p id="display"></p>
     14 <div id="content" style="display: none">
     15 
     16 </div>
     17 <pre id="test">
     18 <script type="application/javascript">
     19 
     20 /** Test for Bug 661980 **/
     21 
     22 // While not currently needed, make this as similar as possible to a real
     23 // EventTarget just to make sure that we're tripping on the wrapping and
     24 // nothing else.
     25 var fakeTarget = {
     26  addEventListener: function() {},
     27  removeEventListener: function() {},
     28  dispatchEvent: function() {}
     29 }
     30 
     31 var mouseevent = document.createEvent("MouseEvent");
     32 var didThrow = false;
     33 dump("hello nurse\n");
     34 try {
     35  mouseevent.initMouseEvent("mouseover",
     36                            false, false,
     37                            window,
     38                            1, 2, 3, 4, 5,
     39                            false, false, false, false,
     40                            0,
     41                            fakeTarget);
     42 }
     43 catch (ex) {
     44  didThrow = true;
     45 }
     46 ok(didThrow, "should not be able to implement EventTarget using script");
     47 
     48 mouseevent.initMouseEvent("mouseout",
     49                          false, false,
     50                          window,
     51                          1, 2, 3, 4, 5,
     52                          false, false, false, false,
     53                          0,
     54                          document.body);
     55 is(mouseevent.type, "mouseout",
     56   "should able to implement EventTarget using Element");
     57 
     58 </script>
     59 </pre>
     60 </body>
     61 </html>