$OpenBSD$ index 932d3d2..ab078fc 100644 --- browser/components/search/test/browser_google_behavior.js.orig Fri Feb 20 15:40:36 2015 +++ browser/components/search/test/browser_google_behavior.js Fri Feb 20 15:40:36 2015 @@ -7,52 +7,14 @@ "use strict"; -const BROWSER_SEARCH_PREF = "browser.search."; - -const MOZ_PARAM_LOCALE = /\{moz:locale\}/g; -const MOZ_PARAM_DIST_ID = /\{moz:distributionID\}/g; -const MOZ_PARAM_OFFICIAL = /\{moz:official\}/g; - -let runtime = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime); -// Custom search parameters -const MOZ_OFFICIAL = runtime.isOfficialBranding ? "official" : "unofficial"; - -var google_client; -switch (runtime.defaultUpdateChannel) { -case "beta": - google_client = "firefox-beta"; - break; -case "aurora": - google_client = "firefox-aurora"; - break; -case "nightly": - google_client = "firefox-nightly"; - break; -default: - google_client = "firefox-a"; - break; -} - -const GOOGLE_CLIENT = google_client; -const MOZ_DISTRIBUTION_ID = runtime.distributionID; - function test() { let engine = Services.search.getEngineByName("Google"); ok(engine, "Google is installed"); - is(Services.search.defaultEngine, engine, "Check that Google is the default search engine"); - - let distributionID; - try { - distributionID = Services.prefs.getCharPref(BROWSER_SEARCH_PREF + "distributionID"); - } catch (ex) { - distributionID = MOZ_DISTRIBUTION_ID; - } + let previouslySelectedEngine = Services.search.currentEngine; + Services.search.currentEngine = engine; - let base = "https://www.google.com/search?q=foo&ie=utf-8&oe=utf-8&aq=t&rls={moz:distributionID}:{moz:locale}:{moz:official}&client=" + GOOGLE_CLIENT; - base = base.replace(MOZ_PARAM_LOCALE, getLocale()); - base = base.replace(MOZ_PARAM_DIST_ID, distributionID); - base = base.replace(MOZ_PARAM_OFFICIAL, MOZ_OFFICIAL); + let base = "https://www.google.com/search?q=foo&ie=utf-8&oe=utf-8"; let url; @@ -66,7 +28,7 @@ function test() { var gTests = [ { name: "context menu search", - searchURL: base + "&channel=rcs", + searchURL: base, run: function () { // Simulate a contextmenu search // FIXME: This is a bit "low-level"... @@ -75,7 +37,7 @@ function test() { }, { name: "keyword search", - searchURL: base + "&channel=fflb", + searchURL: base, run: function () { gURLBar.value = "? foo"; gURLBar.focus(); @@ -84,7 +46,7 @@ function test() { }, { name: "search bar search", - searchURL: base + "&channel=sb", + searchURL: base, run: function () { let sb = BrowserSearch.searchBar; sb.focus(); @@ -97,7 +59,7 @@ function test() { }, { name: "new tab search", - searchURL: base + "&channel=nts", + searchURL: base, run: function () { function doSearch(doc) { // Re-add the listener, and perform a search @@ -141,7 +103,7 @@ function test() { }, { name: "home page search", - searchURL: base + "&channel=np&source=hp", + searchURL: base, run: function () { // Bug 992270: Ignore uncaught about:home exceptions (related to snippets from IndexedDB) ignoreAllUncaughtExceptions(true); @@ -216,6 +178,7 @@ function test() { registerCleanupFunction(function () { gBrowser.removeProgressListener(listener); gBrowser.removeTab(tab); + Services.search.currentEngine = previouslySelectedEngine; }); tab.linkedBrowser.addEventListener("load", function load() {