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