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 /**
5 * Make sure that the searchbox popup is displayed when focusing the searchbox,
6 * and hidden when the user starts typing.
7 */
9 const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html";
11 let gTab, gDebuggee, gPanel, gDebugger;
12 let gSearchBox, gSearchBoxPanel;
14 function test() {
15 initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
16 gTab = aTab;
17 gDebuggee = aDebuggee;
18 gPanel = aPanel;
19 gDebugger = gPanel.panelWin;
20 gSearchBox = gDebugger.DebuggerView.Filtering._searchbox;
21 gSearchBoxPanel = gDebugger.DebuggerView.Filtering._searchboxHelpPanel;
23 waitForSourceAndCaretAndScopes(gPanel, "-02.js", 1)
24 .then(showPopup)
25 .then(hidePopup)
26 .then(() => resumeDebuggerThenCloseAndFinish(gPanel))
27 .then(null, aError => {
28 ok(false, "Got an error: " + aError.message + "\n" + aError.stack);
29 });
31 gDebuggee.firstCall();
32 });
33 }
35 function showPopup() {
36 is(gSearchBoxPanel.state, "closed",
37 "The search box panel shouldn't be visible yet.");
39 let finished = once(gSearchBoxPanel, "popupshown");
40 EventUtils.sendMouseEvent({ type: "click" }, gSearchBox, gDebugger);
41 return finished;
42 }
44 function hidePopup() {
45 is(gSearchBoxPanel.state, "open",
46 "The search box panel should be visible after searching started.");
48 let finished = once(gSearchBoxPanel, "popuphidden");
49 setText(gSearchBox, "#");
50 return finished;
51 }
53 registerCleanupFunction(function() {
54 gTab = null;
55 gDebuggee = null;
56 gPanel = null;
57 gDebugger = null;
58 gSearchBox = null;
59 gSearchBoxPanel = null;
60 });