1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/accessible/tests/mochitest/events/test_focus_browserui.xul Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,153 @@ 1.4 +<?xml version="1.0"?> 1.5 +<?xml-stylesheet href="chrome://global/skin" type="text/css"?> 1.6 +<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" 1.7 + type="text/css"?> 1.8 + 1.9 +<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" 1.10 + title="Accessibility Loading Document Events Test."> 1.11 + 1.12 + <script type="application/javascript" 1.13 + src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" /> 1.14 + <script type="application/javascript" 1.15 + src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script> 1.16 + 1.17 + <script type="application/javascript" 1.18 + src="../common.js"></script> 1.19 + <script type="application/javascript" 1.20 + src="../role.js"></script> 1.21 + <script type="application/javascript" 1.22 + src="../states.js"></script> 1.23 + <script type="application/javascript" 1.24 + src="../events.js"></script> 1.25 + <script type="application/javascript" 1.26 + src="../browser.js"></script> 1.27 + 1.28 + <script type="application/javascript"> 1.29 + <![CDATA[ 1.30 + //////////////////////////////////////////////////////////////////////////// 1.31 + // Helpers 1.32 + 1.33 + function inputInDocument() 1.34 + { 1.35 + var tabdoc = currentTabDocument(); 1.36 + return tabdoc.getElementById("input"); 1.37 + } 1.38 + 1.39 + //////////////////////////////////////////////////////////////////////////// 1.40 + // Invokers 1.41 + 1.42 + function loadURI(aURI) 1.43 + { 1.44 + this.invoke = function loadURI_invoke() 1.45 + { 1.46 + tabBrowser().loadURI(aURI); 1.47 + } 1.48 + 1.49 + this.eventSeq = [ 1.50 + new focusChecker(currentTabDocument) 1.51 + ]; 1.52 + 1.53 + this.getID = function loadURI_getID() 1.54 + { 1.55 + return "load uri " + aURI; 1.56 + } 1.57 + } 1.58 + 1.59 + function goBack() 1.60 + { 1.61 + this.invoke = function goBack_invoke() 1.62 + { 1.63 + tabBrowser().goBack(); 1.64 + } 1.65 + 1.66 + this.eventSeq = [ 1.67 + new focusChecker(inputInDocument) 1.68 + ]; 1.69 + 1.70 + this.getID = function goBack_getID() 1.71 + { 1.72 + return "go back one page in history "; 1.73 + } 1.74 + } 1.75 + 1.76 + //////////////////////////////////////////////////////////////////////////// 1.77 + // Testing 1.78 + 1.79 + var gInputDocURI = "data:text/html,<html><input id='input'></html>"; 1.80 + var gButtonDocURI = "data:text/html,<html><input id='input' type='button' value='button'></html>"; 1.81 + 1.82 + //gA11yEventDumpToConsole = true; // debug 1.83 + 1.84 + var gQueue = null; 1.85 + function doTests() 1.86 + { 1.87 + gQueue = new eventQueue(); 1.88 + 1.89 + var tabDocument = currentTabDocument(); 1.90 + var input = inputInDocument(); 1.91 + 1.92 + // move focus to input inside tab document 1.93 + gQueue.push(new synthTab(tabDocument, new focusChecker(input), 1.94 + browserWindow())); 1.95 + 1.96 + // open new url, focus moves to new document 1.97 + gQueue.push(new loadURI(gButtonDocURI)); 1.98 + 1.99 + // back one page in history, moves moves on input of tab document 1.100 + gQueue.push(new goBack()); 1.101 + 1.102 +if (!MAC) { 1.103 + // open new tab, focus moves to urlbar 1.104 + gQueue.push(new synthKey(tabDocument, "t", { ctrlKey: true, window: browserWindow() }, 1.105 + new focusChecker(urlbarInput))); 1.106 + 1.107 + // close open tab, focus goes on input of tab document 1.108 + gQueue.push(new synthKey(tabDocument, "w", { ctrlKey: true, window: browserWindow() }, 1.109 + new focusChecker(inputInDocument))); 1.110 +} else { 1.111 + todo(false, "Reenable on Mac after fixing bug 746178!"); 1.112 +} 1.113 + 1.114 + gQueue.onFinish = function() 1.115 + { 1.116 + closeBrowserWindow(); 1.117 + } 1.118 + gQueue.invoke(); 1.119 + } 1.120 + 1.121 + if (navigator.oscpu.startsWith("Windows NT 6.1") || navigator.oscpu.startsWith("Windows NT 6.2")) { 1.122 + todo(false, "fix the leak!"); 1.123 + } else { 1.124 + SimpleTest.waitForExplicitFinish(); 1.125 + openBrowserWindow(doTests, gInputDocURI); 1.126 + } 1.127 + ]]> 1.128 + </script> 1.129 + 1.130 + <vbox flex="1" style="overflow: auto;"> 1.131 + <body xmlns="http://www.w3.org/1999/xhtml"> 1.132 + <a target="_blank" 1.133 + href="https://bugzilla.mozilla.org/show_bug.cgi?id=644452" 1.134 + title="Focus not set when switching to cached document with back or forward if anything other than the document was last focused"> 1.135 + Mozilla Bug 644452 1.136 + </a> 1.137 + <a target="_blank" 1.138 + href="https://bugzilla.mozilla.org/show_bug.cgi?id=665412" 1.139 + title="Broken focus when returning to editable text field after closing a tab while focused in the Navigation toolbar"> 1.140 + Mozilla Bug 665412 1.141 + </a> 1.142 + <a target="_blank" 1.143 + href="https://bugzilla.mozilla.org/show_bug.cgi?id=673958" 1.144 + title="Rework accessible focus handling"> 1.145 + Mozilla Bug 673958 1.146 + </a> 1.147 + <p id="display"></p> 1.148 + <div id="content" style="display: none"> 1.149 + </div> 1.150 + <pre id="test"> 1.151 + </pre> 1.152 + </body> 1.153 + 1.154 + <vbox id="eventdump"></vbox> 1.155 + </vbox> 1.156 +</window>