accessible/tests/mochitest/states/test_visibility.xul

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     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"?>
     6 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
     7         title="XUL elements visibility states testing">
     9   <script type="application/javascript"
    10           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
    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" />
    21   <script type="application/javascript">
    22   <![CDATA[
    23     function openMenu(aID, aSubID, aOffscreenSubID)
    24     {
    25       this.menuNode = getNode(aID);
    27       this.eventSeq = [
    28         new invokerChecker(EVENT_FOCUS, this.menuNode)
    29       ];
    31       this.invoke = function openMenu_invoke()
    32       {
    33         this.menuNode.open = true;
    34       }
    36       this.finalCheck = function openMenu_finalCheck()
    37       {
    38         testStates(aID, 0, 0, STATE_INVISIBLE | STATE_OFFSCREEN);
    39         testStates(aSubID, 0, 0, STATE_INVISIBLE | STATE_OFFSCREEN);
    40         if (aOffscreenSubID)
    41           testStates(aOffscreenSubID, STATE_OFFSCREEN, 0, STATE_INVISIBLE);
    42       }
    44       this.getID = function openMenu_invoke()
    45       {
    46         return "open menu '" + aID + "' and test states";
    47       }
    48     }
    50     function closeMenu(aID, aSubID, aSub2ID)
    51     {
    52       this.menuNode = getNode(aID);
    54       this.eventSeq = [
    55         new invokerChecker(EVENT_FOCUS, document)
    56       ];
    58       this.invoke = function openMenu_invoke()
    59       {
    60         this.menuNode.open = false;
    61       }
    63       this.finalCheck = function openMenu_finalCheck()
    64       {
    65         testStates(aID, 0, 0, STATE_INVISIBLE | STATE_OFFSCREEN);
    66         testStates(aSubID, STATE_INVISIBLE, 0, STATE_OFFSCREEN);
    67         testStates(aSub2ID, STATE_INVISIBLE, 0, STATE_OFFSCREEN);
    68       }
    70       this.getID = function openMenu_invoke()
    71       {
    72         return "open menu and test states";
    73       }
    74     }
    76     var gQueue = null;
    77     function doTest()
    78     {
    79       testStates("deck_pane2", 0, 0, STATE_INVISIBLE | STATE_OFFSCREEN);
    80       testStates("tabs_pane1", 0, 0, STATE_INVISIBLE | STATE_OFFSCREEN);
    81       testStates("tabs_pane2", STATE_OFFSCREEN, 0, STATE_INVISIBLE);
    83       gQueue = new eventQueue();
    84       gQueue.push(new openMenu("mi_file1", "mi_file1.1"));
    85       gQueue.push(new openMenu("mi_file1.2", "mi_file1.2.1", "mi_file1.2.4"));
    86       gQueue.push(new closeMenu("mi_file1", "mi_file1.1", "mi_file1.2.1"));
    87       gQueue.invoke(); // Will call SimpleTest.finish();
    88     }
    90     SimpleTest.waitForExplicitFinish();
    91     addA11yLoadEvent(doTest);
    92   ]]>
    93   </script>
    95   <hbox flex="1" style="overflow: auto;">
    96     <body xmlns="http://www.w3.org/1999/xhtml">
    97      <a target="_blank"
    98          href="https://bugzilla.mozilla.org/show_bug.cgi?id=810260"
    99          title="xul:deck hidden pages shouldn't be offscreen">
   100         Mozilla Bug 810260
   101      </a>
   102      <a target="_blank"
   103          href="https://bugzilla.mozilla.org/show_bug.cgi?id=865591"
   104          title="Visible menu item have offscreen state">
   105         Mozilla Bug 865591
   106      </a>
   108       <p id="display"></p>
   109       <div id="content" style="display: none">
   110       </div>
   111       <pre id="test">
   112       </pre>
   113     </body>
   115     <vbox flex="1">
   117       <deck selectedIndex="1">
   118         <description value="This is the first page" id="deck_pane1"/>
   119         <button label="This is the second page" id="deck_pane2"/>
   120       </deck>
   122       <tabbox>
   123         <tabs>
   124           <tab>tab1</tab>
   125           <tab>tab2</tab>
   126         </tabs>
   127         <tabpanels>
   128           <description value="This is the first page" id="tabs_pane1"/>
   129           <button label="This is the second page" id="tabs_pane2"/>
   130         </tabpanels>
   131       </tabbox>
   133       <menubar>
   134         <menu label="File" id="mi_file1">
   135           <menupopup>
   136             <menuitem label="SubFile" id="mi_file1.1"/>
   137             <menu label="SubFile2" id="mi_file1.2">
   138               <menupopup style="max-height: 5em;">
   139                 <menuitem label="SubSubFile" id="mi_file1.2.1"/>
   140                 <menuitem label="SubSubFile2" id="mi_file1.2.2"/>
   141                 <menuitem label="SubSubFile3" id="mi_file1.2.3"/>
   142                 <menuitem label="SubSubFile4" id="mi_file1.2.4"/>
   143               </menupopup>
   144             </menu>
   145           </menupopup>
   146         </menu>
   147       </menubar>
   148     </vbox>
   149   </hbox>
   151 </window>

mercurial