tor-browser

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

test_eventctors.xhtml (1450B)


      1 <?xml version="1.0"?>
      2 <?xml-stylesheet type="text/css" href="chrome://global/skin"?>
      3 <?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
      4 <!--
      5 https://bugzilla.mozilla.org/show_bug.cgi?id=675884
      6 -->
      7 <window title="Mozilla Bug 675884"
      8        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
      9  <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
     10 
     11  <!-- test results are displayed in the html:body -->
     12  <body xmlns="http://www.w3.org/1999/xhtml">
     13  <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=675884"
     14     target="_blank">Mozilla Bug 675884</a>
     15  </body>
     16 
     17  <!-- test code goes here -->
     18  <script type="application/javascript">
     19  <![CDATA[
     20  /** Test for Bug 675884 */
     21 
     22  // Most of the tests are in .html file, but test here that
     23  // isTrusted is handled correctly in chrome.
     24 
     25  var receivedEvent;
     26  document.addEventListener("hello", function(e) { receivedEvent = e; }, true);
     27 
     28  // Event
     29  var e;
     30  var ex = false;
     31  try {
     32    e = new Event();
     33  } catch(exp) {
     34    ex = true;
     35  }
     36  ok(ex, "First parameter is required!");
     37  ex = false;
     38 
     39  e = new Event("hello");
     40  is(e.type, "hello", "Wrong event type!");
     41  ok(e.isTrusted, "Event should be trusted!");
     42  ok(!e.bubbles, "Event shouldn't bubble!");
     43  ok(!e.cancelable, "Event shouldn't be cancelable!");
     44  document.dispatchEvent(e);
     45  is(receivedEvent, e, "Wrong event!");
     46 
     47  ]]>
     48  </script>
     49 </window>