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 | function test() { |
michael@0 | 5 | waitForExplicitFinish(); |
michael@0 | 6 | |
michael@0 | 7 | window.addEventListener("tabviewshown", onTabViewWindowLoaded, false); |
michael@0 | 8 | TabView.toggle(); |
michael@0 | 9 | } |
michael@0 | 10 | |
michael@0 | 11 | function onTabViewWindowLoaded() { |
michael@0 | 12 | window.removeEventListener("tabviewshown", onTabViewWindowLoaded, false); |
michael@0 | 13 | |
michael@0 | 14 | let contentWindow = document.getElementById("tab-view").contentWindow; |
michael@0 | 15 | let number = -1; |
michael@0 | 16 | |
michael@0 | 17 | let onSearchEnabled = function() { |
michael@0 | 18 | // ensure the dom changes (textbox get focused with number entered) complete |
michael@0 | 19 | // before doing a check. |
michael@0 | 20 | executeSoon(function() { |
michael@0 | 21 | let searchBox = contentWindow.document.getElementById("searchbox"); |
michael@0 | 22 | is(searchBox.value, number, "The seach box matches the number: " + number); |
michael@0 | 23 | contentWindow.Search.hide(null); |
michael@0 | 24 | }); |
michael@0 | 25 | } |
michael@0 | 26 | let onSearchDisabled = function() { |
michael@0 | 27 | if (++number <= 9) { |
michael@0 | 28 | EventUtils.synthesizeKey(String(number), { }, contentWindow); |
michael@0 | 29 | } else { |
michael@0 | 30 | contentWindow.removeEventListener( |
michael@0 | 31 | "tabviewsearchenabled", onSearchEnabled, false); |
michael@0 | 32 | contentWindow.removeEventListener( |
michael@0 | 33 | "tabviewsearchdisabled", onSearchDisabled, false); |
michael@0 | 34 | |
michael@0 | 35 | let endGame = function() { |
michael@0 | 36 | window.removeEventListener("tabviewhidden", endGame, false); |
michael@0 | 37 | |
michael@0 | 38 | ok(!TabView.isVisible(), "Tab View is hidden"); |
michael@0 | 39 | finish(); |
michael@0 | 40 | } |
michael@0 | 41 | window.addEventListener("tabviewhidden", endGame, false); |
michael@0 | 42 | TabView.toggle(); |
michael@0 | 43 | } |
michael@0 | 44 | } |
michael@0 | 45 | contentWindow.addEventListener( |
michael@0 | 46 | "tabviewsearchenabled", onSearchEnabled, false); |
michael@0 | 47 | contentWindow.addEventListener( |
michael@0 | 48 | "tabviewsearchdisabled", onSearchDisabled, false); |
michael@0 | 49 | |
michael@0 | 50 | onSearchDisabled(); |
michael@0 | 51 | } |
michael@0 | 52 |