From f8901eae3566fd113ecae720fd41a9cfc1aaac04 Mon Sep 17 00:00:00 2001 From: Dave Townsend Date: Thu, 20 Nov 2014 12:13:21 -0800 Subject: [PATCH] Bug 1101999 - Fix/add UITour highlighting for the new search UI. r=florian --- browser/modules/UITour.jsm | 37 +++++++++++++++++++ .../test/browser_UITour_availableTargets.js | 6 +-- .../browser_UITour_panel_close_annotation.js | 2 +- 3 files changed, 41 insertions(+), 4 deletions(-) diff --git a/browser/modules/UITour.jsm b/browser/modules/UITour.jsm index e826532fedf..0b0f486e314 100644 --- a/browser/modules/UITour.jsm +++ b/browser/modules/UITour.jsm @@ -128,12 +128,49 @@ this.UITour = { ["searchProvider", { query: (aDocument) => { let searchbar = aDocument.getElementById("searchbar"); + if (searchbar.hasAttribute("oneoffui")) { + return null; + } return aDocument.getAnonymousElementByAttribute(searchbar, "anonid", "searchbar-engine-button"); }, widgetName: "search-container", }], + ["searchIcon", { + query: (aDocument) => { + let searchbar = aDocument.getElementById("searchbar"); + if (!searchbar.hasAttribute("oneoffui")) { + return null; + } + return aDocument.getAnonymousElementByAttribute(searchbar, + "anonid", + "searchbar-search-button"); + }, + widgetName: "search-container", + }], + ["searchPrefsLink", { + query: (aDocument) => { + let element = null; + let searchbar = aDocument.getElementById("searchbar"); + if (searchbar.hasAttribute("oneoffui")) { + let popup = aDocument.getElementById("PopupSearchAutoComplete"); + if (popup.state != "open") + return null; + element = aDocument.getAnonymousElementByAttribute(popup, + "anonid", + "search-settings"); + } else { + element = aDocument.getAnonymousElementByAttribute(searchbar, + "anonid", + "open-engine-manager"); + } + if (!element || !UITour.isElementVisible(element)) { + return null; + } + return element; + }, + }], ["selectedTabIcon", { query: (aDocument) => { let selectedtab = aDocument.defaultView.gBrowser.selectedTab; diff --git a/browser/modules/test/browser_UITour_availableTargets.js b/browser/modules/test/browser_UITour_availableTargets.js index 256f84f69cf..c602ba84fbc 100644 --- a/browser/modules/test/browser_UITour_availableTargets.js +++ b/browser/modules/test/browser_UITour_availableTargets.js @@ -41,7 +41,7 @@ let tests = [ "privateWindow", "quit", "search", - "searchProvider", + "searchIcon", "urlbar", ...searchEngineTargets(), ...(hasWebIDE ? ["webide"] : []) @@ -72,7 +72,7 @@ let tests = [ "privateWindow", "quit", "search", - "searchProvider", + "searchIcon", "urlbar", ...searchEngineTargets(), ...(hasWebIDE ? ["webide"] : []) @@ -92,7 +92,7 @@ let tests = [ // Make sure the callback still fires with the other available targets. CustomizableUI.removeWidgetFromArea("search-container"); gContentAPI.getConfiguration("availableTargets", (data) => { - // Default minus "search" and "searchProvider" + // Default minus "search" and "searchProvider" and "searchIcon" ok_targets(data, [ "accountStatus", "addons", diff --git a/browser/modules/test/browser_UITour_panel_close_annotation.js b/browser/modules/test/browser_UITour_panel_close_annotation.js index 97b7c75b93c..30440e72a56 100644 --- a/browser/modules/test/browser_UITour_panel_close_annotation.js +++ b/browser/modules/test/browser_UITour_panel_close_annotation.js @@ -60,7 +60,7 @@ let tests = [ function test_highlight_panel_click_find(done) { gContentAPI.showHighlight("help"); - gContentAPI.showInfo("searchProvider", "test title", "test text"); + gContentAPI.showInfo("searchIcon", "test title", "test text"); waitForElementToBeVisible(highlight, function checkPanelIsOpen() { isnot(PanelUI.panel.state, "closed", "Panel should have opened");