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.
1 /* Any copyright is dedicated to the Public Domain.
2 * http://creativecommons.org/publicdomain/zero/1.0/
3 */
5 // Bug 570760 - Make ctrl-f and / focus the search box in the add-ons manager
7 var gManagerWindow;
8 var focusCount = 0;
10 function test() {
11 waitForExplicitFinish();
13 open_manager(null, function(aWindow) {
14 gManagerWindow = aWindow;
16 var searchBox = gManagerWindow.document.getElementById("header-search");
17 function focusHandler() {
18 searchBox.blur();
19 focusCount++;
20 }
21 searchBox.addEventListener("focus", focusHandler);
22 f_key_test();
23 slash_key_test();
24 searchBox.removeEventListener("focus", focusHandler);
25 end_test();
26 });
27 }
29 function end_test() {
30 close_manager(gManagerWindow, finish);
31 }
33 function f_key_test() {
34 EventUtils.synthesizeKey("f", { accelKey: true }, gManagerWindow);
35 is(focusCount, 1, "Search box should have been focused due to the f key");
36 }
38 function slash_key_test() {
39 EventUtils.synthesizeKey("/", { }, gManagerWindow);
40 is(focusCount, 2, "Search box should have been focused due to the / key");
41 }