Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | <?xml version="1.0"?> |
michael@0 | 2 | <?xml-stylesheet href="chrome://global/skin" type="text/css"?> |
michael@0 | 3 | <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?> |
michael@0 | 4 | |
michael@0 | 5 | <window title="Menu Destruction Test" |
michael@0 | 6 | onload="runTests();" |
michael@0 | 7 | xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> |
michael@0 | 8 | |
michael@0 | 9 | <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 10 | <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script> |
michael@0 | 11 | |
michael@0 | 12 | <menubar> |
michael@0 | 13 | <menu label="top" id="top"> |
michael@0 | 14 | <menupopup> |
michael@0 | 15 | <menuitem label="top item"/> |
michael@0 | 16 | |
michael@0 | 17 | <menu label="hello" id="nested"> |
michael@0 | 18 | <menupopup> |
michael@0 | 19 | <menuitem label="item1"/> |
michael@0 | 20 | <menuitem label="item2" id="item2"/> |
michael@0 | 21 | </menupopup> |
michael@0 | 22 | </menu> |
michael@0 | 23 | </menupopup> |
michael@0 | 24 | </menu> |
michael@0 | 25 | </menubar> |
michael@0 | 26 | |
michael@0 | 27 | <script class="testbody" type="application/javascript"> |
michael@0 | 28 | <![CDATA[ |
michael@0 | 29 | |
michael@0 | 30 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 31 | |
michael@0 | 32 | function runTests() |
michael@0 | 33 | { |
michael@0 | 34 | var menu = document.getElementById("nested"); |
michael@0 | 35 | |
michael@0 | 36 | // nsIDOMXULContainerElement::getIndexOfItem(); |
michael@0 | 37 | var item = document.getElementById("item2"); |
michael@0 | 38 | is(menu.getIndexOfItem(item), 1, |
michael@0 | 39 | "nsIDOMXULContainerElement::getIndexOfItem() failed."); |
michael@0 | 40 | |
michael@0 | 41 | // nsIDOMXULContainerElement::getItemAtIndex(); |
michael@0 | 42 | var itemAtIdx = menu.getItemAtIndex(1); |
michael@0 | 43 | is(itemAtIdx, item, |
michael@0 | 44 | "nsIDOMXULContainerElement::getItemAtIndex() failed."); |
michael@0 | 45 | |
michael@0 | 46 | // nsIDOMXULContainerElement::itemCount |
michael@0 | 47 | is(menu.itemCount, 2, "nsIDOMXULContainerElement::itemCount failed."); |
michael@0 | 48 | |
michael@0 | 49 | // nsIDOMXULContainerElement::parentContainer |
michael@0 | 50 | var topmenu = document.getElementById("top"); |
michael@0 | 51 | is(menu.parentContainer, topmenu, |
michael@0 | 52 | "nsIDOMXULContainerElement::parentContainer failed."); |
michael@0 | 53 | |
michael@0 | 54 | // nsIDOMXULContainerElement::appendItem(); |
michael@0 | 55 | var item = menu.appendItem("item3"); |
michael@0 | 56 | is(menu.getIndexOfItem(item), 2, |
michael@0 | 57 | "nsIDOMXULContainerElement::appendItem() failed."); |
michael@0 | 58 | |
michael@0 | 59 | // nsIDOMXULContainerElement::insertItemAt(); |
michael@0 | 60 | var item = menu.insertItemAt(0, "itemZero"); |
michael@0 | 61 | is(item, menu.getItemAtIndex(0), |
michael@0 | 62 | "nsIDOMXULContainerElement::insertItemAt() failed."); |
michael@0 | 63 | |
michael@0 | 64 | // nsIDOMXULContainerElement::removeItemAt(); |
michael@0 | 65 | var item = menu.removeItemAt(0); |
michael@0 | 66 | is(3, menu.itemCount, |
michael@0 | 67 | "nsIDOMXULContainerElement::removeItemAt() failed."); |
michael@0 | 68 | |
michael@0 | 69 | SimpleTest.finish(); |
michael@0 | 70 | } |
michael@0 | 71 | |
michael@0 | 72 | ]]> |
michael@0 | 73 | </script> |
michael@0 | 74 | |
michael@0 | 75 | <body xmlns="http://www.w3.org/1999/xhtml"> |
michael@0 | 76 | <p id="display"> |
michael@0 | 77 | </p> |
michael@0 | 78 | <div id="content" style="display: none"> |
michael@0 | 79 | </div> |
michael@0 | 80 | <pre id="test"> |
michael@0 | 81 | </pre> |
michael@0 | 82 | </body> |
michael@0 | 83 | |
michael@0 | 84 | </window> |
michael@0 | 85 |