michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: let cw; michael@0: michael@0: function test() { michael@0: waitForExplicitFinish(); michael@0: michael@0: showTabView(function() { michael@0: cw = TabView.getContentWindow(); michael@0: michael@0: whenSearchIsEnabled(function() { michael@0: ok(cw.Search.isEnabled(), "The search is disabled"); michael@0: michael@0: // open a new window and it would have the focus michael@0: newWindowWithTabView(function(win) { michael@0: registerCleanupFunction(function() { michael@0: win.close(); michael@0: hideTabView(); michael@0: }); michael@0: testClickOnSearchShade(win); michael@0: }); michael@0: }); michael@0: michael@0: EventUtils.synthesizeKey("VK_SLASH", {}, cw); michael@0: }); michael@0: } michael@0: michael@0: function testClickOnSearchShade(win) { michael@0: // click on the window with search enabled. michael@0: let searchshade = cw.document.getElementById("searchshade"); michael@0: EventUtils.sendMouseEvent({ type: "click" }, searchshade, cw); michael@0: michael@0: waitForFocus(function() { michael@0: ok(cw.Search.isEnabled(), "The search is still enabled after the search shade is clicked"); michael@0: testFocusInactiveWindow(win, cw); michael@0: }); michael@0: } michael@0: michael@0: function testFocusInactiveWindow(win) { michael@0: win.focus(); michael@0: // focus inactive window michael@0: window.focus(); michael@0: michael@0: // need to use exeuteSoon as the _blockClick would be set to false after a setTimeout(,0) michael@0: executeSoon(function() { michael@0: ok(cw.Search.isEnabled(), "The search is still enabled when inactive window has focus"); michael@0: michael@0: whenSearchIsDisabled(function() { michael@0: hideTabView(finish); michael@0: }); michael@0: michael@0: let searchshade = cw.document.getElementById("searchshade"); michael@0: EventUtils.synthesizeMouseAtCenter(searchshade, {}, cw); michael@0: }); michael@0: } michael@0: