tor-browser

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

test_focus_contextmenu.xhtml (3476B)


      1 <?xml version="1.0"?>
      2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
      3 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
      4                 type="text/css"?>
      5 
      6 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
      7        title="Context menu focus testing">
      8 
      9  <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
     10  <script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
     11 
     12  <script type="application/javascript"
     13          src="../common.js" />
     14  <script type="application/javascript"
     15          src="../role.js" />
     16  <script type="application/javascript"
     17          src="../states.js" />
     18  <script type="application/javascript"
     19          src="../events.js" />
     20 
     21  <script type="application/javascript">
     22    //gA11yEventDumpID = "eventdump"; // debug stuff
     23    //gA11yEventDumpToConsole = true; // debug stuff
     24    
     25    var winLowerThanVista = navigator.platform.indexOf("Win") == 0;
     26    if (winLowerThanVista) {
     27      var version = Services.sysinfo.getProperty("version");
     28      version = parseFloat(version);
     29      winLowerThanVista = !(version >= 6.0);
     30    }
     31 
     32    var gQueue = null;
     33    function doTests()
     34    {
     35      // bug 746183 - Whole file times out on OS X
     36      if (MAC || winLowerThanVista) {
     37        todo(false, "Reenable on mac after fixing bug 746183!");
     38        SimpleTest.finish();
     39        return;
     40      }
     41 
     42      // Test focus events.
     43      gQueue = new eventQueue();
     44 
     45      gQueue.push(new synthFocus("button"));
     46      gQueue.push(new synthContextMenu("button", [
     47        new invokerChecker(EVENT_MENUPOPUP_START, "contextmenu"),
     48        new invokerChecker("popupshown", "contextmenu"),
     49      ]));
     50      gQueue.push(new synthDownKey("button", new focusChecker("item1")));
     51      gQueue.push(new synthEscapeKey("contextmenu", new focusChecker("button")));
     52 
     53      gQueue.push(new synthContextMenu("button",
     54                                       new invokerChecker(EVENT_MENUPOPUP_START, "contextmenu")));
     55      gQueue.push(new synthDownKey("contextmenu", new focusChecker("item1")));
     56      gQueue.push(new synthDownKey("item1", new focusChecker("item2")));
     57      gQueue.push(new synthRightKey("item2", new focusChecker("item2.1")));
     58      if (WIN) {
     59        todo(false, "synthEscapeKey for item2.1 and item2 disabled due to bug 691580");
     60      } else {
     61        gQueue.push(new synthEscapeKey("item2.1", new focusChecker("item2")));
     62        gQueue.push(new synthEscapeKey("item2", new focusChecker("button")));
     63      }
     64      gQueue.invoke(); // Will call SimpleTest.finish();
     65    }
     66 
     67    SimpleTest.waitForExplicitFinish();
     68    addA11yLoadEvent(doTests);
     69  </script>
     70 
     71  <hbox flex="1" style="overflow: auto;">
     72    <body xmlns="http://www.w3.org/1999/xhtml">
     73      <a target="_blank"
     74         href="https://bugzilla.mozilla.org/show_bug.cgi?id=673958"
     75         title="Rework accessible focus handling">
     76        Mozilla Bug 673958
     77      </a>
     78      <p id="display"></p>
     79      <div id="content" style="display: none"></div>
     80      <pre id="test">
     81      </pre>
     82    </body>
     83 
     84    <vbox flex="1">
     85      <button id="button" context="contextmenu" label="button"/>
     86      <menupopup id="contextmenu">
     87        <menuitem id="item1" label="item1"/>
     88        <menu id="item2" label="item2">
     89          <menupopup>
     90            <menuitem id="item2.1" label="item2.1"/>
     91          </menupopup>
     92        </menu>
     93      </menupopup>
     94 
     95      <vbox id="eventdump"/>
     96    </vbox>
     97  </hbox>
     98 </window>