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/ */
4 let cw;
6 function test() {
7 waitForExplicitFinish();
9 showTabView(function() {
10 cw = TabView.getContentWindow();
12 whenSearchIsEnabled(function() {
13 ok(cw.Search.isEnabled(), "The search is disabled");
15 // open a new window and it would have the focus
16 newWindowWithTabView(function(win) {
17 registerCleanupFunction(function() {
18 win.close();
19 hideTabView();
20 });
21 testClickOnSearchShade(win);
22 });
23 });
25 EventUtils.synthesizeKey("VK_SLASH", {}, cw);
26 });
27 }
29 function testClickOnSearchShade(win) {
30 // click on the window with search enabled.
31 let searchshade = cw.document.getElementById("searchshade");
32 EventUtils.sendMouseEvent({ type: "click" }, searchshade, cw);
34 waitForFocus(function() {
35 ok(cw.Search.isEnabled(), "The search is still enabled after the search shade is clicked");
36 testFocusInactiveWindow(win, cw);
37 });
38 }
40 function testFocusInactiveWindow(win) {
41 win.focus();
42 // focus inactive window
43 window.focus();
45 // need to use exeuteSoon as the _blockClick would be set to false after a setTimeout(,0)
46 executeSoon(function() {
47 ok(cw.Search.isEnabled(), "The search is still enabled when inactive window has focus");
49 whenSearchIsDisabled(function() {
50 hideTabView(finish);
51 });
53 let searchshade = cw.document.getElementById("searchshade");
54 EventUtils.synthesizeMouseAtCenter(searchshade, {}, cw);
55 });
56 }