Bug 950014 - [Australis] Ctrl-K no longer goes to home page of default search engine (when search toolbar hidden). r=mconley,gijs

--HG--
extra : rebase_source : 011ff25a2a6ed81e93c45f041ead35d5cf2be82b
This commit is contained in:
Jared Wein 2013-12-17 13:45:00 -05:00
parent 57dfa18eb4
commit 3af4176799
2 changed files with 27 additions and 5 deletions

View File

@ -2950,13 +2950,11 @@ const BrowserSearch = {
openSearchPageIfFieldIsNotActive(searchBar);
};
if (placement && placement.area == CustomizableUI.AREA_PANEL) {
PanelUI.show().then(() => {
// The panel is not constructed until the first time it is shown.
focusSearchBar();
});
// The panel is not constructed until the first time it is shown.
PanelUI.show().then(focusSearchBar);
return;
}
if (placement.area == CustomizableUI.AREA_NAVBAR && searchBar &&
if (placement && placement.area == CustomizableUI.AREA_NAVBAR && searchBar &&
searchBar.parentNode.classList.contains("overflowedItem")) {
let navBar = document.getElementById(CustomizableUI.AREA_NAVBAR);
navBar.overflowable.show().then(() => {

View File

@ -86,6 +86,30 @@ add_task(function() {
is(document.activeElement, searchbar.textbox.inputField, "The searchbar should be focused");
});
// Ctrl+K should open the search page if the search bar has been customized out.
add_task(function() {
this.originalOpenUILinkIn = openUILinkIn;
try {
CustomizableUI.removeWidgetFromArea("search-container");
let placement = CustomizableUI.getPlacementOfWidget("search-container");
is(placement, null, "Search container should be in palette");
let openUILinkInCalled = false;
openUILinkIn = (aUrl, aWhichTab) => {
is(aUrl, Services.search.defaultEngine.searchForm, "Search page should be requested to open.");
is(aWhichTab, "current", "Should use the current tab for the search page.");
openUILinkInCalled = true;
};
sendWebSearchKeyCommand();
yield waitForCondition(function() openUILinkInCalled);
ok(openUILinkInCalled, "The search page should have been opened.")
} catch (e) {
ok(false, e);
}
openUILinkIn = this.originalOpenUILinkIn;
CustomizableUI.reset();
});
function sendWebSearchKeyCommand() {
if (Services.appinfo.OS === "Darwin")
EventUtils.synthesizeKey("k", { accelKey: true });