From f6711e2d954fffb656c911226f5862b3c82d720e Mon Sep 17 00:00:00 2001 From: "Carsten \"Tomcat\" Book" Date: Tue, 3 Feb 2015 15:34:07 +0100 Subject: [PATCH] Backed out changeset a882d834faee (bug 1111947) for causing merge conflicts down from m-c --- browser/components/search/content/search.xml | 2 +- browser/components/search/test/browser.ini | 2 +- .../components/search/test/browser_426329.js | 29 ++++++++++++++++++- .../test/browser_searchbar_openpopup.js | 24 +-------------- 4 files changed, 31 insertions(+), 26 deletions(-) diff --git a/browser/components/search/content/search.xml b/browser/components/search/content/search.xml index c69a1fcb015..a445040a5e2 100644 --- a/browser/components/search/content/search.xml +++ b/browser/components/search/content/search.xml @@ -1256,7 +1256,7 @@ if (data) { event.preventDefault(); this.value = data; - document.getBindingParent(this).openSuggestionsPanel(); + this.onTextEntered(event); } ]]> diff --git a/browser/components/search/test/browser.ini b/browser/components/search/test/browser.ini index 9439cf705d1..72058a3ae27 100644 --- a/browser/components/search/test/browser.ini +++ b/browser/components/search/test/browser.ini @@ -40,4 +40,4 @@ skip-if = e10s # Bug ?????? - some issue with progress listeners [JavaScript Err [browser_abouthome_behavior.js] skip-if = e10s || true # Bug ??????, Bug 1100301 - leaks windows until shutdown when --run-by-dir [browser_searchbar_openpopup.js] -skip-if = os == "linux" || e10s || (os == "win" && os_version == "5.1" && debug) # Linux has different focus behaviours, e10s seems to have timing issues, Windows XP debug fails inexplicably for the test added in bug 1111947. +skip-if = os == "linux" || e10s # Linux has different focus behaviours and e10s seems to have timing issues. diff --git a/browser/components/search/test/browser_426329.js b/browser/components/search/test/browser_426329.js index e9c1a7fef3b..f8d6d2219d8 100644 --- a/browser/components/search/test/browser_426329.js +++ b/browser/components/search/test/browser_426329.js @@ -71,7 +71,7 @@ function* countEntries(name, value) { var searchBar; var searchButton; -var searchEntries = ["test"]; +var searchEntries = ["test", "More Text", "Some Text"]; function* promiseSetEngine() { let deferred = Promise.defer(); var ss = Services.search; @@ -227,6 +227,33 @@ add_task(function testShiftMiddleClick() { is(event.originalTarget.URL, expectedURL(searchBar.value), "testShiftMiddleClick opened correct search page"); }); +add_task(function testDropText() { + yield prepareTest(); + // drop on the search button so that we don't need to worry about the + // default handlers for textboxes. + let searchButton = document.getAnonymousElementByAttribute(searchBar, "anonid", "searchbar-search-button"); + ChromeUtils.synthesizeDrop(searchButton, searchButton, [[ {type: "text/plain", data: "Some Text" } ]], "copy", window); + let event = yield promiseOnLoad(); + is(event.originalTarget.URL, expectedURL(searchBar.value), "testDropText opened correct search page"); + is(searchBar.value, "Some Text", "drop text/plain on searchbar"); +}); + +add_task(function testDropInternalText() { + yield prepareTest(); + let searchButton = document.getAnonymousElementByAttribute(searchBar, "anonid", "searchbar-search-button"); + ChromeUtils.synthesizeDrop(searchButton, searchButton, [[ {type: "text/x-moz-text-internal", data: "More Text" } ]], "copy", window); + let event = yield promiseOnLoad(); + is(event.originalTarget.URL, expectedURL(searchBar.value), "testDropInternalText opened correct search page"); + is(searchBar.value, "More Text", "drop text/x-moz-text-internal on searchbar"); + + // testDropLink implicitly depended on testDropInternalText, so these two tests + // were merged so that if testDropInternalText failed it wouldn't cause testDropLink + // to fail unexplainably. + yield prepareTest(); + ChromeUtils.synthesizeDrop(searchBar.searchButton, searchBar.searchButton, [[ {type: "text/uri-list", data: "http://www.mozilla.org" } ]], "copy", window); + is(searchBar.value, "More Text", "drop text/uri-list on searchbar shouldn't change anything"); +}); + add_task(function testRightClick() { preTabNo = gBrowser.tabs.length; content.location.href = "about:blank"; diff --git a/browser/components/search/test/browser_searchbar_openpopup.js b/browser/components/search/test/browser_searchbar_openpopup.js index 28fd2867ad3..e9ba220924f 100644 --- a/browser/components/search/test/browser_searchbar_openpopup.js +++ b/browser/components/search/test/browser_searchbar_openpopup.js @@ -1,12 +1,5 @@ // Tests that the suggestion popup appears at the right times in response to -// focus and user events (mouse, keyboard, drop). - -// Instead of loading ChromeUtils.js into the test scope in browser-test.js for all tests, -// we only need ChromeUtils.js for a few files which is why we are using loadSubScript. -var ChromeUtils = {}; -this._scriptLoader = Cc["@mozilla.org/moz/jssubscript-loader;1"]. - getService(Ci.mozIJSSubScriptLoader); -this._scriptLoader.loadSubScript("chrome://mochikit/content/tests/SimpleTest/ChromeUtils.js", ChromeUtils); +// focus and clicks. const searchbar = document.getElementById("searchbar"); const searchIcon = document.getAnonymousElementByAttribute(searchbar, "anonid", "searchbar-search-button"); @@ -407,18 +400,3 @@ add_task(function* dont_consume_clicks() { textbox.value = ""; }); - -// Dropping text to the searchbar should open the popup -add_task(function* drop_opens_popup() { - let promise = promiseEvent(searchPopup, "popupshown"); - ChromeUtils.synthesizeDrop(searchIcon, textbox.inputField, [[ {type: "text/plain", data: "foo" } ]], "move", window); - yield promise; - - isnot(searchPopup.getAttribute("showonlysettings"), "true", "Should show the full popup"); - is(Services.focus.focusedElement, textbox.inputField, "Should have focused the search bar"); - promise = promiseEvent(searchPopup, "popuphidden"); - searchPopup.hidePopup(); - yield promise; - - textbox.value = ""; -});