Backed out 3 changesets (bug 1308931) for failing browser_901207_searchbar_in_panel.js, browser_urlbarFocusedCmdK.js and browser_urlbarHashChangeProxyState.js. r=backout

Backed out changeset eab68afb0708 (bug 1308931)
Backed out changeset 8109faaf35c0 (bug 1308931)
Backed out changeset 992fa87b5fbe (bug 1308931)
This commit is contained in:
Sebastian Hengst 2016-10-29 17:17:54 +02:00
Родитель 922fdc6852
Коммит 5d794a611f
5 изменённых файлов: 63 добавлений и 22 удалений

Просмотреть файл

@ -3644,9 +3644,17 @@ const BrowserSearch = {
return;
}
let focusUrlBarIfSearchFieldIsNotActive = function(aSearchBar) {
let openSearchPageIfFieldIsNotActive = function(aSearchBar) {
if (!aSearchBar || document.activeElement != aSearchBar.textbox.inputField) {
focusAndSelectUrlBar();
let url = gBrowser.currentURI.spec.toLowerCase();
let mm = gBrowser.selectedBrowser.messageManager;
let newTabRemoted = Services.prefs.getBoolPref("browser.newtabpage.remote");
let localNewTabEnabled = url === "about:newtab" && !newTabRemoted && NewTabUtils.allPages.enabled;
if (url === "about:home" || localNewTabEnabled) {
ContentSearch.focusInput(mm);
} else {
openUILinkIn("about:home", "current");
}
}
};
@ -3655,7 +3663,7 @@ const BrowserSearch = {
let focusSearchBar = () => {
searchBar = this.searchBar;
searchBar.select();
focusUrlBarIfSearchFieldIsNotActive(searchBar);
openSearchPageIfFieldIsNotActive(searchBar);
};
if (placement && placement.area == CustomizableUI.AREA_PANEL) {
// The panel is not constructed until the first time it is shown.
@ -3675,7 +3683,7 @@ const BrowserSearch = {
FullScreen.showNavToolbox();
searchBar.select();
}
focusUrlBarIfSearchFieldIsNotActive(searchBar);
openSearchPageIfFieldIsNotActive(searchBar);
},
/**

Просмотреть файл

@ -475,6 +475,34 @@ add_task(function* () {
});
});
add_task(function* () {
info("Cmd+k should focus the search box in the page when the search box in the toolbar is absent");
// Remove the search bar from toolbar
CustomizableUI.removeWidgetFromArea("search-container");
yield BrowserTestUtils.withNewTab({ gBrowser, url: "about:home" }, function* (browser) {
yield BrowserTestUtils.synthesizeMouseAtCenter("#brandLogo", {}, browser);
yield ContentTask.spawn(browser, null, function* () {
let doc = content.document;
isnot(doc.getElementById("searchText"), doc.activeElement,
"Search input should not be the active element.");
});
EventUtils.synthesizeKey("k", { accelKey: true });
yield ContentTask.spawn(browser, null, function* () {
let doc = content.document;
let searchInput = doc.getElementById("searchText");
yield ContentTaskUtils.waitForCondition(() => doc.activeElement === searchInput,
"Search input should be the active element.");
});
});
CustomizableUI.reset();
});
add_task(function* () {
info("Cmd+k should focus the search box in the toolbar when it's present");

Просмотреть файл

@ -178,6 +178,29 @@ add_task(function* () {
"Search suggestion table hidden");
});
// Remove the search bar from toolbar
CustomizableUI.removeWidgetFromArea("search-container");
// Focus a different element than the search input from the page.
yield BrowserTestUtils.synthesizeMouseAtCenter("#newtab-customize-button", { }, gBrowser.selectedBrowser);
yield ContentTask.spawn(gBrowser.selectedBrowser, { }, function* () {
let input = content.document.getElementById("newtab-search-text");
Assert.notEqual(input, content.document.activeElement, "Search input should not be focused");
});
// Test that Ctrl/Cmd + K will focus the input field from the page.
let focusPromise = promiseSearchEvents(["FocusInput"]);
EventUtils.synthesizeKey("k", { accelKey: true });
yield focusPromise;
yield ContentTask.spawn(gBrowser.selectedBrowser, { }, function* () {
let input = content.document.getElementById("newtab-search-text");
Assert.equal(input, content.document.activeElement, "Search input should be focused");
});
// Reset changes made to toolbar
CustomizableUI.reset();
// Test that Ctrl/Cmd + K will focus the search bar from toolbar.
EventUtils.synthesizeKey("k", { accelKey: true });
let searchBar = document.getElementById("searchbar");

Просмотреть файл

@ -55,7 +55,6 @@ support-files =
[browser_urlbarEnter.js]
[browser_urlbarEnterAfterMouseOver.js]
skip-if = os == "linux" # Bug 1073339 - Investigate autocomplete test unreliability on Linux/e10s
[browser_urlbarFocusedCmdK.js]
[browser_urlbarHashChangeProxyState.js]
[browser_urlbarKeepStateAcrossTabSwitches.js]
[browser_urlbarOneOffs.js]

Просмотреть файл

@ -1,17 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
add_task(function*() {
// Remove the search bar from toolbar
CustomizableUI.removeWidgetFromArea("search-container");
// Test that Ctrl/Cmd + K will focus the url bar
yield EventUtils.synthesizeKey("k", { accelKey: true });
yield BrowserTestUtils.waitForEvent(gURLBar, "focus");
Assert.equal(document.activeElement, gURLBar.inputField, "URL Bar should be focused");
// Reset changes made to toolbar
CustomizableUI.reset();
});