From 29b4b129c5774dcc0a7efba6e4f7c68dea5cc62d Mon Sep 17 00:00:00 2001 From: Mark Banner Date: Fri, 31 May 2019 12:56:59 +0000 Subject: [PATCH] Bug 1555661 - Fix client code inclusion in Google urls. r=daleharvey Differential Revision: https://phabricator.services.mozilla.com/D33157 --HG-- extra : moz-landing-system : lando --- CLOBBER | 2 +- .../google/_locales/2018/messages.json | 26 ------------------- .../google/_locales/b-1-d/messages.json | 5 +++- .../google/_locales/b-1-e/messages.json | 5 +++- .../google/_locales/b-d/messages.json | 5 +++- .../google/_locales/b-e/messages.json | 5 +++- .../google/_locales/en/messages.json | 14 +++++----- .../search/extensions/google/manifest.json | 14 +--------- .../searchconfigs/head_searchconfig.js | 7 ++++- 9 files changed, 30 insertions(+), 53 deletions(-) delete mode 100644 browser/components/search/extensions/google/_locales/2018/messages.json diff --git a/CLOBBER b/CLOBBER index 3f6f0c390eed..298b60709066 100644 --- a/CLOBBER +++ b/CLOBBER @@ -22,4 +22,4 @@ # changes to stick? As of bug 928195, this shouldn't be necessary! Please # don't change CLOBBER for WebIDL changes any more. -Bug 1551084 - Part 2. Make QCMS transform files use C++. r=miko +Bug 1555661 - Clobber due to search engine file removals (bug 1552120) diff --git a/browser/components/search/extensions/google/_locales/2018/messages.json b/browser/components/search/extensions/google/_locales/2018/messages.json deleted file mode 100644 index c751e246b44a..000000000000 --- a/browser/components/search/extensions/google/_locales/2018/messages.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "extensionName": { - "message": "Google" - }, - "extensionDescription": { - "message": "Google Search" - }, - "searchUrl": { - "message": "https://www.google.com/search" - }, - "searchForm": { - "message": "https://www.google.com/search?q={searchTerms}" - }, - "suggestUrl": { - "message": "https://www.google.com/complete/search?client=firefox&q={searchTerms}" - }, - "searchUrlGetParams": { - "message": "q={searchTerms}" - }, - "param_keyword": { - "message": "firefox-b-1-ab" - }, - "param_searchbar": { - "message": "firefox-b-1" - } -} \ No newline at end of file diff --git a/browser/components/search/extensions/google/_locales/b-1-d/messages.json b/browser/components/search/extensions/google/_locales/b-1-d/messages.json index b0c851767bd9..1b9d05307d64 100644 --- a/browser/components/search/extensions/google/_locales/b-1-d/messages.json +++ b/browser/components/search/extensions/google/_locales/b-1-d/messages.json @@ -16,5 +16,8 @@ }, "searchUrlGetParams": { "message": "client=firefox-b-1-d&q={searchTerms}" + }, + "channelPref": { + "message": "google_channel_us" } -} \ No newline at end of file +} diff --git a/browser/components/search/extensions/google/_locales/b-1-e/messages.json b/browser/components/search/extensions/google/_locales/b-1-e/messages.json index 196180c47ee6..b470cd844331 100644 --- a/browser/components/search/extensions/google/_locales/b-1-e/messages.json +++ b/browser/components/search/extensions/google/_locales/b-1-e/messages.json @@ -16,5 +16,8 @@ }, "searchUrlGetParams": { "message": "client=firefox-b-1-e&q={searchTerms}" + }, + "channelPref": { + "message": "google_channel_us" } -} \ No newline at end of file +} diff --git a/browser/components/search/extensions/google/_locales/b-d/messages.json b/browser/components/search/extensions/google/_locales/b-d/messages.json index 86378bd279f8..a6423089d9f9 100644 --- a/browser/components/search/extensions/google/_locales/b-d/messages.json +++ b/browser/components/search/extensions/google/_locales/b-d/messages.json @@ -16,5 +16,8 @@ }, "searchUrlGetParams": { "message": "client=firefox-b-d&q={searchTerms}" + }, + "channelPref": { + "message": "google_channel_row" } -} \ No newline at end of file +} diff --git a/browser/components/search/extensions/google/_locales/b-e/messages.json b/browser/components/search/extensions/google/_locales/b-e/messages.json index fb9b351bbc98..70939ee00074 100644 --- a/browser/components/search/extensions/google/_locales/b-e/messages.json +++ b/browser/components/search/extensions/google/_locales/b-e/messages.json @@ -16,5 +16,8 @@ }, "searchUrlGetParams": { "message": "client=firefox-b-e&q={searchTerms}" + }, + "channelPref": { + "message": "google_channel_row" } -} \ No newline at end of file +} diff --git a/browser/components/search/extensions/google/_locales/en/messages.json b/browser/components/search/extensions/google/_locales/en/messages.json index d528896ae03a..aeca0ef128b3 100644 --- a/browser/components/search/extensions/google/_locales/en/messages.json +++ b/browser/components/search/extensions/google/_locales/en/messages.json @@ -9,18 +9,16 @@ "message": "https://www.google.com/search" }, "searchForm": { - "message": "https://www.google.com/search?q={searchTerms}" + "message": "https://www.google.com/search?client=firefox-b-d&q={searchTerms}" }, "suggestUrl": { "message": "https://www.google.com/complete/search?client=firefox&q={searchTerms}" }, "searchUrlGetParams": { - "message": "q={searchTerms}" + "message": "client=firefox-b-d&q={searchTerms}" }, - "param_keyword": { - "message": "firefox-b-ab" - }, - "param_searchbar": { - "message": "firefox-b" + "channelPref": { + "message": "google_channel_row" } -} \ No newline at end of file + +} diff --git a/browser/components/search/extensions/google/manifest.json b/browser/components/search/extensions/google/manifest.json index 3e861314fec1..72ffd5698321 100644 --- a/browser/components/search/extensions/google/manifest.json +++ b/browser/components/search/extensions/google/manifest.json @@ -23,22 +23,10 @@ "search_form": "__MSG_searchForm__", "suggest_url": "__MSG_suggestUrl__", "params": [ - { - "name": "client", - "condition": "purpose", - "purpose": "keyword", - "value": "__MSG_param_keyword__" - }, - { - "name": "client", - "condition": "purpose", - "purpose": "searchbar", - "value": "__MSG_param_searchbar__" - }, { "name": "channel", "condition": "pref", - "pref": "google_channel_us" + "pref": "__MSG_channel_pref__" } ], "search_url_get_params": "__MSG_searchUrlGetParams__" diff --git a/toolkit/components/search/tests/xpcshell/searchconfigs/head_searchconfig.js b/toolkit/components/search/tests/xpcshell/searchconfigs/head_searchconfig.js index 2b985378865c..854b105a7e3a 100644 --- a/toolkit/components/search/tests/xpcshell/searchconfigs/head_searchconfig.js +++ b/toolkit/components/search/tests/xpcshell/searchconfigs/head_searchconfig.js @@ -403,8 +403,13 @@ class SearchConfigTest { const code = (typeof rules.codes === "string") ? rules.codes : rules.codes[purpose]; const submission = engine.getSubmission("test", "text/html", purpose); - this.assertOk(submission.uri.query.split("&").includes(code), + const submissionQueryParams = submission.uri.query.split("&"); + this.assertOk(submissionQueryParams.includes(code), `Expected "${code}" in url "${submission.uri.spec}" from purpose "${purpose}" ${location}`); + + const paramName = code.split("=")[0]; + this.assertOk(submissionQueryParams.filter(param => param.startsWith(paramName)).length == 1, + `Expected only one "${paramName}" parameter in "${submission.uri.spec}" from purpose "${purpose}" ${location}`); } }