accessible/tests/mochitest/events/test_focus_browserui.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.

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"
michael@0 4 type="text/css"?>
michael@0 5
michael@0 6 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
michael@0 7 title="Accessibility Loading Document Events Test.">
michael@0 8
michael@0 9 <script type="application/javascript"
michael@0 10 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
michael@0 11 <script type="application/javascript"
michael@0 12 src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
michael@0 13
michael@0 14 <script type="application/javascript"
michael@0 15 src="../common.js"></script>
michael@0 16 <script type="application/javascript"
michael@0 17 src="../role.js"></script>
michael@0 18 <script type="application/javascript"
michael@0 19 src="../states.js"></script>
michael@0 20 <script type="application/javascript"
michael@0 21 src="../events.js"></script>
michael@0 22 <script type="application/javascript"
michael@0 23 src="../browser.js"></script>
michael@0 24
michael@0 25 <script type="application/javascript">
michael@0 26 <![CDATA[
michael@0 27 ////////////////////////////////////////////////////////////////////////////
michael@0 28 // Helpers
michael@0 29
michael@0 30 function inputInDocument()
michael@0 31 {
michael@0 32 var tabdoc = currentTabDocument();
michael@0 33 return tabdoc.getElementById("input");
michael@0 34 }
michael@0 35
michael@0 36 ////////////////////////////////////////////////////////////////////////////
michael@0 37 // Invokers
michael@0 38
michael@0 39 function loadURI(aURI)
michael@0 40 {
michael@0 41 this.invoke = function loadURI_invoke()
michael@0 42 {
michael@0 43 tabBrowser().loadURI(aURI);
michael@0 44 }
michael@0 45
michael@0 46 this.eventSeq = [
michael@0 47 new focusChecker(currentTabDocument)
michael@0 48 ];
michael@0 49
michael@0 50 this.getID = function loadURI_getID()
michael@0 51 {
michael@0 52 return "load uri " + aURI;
michael@0 53 }
michael@0 54 }
michael@0 55
michael@0 56 function goBack()
michael@0 57 {
michael@0 58 this.invoke = function goBack_invoke()
michael@0 59 {
michael@0 60 tabBrowser().goBack();
michael@0 61 }
michael@0 62
michael@0 63 this.eventSeq = [
michael@0 64 new focusChecker(inputInDocument)
michael@0 65 ];
michael@0 66
michael@0 67 this.getID = function goBack_getID()
michael@0 68 {
michael@0 69 return "go back one page in history ";
michael@0 70 }
michael@0 71 }
michael@0 72
michael@0 73 ////////////////////////////////////////////////////////////////////////////
michael@0 74 // Testing
michael@0 75
michael@0 76 var gInputDocURI = "data:text/html,<html><input id='input'></html>";
michael@0 77 var gButtonDocURI = "data:text/html,<html><input id='input' type='button' value='button'></html>";
michael@0 78
michael@0 79 //gA11yEventDumpToConsole = true; // debug
michael@0 80
michael@0 81 var gQueue = null;
michael@0 82 function doTests()
michael@0 83 {
michael@0 84 gQueue = new eventQueue();
michael@0 85
michael@0 86 var tabDocument = currentTabDocument();
michael@0 87 var input = inputInDocument();
michael@0 88
michael@0 89 // move focus to input inside tab document
michael@0 90 gQueue.push(new synthTab(tabDocument, new focusChecker(input),
michael@0 91 browserWindow()));
michael@0 92
michael@0 93 // open new url, focus moves to new document
michael@0 94 gQueue.push(new loadURI(gButtonDocURI));
michael@0 95
michael@0 96 // back one page in history, moves moves on input of tab document
michael@0 97 gQueue.push(new goBack());
michael@0 98
michael@0 99 if (!MAC) {
michael@0 100 // open new tab, focus moves to urlbar
michael@0 101 gQueue.push(new synthKey(tabDocument, "t", { ctrlKey: true, window: browserWindow() },
michael@0 102 new focusChecker(urlbarInput)));
michael@0 103
michael@0 104 // close open tab, focus goes on input of tab document
michael@0 105 gQueue.push(new synthKey(tabDocument, "w", { ctrlKey: true, window: browserWindow() },
michael@0 106 new focusChecker(inputInDocument)));
michael@0 107 } else {
michael@0 108 todo(false, "Reenable on Mac after fixing bug 746178!");
michael@0 109 }
michael@0 110
michael@0 111 gQueue.onFinish = function()
michael@0 112 {
michael@0 113 closeBrowserWindow();
michael@0 114 }
michael@0 115 gQueue.invoke();
michael@0 116 }
michael@0 117
michael@0 118 if (navigator.oscpu.startsWith("Windows NT 6.1") || navigator.oscpu.startsWith("Windows NT 6.2")) {
michael@0 119 todo(false, "fix the leak!");
michael@0 120 } else {
michael@0 121 SimpleTest.waitForExplicitFinish();
michael@0 122 openBrowserWindow(doTests, gInputDocURI);
michael@0 123 }
michael@0 124 ]]>
michael@0 125 </script>
michael@0 126
michael@0 127 <vbox flex="1" style="overflow: auto;">
michael@0 128 <body xmlns="http://www.w3.org/1999/xhtml">
michael@0 129 <a target="_blank"
michael@0 130 href="https://bugzilla.mozilla.org/show_bug.cgi?id=644452"
michael@0 131 title="Focus not set when switching to cached document with back or forward if anything other than the document was last focused">
michael@0 132 Mozilla Bug 644452
michael@0 133 </a>
michael@0 134 <a target="_blank"
michael@0 135 href="https://bugzilla.mozilla.org/show_bug.cgi?id=665412"
michael@0 136 title="Broken focus when returning to editable text field after closing a tab while focused in the Navigation toolbar">
michael@0 137 Mozilla Bug 665412
michael@0 138 </a>
michael@0 139 <a target="_blank"
michael@0 140 href="https://bugzilla.mozilla.org/show_bug.cgi?id=673958"
michael@0 141 title="Rework accessible focus handling">
michael@0 142 Mozilla Bug 673958
michael@0 143 </a>
michael@0 144 <p id="display"></p>
michael@0 145 <div id="content" style="display: none">
michael@0 146 </div>
michael@0 147 <pre id="test">
michael@0 148 </pre>
michael@0 149 </body>
michael@0 150
michael@0 151 <vbox id="eventdump"></vbox>
michael@0 152 </vbox>
michael@0 153 </window>

mercurial