tor-browser

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

file_bug800817.xhtml (2687B)


      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=800817
      6 -->
      7 <window title="Mozilla Bug 800817"
      8        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
      9  <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
     10  <script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
     11 
     12  <!-- test results are displayed in the html:body -->
     13  <body xmlns="http://www.w3.org/1999/xhtml">
     14  <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=800817"
     15     target="_blank">Mozilla Bug 800817</a>
     16  </body>
     17 
     18  <!-- test code goes here -->
     19  <script type="application/javascript">
     20  <![CDATA[
     21  /** Test for Bug 800817 */
     22 
     23  function sendClick(win) {
     24    win.synthesizeMouseEvent("mousedown", 10, 10, {}, { toWindow: true });
     25    win.synthesizeMouseEvent("mouseup", 10, 10, {}, { toWindow: true });
     26  }
     27 
     28  function runTests() {
     29    var b1 = document.getElementById("b1");
     30    var b2 = document.getElementById("b2");
     31 
     32    window.arguments[0].info("Testing...");
     33 
     34    b1.contentWindow.focus();
     35    window.arguments[0].is(document.activeElement, b1,
     36                           "Focused first iframe");
     37 
     38    var didCallDummy = false;
     39    b2.contentWindow.addEventListener("mousedown", function(e) { didCallDummy = true; });
     40    sendClick(b2.contentWindow);
     41    window.arguments[0].ok(didCallDummy, "dummy mousedown handler should fire");
     42    window.arguments[0].is(document.activeElement, b2,
     43                           "Focus shifted to second iframe");
     44 
     45    b1.contentWindow.focus();
     46    window.arguments[0].is(document.activeElement, b1,
     47                           "Re-focused first iframe for the first time");
     48 
     49    var didCallListener = false;
     50    b2.contentWindow.addEventListener("mousedown", function(e) { didCallListener = true; e.preventDefault(); });
     51    sendClick(b2.contentWindow);
     52    window.arguments[0].ok(didCallListener, "mousedown handler should fire");
     53    window.arguments[0].is(document.activeElement, b1,
     54                           "Did not move focus to the second iframe");
     55 
     56    window.close();
     57    window.arguments[0].finishedTests();
     58  }
     59 
     60  SimpleTest.waitForFocus(runTests);
     61  ]]>
     62  </script>
     63  <iframe xmlns="http://www.w3.org/1999/xhtml"
     64          id="b1" type="content" src="about:blank"
     65          style="width: 300px; height: 550px; border: 1px solid black;"/>
     66  <iframe xmlns="http://www.w3.org/1999/xhtml"
     67          id="b2" type="content" src="about:blank"
     68          style="width: 300px; height: 550px; border: 1px solid black;"/>
     69 </window>