toolkit/content/tests/chrome/test_menu.xul

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     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" type="text/css"?>
     5 <window title="Menu Destruction Test"
     6   onload="runTests();"
     7   xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
     9   <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
    10   <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
    12   <menubar>
    13     <menu label="top" id="top">
    14       <menupopup>
    15         <menuitem label="top item"/>
    17         <menu label="hello" id="nested">
    18           <menupopup>
    19             <menuitem label="item1"/>
    20             <menuitem label="item2" id="item2"/>
    21           </menupopup>
    22         </menu>
    23       </menupopup>
    24     </menu>
    25   </menubar>
    27   <script class="testbody" type="application/javascript">
    28   <![CDATA[
    30   SimpleTest.waitForExplicitFinish();
    32   function runTests()
    33   {
    34     var menu = document.getElementById("nested");
    36     // nsIDOMXULContainerElement::getIndexOfItem();
    37     var item = document.getElementById("item2");
    38     is(menu.getIndexOfItem(item), 1,
    39        "nsIDOMXULContainerElement::getIndexOfItem() failed.");
    41     // nsIDOMXULContainerElement::getItemAtIndex();
    42     var itemAtIdx = menu.getItemAtIndex(1);
    43     is(itemAtIdx, item,
    44        "nsIDOMXULContainerElement::getItemAtIndex() failed.");
    46     // nsIDOMXULContainerElement::itemCount
    47     is(menu.itemCount, 2, "nsIDOMXULContainerElement::itemCount failed.");
    49     // nsIDOMXULContainerElement::parentContainer
    50     var topmenu = document.getElementById("top");
    51     is(menu.parentContainer, topmenu,
    52         "nsIDOMXULContainerElement::parentContainer failed.");
    54     // nsIDOMXULContainerElement::appendItem();
    55     var item = menu.appendItem("item3");
    56     is(menu.getIndexOfItem(item), 2,
    57        "nsIDOMXULContainerElement::appendItem() failed.");
    59     // nsIDOMXULContainerElement::insertItemAt();
    60     var item = menu.insertItemAt(0, "itemZero");
    61     is(item, menu.getItemAtIndex(0),
    62         "nsIDOMXULContainerElement::insertItemAt() failed.");
    64     // nsIDOMXULContainerElement::removeItemAt();
    65     var item = menu.removeItemAt(0);
    66     is(3, menu.itemCount,
    67        "nsIDOMXULContainerElement::removeItemAt() failed.");
    69     SimpleTest.finish();
    70   }
    72   ]]>
    73   </script>
    75   <body xmlns="http://www.w3.org/1999/xhtml">
    76     <p id="display">
    77     </p>
    78     <div id="content" style="display: none">
    79     </div>
    80     <pre id="test">
    81     </pre>
    82   </body>
    84 </window>

mercurial