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 | |
michael@0 | 4 | <window onload="start()" |
michael@0 | 5 | xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> |
michael@0 | 6 | |
michael@0 | 7 | <script type="application/javascript" |
michael@0 | 8 | src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/> |
michael@0 | 9 | |
michael@0 | 10 | <textbox id="textbox"/> |
michael@0 | 11 | |
michael@0 | 12 | <panel id="panel2" onpopupshown="runTests(this, 2);" onpopuphidden="document.getElementById('panel').hidePopup()"> |
michael@0 | 13 | <textbox id="p2textbox" value="Popup2"/> |
michael@0 | 14 | </panel> |
michael@0 | 15 | <panel id="panel" onpopupshown="runTests(this, 1);" |
michael@0 | 16 | onpopuphidden="done()"> |
michael@0 | 17 | <textbox id="p1textbox" value="Popup1"/> |
michael@0 | 18 | </panel> |
michael@0 | 19 | |
michael@0 | 20 | <browser id="browser" type="content" src="focus_frameset.html" width="500" height="400"/> |
michael@0 | 21 | |
michael@0 | 22 | <script type="application/javascript"> |
michael@0 | 23 | <![CDATA[ |
michael@0 | 24 | |
michael@0 | 25 | var fm = Components.classes["@mozilla.org/focus-manager;1"]. |
michael@0 | 26 | getService(Components.interfaces.nsIFocusManager); |
michael@0 | 27 | |
michael@0 | 28 | function is(l, r, n) { window.opener.wrappedJSObject.SimpleTest.is(l,r,n); } |
michael@0 | 29 | function ok(v, n) { window.opener.wrappedJSObject.SimpleTest.ok(v,n); } |
michael@0 | 30 | |
michael@0 | 31 | function done() |
michael@0 | 32 | { |
michael@0 | 33 | var opener = window.opener; |
michael@0 | 34 | window.close(); |
michael@0 | 35 | opener.wrappedJSObject.SimpleTest.finish(); |
michael@0 | 36 | } |
michael@0 | 37 | |
michael@0 | 38 | function previous(expectedWindow, expectedElement, desc) |
michael@0 | 39 | { |
michael@0 | 40 | synthesizeKey("VK_F6", { shiftKey: true }); |
michael@0 | 41 | is(fm.focusedWindow, expectedWindow, desc); |
michael@0 | 42 | is(fm.focusedElement, expectedElement, desc + " element"); |
michael@0 | 43 | } |
michael@0 | 44 | |
michael@0 | 45 | function next(expectedWindow, expectedElement, desc) |
michael@0 | 46 | { |
michael@0 | 47 | synthesizeKey("VK_F6", { }); |
michael@0 | 48 | is(fm.focusedWindow, expectedWindow, desc); |
michael@0 | 49 | is(fm.focusedElement, expectedElement, desc + " element" + "::" + (fm.focusedElement ? fm.focusedElement.parentNode.id : "<none>")); |
michael@0 | 50 | } |
michael@0 | 51 | |
michael@0 | 52 | // This test runs through three cases. Document navigation forward and |
michael@0 | 53 | // backward using the F6 key when no popups are open, with one popup open and |
michael@0 | 54 | // with two popups open. |
michael@0 | 55 | function runTests(panel, popupCount) |
michael@0 | 56 | { |
michael@0 | 57 | if (!popupCount || popupCount > 2) |
michael@0 | 58 | popupCount = 0; |
michael@0 | 59 | |
michael@0 | 60 | fm.clearFocus(window); |
michael@0 | 61 | |
michael@0 | 62 | var childwin = document.getElementById("browser").contentWindow; |
michael@0 | 63 | |
michael@0 | 64 | if (popupCount) { |
michael@0 | 65 | if (popupCount == 2) { |
michael@0 | 66 | next(window, document.getElementById("p2textbox").inputField, "First into popup 2 with " + popupCount); |
michael@0 | 67 | } |
michael@0 | 68 | |
michael@0 | 69 | next(window, document.getElementById("p1textbox").inputField, "First into popup 1 with " + popupCount); |
michael@0 | 70 | } |
michael@0 | 71 | |
michael@0 | 72 | next(childwin.frames[0], childwin.frames[0].document.documentElement, "First with " + popupCount); |
michael@0 | 73 | next(childwin.frames[1], childwin.frames[1].document.documentElement, "Second with " + popupCount); |
michael@0 | 74 | previous(childwin.frames[0], childwin.frames[0].document.documentElement, "Second back with " + popupCount); |
michael@0 | 75 | |
michael@0 | 76 | if (popupCount) { |
michael@0 | 77 | previous(window, document.getElementById("p1textbox").inputField, "First back from popup 1 with " + popupCount); |
michael@0 | 78 | |
michael@0 | 79 | if (popupCount == 2) { |
michael@0 | 80 | previous(window, document.getElementById("p2textbox").inputField, "First back from popup 2 with " + popupCount); |
michael@0 | 81 | } |
michael@0 | 82 | } |
michael@0 | 83 | |
michael@0 | 84 | previous(window, document.getElementById("textbox").inputField, "First back with " + popupCount); |
michael@0 | 85 | |
michael@0 | 86 | if (panel == document.getElementById("panel")) |
michael@0 | 87 | document.getElementById("panel2").openPopup(null, "after_start", 100, 20); |
michael@0 | 88 | else if (panel == document.getElementById("panel2")) |
michael@0 | 89 | panel.hidePopup(); |
michael@0 | 90 | else |
michael@0 | 91 | document.getElementById("panel").openPopup(null, "after_start"); |
michael@0 | 92 | } |
michael@0 | 93 | |
michael@0 | 94 | function start() |
michael@0 | 95 | { |
michael@0 | 96 | window.opener.wrappedJSObject.SimpleTest.waitForExplicitFinish(); |
michael@0 | 97 | window.opener.wrappedJSObject.SimpleTest.waitForFocus( |
michael@0 | 98 | function() { runTests(null, 0); }, |
michael@0 | 99 | document.getElementById("browser").contentWindow); |
michael@0 | 100 | } |
michael@0 | 101 | |
michael@0 | 102 | ]]></script> |
michael@0 | 103 | |
michael@0 | 104 | </window> |