diff --git a/browser/components/search/extensions/baidu/manifest.json b/browser/components/search/extensions/baidu/manifest.json index b58be7140262..04aa99bc4a23 100644 --- a/browser/components/search/extensions/baidu/manifest.json +++ b/browser/components/search/extensions/baidu/manifest.json @@ -2,7 +2,7 @@ "name": "百度", "description": "百度网页搜索", "manifest_version": 2, - "version": "1.0", + "version": "1.1", "applications": { "gecko": { "id": "baidu@search.mozilla.org" @@ -20,9 +20,9 @@ "name": "百度", "search_url": "https://www.baidu.com/baidu", "search_form": "https://www.baidu.com/", - "search_url_get_params": "wd={searchTerms}&tn=monline_7_dg&ie=utf-8", + "search_url_get_params": "tn=monline_7_dg&ie=utf-8&wd={searchTerms}", "suggest_url": "https://www.baidu.com/su", - "suggest_url_get_params": "wd={searchTerms}&tn=monline_7_dg&ie=utf-8&action=opensearch" + "suggest_url_get_params": "tn=monline_7_dg&ie=utf-8&action=opensearch&wd={searchTerms}" } } -} \ No newline at end of file +} diff --git a/browser/components/search/extensions/bing/manifest.json b/browser/components/search/extensions/bing/manifest.json index f255bf0639d6..ae114e0c6923 100644 --- a/browser/components/search/extensions/bing/manifest.json +++ b/browser/components/search/extensions/bing/manifest.json @@ -2,7 +2,7 @@ "name": "Bing", "description": "Bing. Search by Microsoft.", "manifest_version": 2, - "version": "1.0", + "version": "1.1", "applications": { "gecko": { "id": "bing@search.mozilla.org" @@ -19,8 +19,8 @@ "search_provider": { "name": "Bing", "search_url": "https://www.bing.com/search", - "search_form": "https://www.bing.com/search?q={searchTerms}&pc=MOZI", - "search_url_get_params": "q={searchTerms}&pc=MOZI", + "search_form": "https://www.bing.com/search?pc=MOZI&q={searchTerms}", + "search_url_get_params": "pc=MOZI&q={searchTerms}", "params": [ { "name": "form", @@ -57,4 +57,4 @@ "suggest_url_get_params": "query={searchTerms}&form=OSDJAS&language={moz:locale}" } } -} \ No newline at end of file +} diff --git a/browser/components/search/extensions/engines.json b/browser/components/search/extensions/engines.json index cb8fe35cc91c..76cde1e0539a 100644 --- a/browser/components/search/extensions/engines.json +++ b/browser/components/search/extensions/engines.json @@ -7,10 +7,10 @@ "version": "1.0" }, "params": { - "searchUrlGetParams": { - "client": "firefox-b-d", - "q": "{searchTerms}" - } + "searchUrlGetParams": [ + { "name": "client", "value": "firefox-b-d" }, + { "name": "q", "value": "{searchTerms}" } + ] }, "extraParams": [{ "name": "channel", @@ -27,10 +27,10 @@ "channel": ["esr"] }, "params": { - "searchUrlGetParams": { - "client": "firefox-b-e", - "q": "{searchTerms}" - } + "searchUrlGetParams": [ + { "name": "client", "value": "firefox-b-e" }, + { "name": "q", "value": "{searchTerms}" } + ] }, "telemetryId": "google-b-e" }, { @@ -56,10 +56,10 @@ "channel": ["esr"] }, "params": { - "searchUrlGetParams": { - "client": "firefox-b-e", - "q": "{searchTerms}" - } + "searchUrlGetParams": [ + { "name": "client", "value": "firefox-b-e" }, + { "name": "q", "value": "{searchTerms}" } + ] }, "default": "no" }, { @@ -81,19 +81,19 @@ "channel": ["esr"] }, "params": { - "searchUrlGetParams": { - "client": "firefox-b-e", - "q": "{searchTerms}" - } + "searchUrlGetParams": [ + { "name": "client", "value": "firefox-b-e" }, + { "name": "q", "value": "{searchTerms}" } + ] }, "default": "no" }, { "included": { "regions": ["us"] }, "params": { - "searchUrlGetParams": { - "client": "firefox-b-1-d", - "q": "{searchTerms}" - } + "searchUrlGetParams": [ + { "name": "client", "value": "firefox-b-1-d" }, + { "name": "q", "value": "{searchTerms}" } + ] }, "extraParams": [{ "name": "channel", @@ -107,10 +107,10 @@ "channel": ["esr"] }, "params": { - "searchUrlGetParams": { - "client": "firefox-b-1-e", - "q": "{searchTerms}" - } + "searchUrlGetParams": [ + { "name": "client", "value": "firefox-b-1-e" }, + { "name": "q", "value": "{searchTerms}" } + ] }, "extraParams": [{ "name": "channel", @@ -123,13 +123,13 @@ { "webExtension": { "id": "bing@search.mozilla.org", - "version": "1.0" + "version": "1.1" }, "params": { - "searchUrlGetParams": { - "q": "{searchTerms}", - "pc": "MOZI" - } + "searchUrlGetParams": [ + { "name": "pc", "value": "MOZI" }, + { "name": "q", "value": "{searchTerms}" } + ] }, "extraParams": [{ "name": "form", @@ -181,21 +181,21 @@ { "webExtension": { "id": "baidu@search.mozilla.org", - "version": "1.0" + "version": "1.1" }, "telemetryId": "baidu", "params": { - "searchUrlGetParams": { - "wd": "{searchTerms}", - "tn": "monline_7_dg", - "ie": "utf-8" - }, - "suggestUrlGetParams": { - "wd": "{searchTerms}", - "tn": "monline_7_dg", - "ie": "utf-8", - "action": "opensearch" - } + "searchUrlGetParams": [ + { "name": "tn", "value": "monline_7_dg" }, + { "name": "ie", "value": "utf-8" }, + { "name": "wd", "value": "{searchTerms}" } + ], + "suggestUrlGetParams": [ + { "name": "tn", "value": "monline_7_dg" }, + { "name": "ie", "value": "utf-8" }, + { "name": "action", "value": "opensearch" }, + { "name": "wd", "value": "{searchTerms}" } + ] }, "appliesTo": [{ "included": { "locales": { "matches": ["zh-CN"] } } @@ -215,13 +215,13 @@ }, "telemetryId": "amazondotcom", "params": { - "searchUrlGetParams": { - "field-keywords": "{searchTerms}", - "ie": "{inputEncoding}", - "mode": "blended", - "tag": "mozilla-20", - "sourceid": "Mozilla-search" - } + "searchUrlGetParams": [ + { "name": "field-keywords", "value": "{searchTerms}" }, + { "name": "ie", "value": "{inputEncoding}" }, + { "name": "mode", "value": "blended" }, + { "name": "tag", "value": "mozilla-20" }, + { "name": "sourceid", "value": "Mozilla-search" } + ] }, "appliesTo": [{ "included": { "regions": ["default"] } @@ -291,13 +291,13 @@ }, "telemetryId": "amazon-france", "params": { - "searchUrlGetParams": { - "field-keywords": "{searchTerms}", - "ie": "{inputEncoding}", - "mode": "blended", - "tag": "firefox-fr-21", - "sourceid":"Mozilla-search" - } + "searchUrlGetParams": [ + { "name": "field-keywords", "value": "{searchTerms}" }, + { "name": "ie", "value": "{inputEncoding}" }, + { "name": "mode", "value": "blended" }, + { "name": "tag", "value": "firefox-fr-21" }, + { "name": "sourceid", "value": "Mozilla-search" } + ] } }, { "included": { @@ -318,13 +318,13 @@ }, "telemetryId": "amazon-en-GB", "params": { - "searchUrlGetParams": { - "field-keywords": "{searchTerms}", - "ie": "{inputEncoding}", - "mode": "blended", - "tag": "firefox-uk-21", - "sourceid":"Mozilla-search" - } + "searchUrlGetParams": [ + { "name": "field-keywords", "value": "{searchTerms}" }, + { "name": "ie", "value": "{inputEncoding}" }, + { "name": "mode", "value": "blended" }, + { "name": "tag", "value": "firefox-uk-21" }, + { "name": "sourceid", "value": "Mozilla-search" } + ] } }] }, @@ -335,11 +335,11 @@ "version": "1.1" }, "params": { - "searchUrlGetParams": { - "field-keywords": "{searchTerms}", - "ie": "{inputEncoding}", - "mode": "blended" - } + "searchUrlGetParams": [ + { "name": "field-keywords", "value": "{searchTerms}" }, + { "name": "ie", "value": "{inputEncoding}" }, + { "name": "mode", "value": "blended" } + ] }, "appliesTo": [{ "included": { @@ -361,13 +361,13 @@ }, "telemetryId": "amazon-france", "params": { - "searchUrlGetParams": { - "field-keywords": "{searchTerms}", - "ie": "{inputEncoding}", - "mode": "blended", - "tag": "firefox-fr-21", - "sourceid":"Mozilla-search" - } + "searchUrlGetParams": [ + { "name": "field-keywords", "value": "{searchTerms}" }, + { "name": "ie", "value": "{inputEncoding}" }, + { "name": "mode", "value": "blended" }, + { "name": "tag", "value": "firefox-fr-21" }, + { "name": "sourceid", "value": "Mozilla-search" } + ] } }, { "included": { @@ -391,13 +391,13 @@ }, "telemetryId": "amazon-jp", "params": { - "searchUrlGetParams": { - "field-keywords": "{searchTerms}", - "ie": "{inputEncoding}", - "mode": "blended", - "tag": "mozillajapan-fx-22", - "sourceid":"Mozilla-search" - } + "searchUrlGetParams": [ + { "name": "field-keywords", "value": "{searchTerms}" }, + { "name": "ie", "value": "{inputEncoding}" }, + { "name": "mode", "value": "blended" }, + { "name": "tag", "value": "mozillajapan-fx-22" }, + { "name": "sourceid", "value": "Mozilla-search" } + ] } }, { "included": { "locales": { "matches": ["it", "lij"] } }, @@ -406,13 +406,13 @@ }, "telemetryId": "amazon-it", "params": { - "searchUrlGetParams": { - "field-keywords": "{searchTerms}", - "ie": "{inputEncoding}", - "mode": "blended", - "tag": "firefoxit-21", - "sourceid":"Mozilla-search" - } + "searchUrlGetParams": [ + { "name": "field-keywords", "value": "{searchTerms}" }, + { "name": "ie", "value": "{inputEncoding}" }, + { "name": "mode", "value": "blended" }, + { "name": "tag", "value": "firefoxit-21" }, + { "name": "sourceid", "value": "Mozilla-search" } + ] } }, { "included": { "locales": { "matches": ["de", "dsb", "hsb"] } }, @@ -421,13 +421,13 @@ }, "telemetryId": "amazon-de", "params": { - "searchUrlGetParams": { - "field-keywords": "{searchTerms}", - "ie": "{inputEncoding}", - "mode": "blended", - "tag": "firefox-de-21", - "sourceid":"Mozilla-search" - } + "searchUrlGetParams": [ + { "name": "field-keywords", "value": "{searchTerms}" }, + { "name": "ie", "value": "{inputEncoding}" }, + { "name": "mode", "value": "blended" }, + { "name": "tag", "value": "firefox-de-21" }, + { "name": "sourceid", "value": "Mozilla-search" } + ] } }, { "included": { @@ -443,13 +443,13 @@ }, "telemetryId": "amazon-en-GB", "params": { - "searchUrlGetParams": { - "field-keywords": "{searchTerms}", - "ie": "{inputEncoding}", - "mode": "blended", - "tag": "firefox-uk-21", - "sourceid":"Mozilla-search" - } + "searchUrlGetParams": [ + { "name": "field-keywords", "value": "{searchTerms}" }, + { "name": "ie", "value": "{inputEncoding}" }, + { "name": "mode", "value": "blended" }, + { "name": "tag", "value": "firefox-uk-21" }, + { "name": "sourceid", "value": "Mozilla-search" } + ] } }, { "included": { @@ -475,15 +475,15 @@ }, "telemetryId": "amazondotcn", "params": { - "searchUrlGetParams": { - "keywords": "{searchTerms}", - "ix": "sunray", - "pageletid": "headsearch", - "searchType": "", - "Go.x": "0", - "Go.y": "0", - "bestSaleNum": "0" - } + "searchUrlGetParams": [ + { "name": "keywords", "value": "{searchTerms}" }, + { "name": "ix", "value": "sunray" }, + { "name": "pageletid", "value": "headsearch" }, + { "name": "searchType", "value": "" }, + { "name": "Go.x", "value": "0" }, + { "name": "Go.y", "value": "0" }, + { "name": "bestSaleNum", "value": "0" } + ] }, "appliesTo": [{ "included": { "locales": { "matches": ["zh-CN"] } } @@ -496,13 +496,13 @@ "version": "1.0" }, "params": { - "searchUrlGetParams": { - "ff3": "4", - "toolid": "20004", - "campid": "5338192028", - "customid": "", - "mpre": "https://www.ebay.com/sch/{searchTerms}" - } + "searchUrlGetParams": [ + { "name": "ff3", "value": "4" }, + { "name": "toolid", "value": "20004" }, + { "name": "campid", "value": "5338192028" }, + { "name": "customid", "value": "" }, + { "name": "mpre", "value": "https://www.ebay.com/sch/{searchTerms}" } + ] }, "appliesTo": [{ "included": { "regions": ["default"] } @@ -519,13 +519,13 @@ }, "telemetryId": "ebay-au", "params": { - "searchUrlGetParams": { - "ff3": "4", - "toolid": "20004", - "campid": "5338192028", - "customid": "", - "mpre": "https://www.ebay.com.au/sch/{searchTerms}" - } + "searchUrlGetParams": [ + { "name": "ff3", "value": "4" }, + { "name": "toolid", "value": "20004" }, + { "name": "campid", "value": "5338192028" }, + { "name": "customid", "value": "" }, + { "name": "mpre", "value": "https://www.ebay.com.au/sch/{searchTerms}" } + ] } }, { "included": { @@ -537,13 +537,13 @@ }, "telemetryId": "ebay-ie", "params": { - "searchUrlGetParams": { - "ff3": "4", - "toolid": "20004", - "campid": "5338192028", - "customid": "", - "mpre": "https://www.ebay.ie/sch/{searchTerms}" - } + "searchUrlGetParams": [ + { "name": "ff3", "value": "4" }, + { "name": "toolid", "value": "20004" }, + { "name": "campid", "value": "5338192028" }, + { "name": "customid", "value": "" }, + { "name": "mpre", "value": "https://www.ebay.ie/sch/{searchTerms}" } + ] } }, { "included": { @@ -555,13 +555,13 @@ }, "telemetryId": "ebay-be", "params": { - "searchUrlGetParams": { - "ff3": "4", - "toolid": "20004", - "campid": "5338192028", - "customid": "", - "mpre": "https://www.befr.ebay.be/sch/{searchTerms}" - } + "searchUrlGetParams": [ + { "name": "ff3", "value": "4" }, + { "name": "toolid", "value": "20004" }, + { "name": "campid", "value": "5338192028" }, + { "name": "customid", "value": "" }, + { "name": "mpre", "value": "https://www.befr.ebay.be/sch/{searchTerms}" } + ] } }, { "included": { "locales": { @@ -572,13 +572,13 @@ }, "telemetryId": "ebay-es", "params": { - "searchUrlGetParams": { - "ff3": "4", - "toolid": "20004", - "campid": "5338192028", - "customid": "", - "mpre": "https://www.ebay.es/sch/{searchTerms}" - } + "searchUrlGetParams": [ + { "name": "ff3", "value": "4" }, + { "name": "toolid", "value": "20004" }, + { "name": "campid", "value": "5338192028" }, + { "name": "customid", "value": "" }, + { "name": "mpre", "value": "https://www.ebay.es/sch/{searchTerms}" } + ] } }, { "included": { "locales": { "matches": ["br", "fr", "wo"] }}, @@ -587,13 +587,13 @@ }, "telemetryId": "ebay-fr", "params": { - "searchUrlGetParams": { - "ff3": "4", - "toolid": "20004", - "campid": "5338192028", - "customid": "", - "mpre": "https://www.ebay.fr/sch/{searchTerms}" - } + "searchUrlGetParams": [ + { "name": "ff3", "value": "4" }, + { "name": "toolid", "value": "20004" }, + { "name": "campid", "value": "5338192028" }, + { "name": "customid", "value": "" }, + { "name": "mpre", "value": "https://www.ebay.fr/sch/{searchTerms}" } + ] } }, { "included": { @@ -605,13 +605,13 @@ }, "telemetryId": "ebay-be", "params": { - "searchUrlGetParams": { - "ff3": "4", - "toolid": "20004", - "campid": "5338192028", - "customid": "", - "mpre": "https://www.befr.ebay.be/sch/{searchTerms}" - } + "searchUrlGetParams": [ + { "name": "ff3", "value": "4" }, + { "name": "toolid", "value": "20004" }, + { "name": "campid", "value": "5338192028" }, + { "name": "customid", "value": "" }, + { "name": "mpre", "value": "https://www.befr.ebay.be/sch/{searchTerms}" } + ] } }, { "included": { @@ -623,13 +623,13 @@ }, "telemetryId": "ebay-ca", "params": { - "searchUrlGetParams": { - "ff3": "4", - "toolid": "20004", - "campid": "5338192028", - "customid": "", - "mpre": "https://www.ebay.ca/sch/{searchTerms}" - } + "searchUrlGetParams": [ + { "name": "ff3", "value": "4" }, + { "name": "toolid", "value": "20004" }, + { "name": "campid", "value": "5338192028" }, + { "name": "customid", "value": "" }, + { "name": "mpre", "value": "https://www.ebay.ca/sch/{searchTerms}" } + ] } }, { "included": { @@ -641,13 +641,13 @@ }, "telemetryId": "ebay-ch", "params": { - "searchUrlGetParams": { - "ff3": "4", - "toolid": "20004", - "campid": "5338192028", - "customid": "", - "mpre": "https://www.ebay.ch/sch/{searchTerms}" - } + "searchUrlGetParams": [ + { "name": "ff3", "value": "4" }, + { "name": "toolid", "value": "20004" }, + { "name": "campid", "value": "5338192028" }, + { "name": "customid", "value": "" }, + { "name": "mpre", "value": "https://www.ebay.ch/sch/{searchTerms}" } + ] } }, { "included": { "locales": { "matches": ["cy", "en-GB", "gd"] }}, @@ -656,13 +656,13 @@ }, "telemetryId": "ebay-uk", "params": { - "searchUrlGetParams": { - "ff3": "4", - "toolid": "20004", - "campid": "5338192028", - "customid": "", - "mpre": "https://www.ebay.co.uk/sch/{searchTerms}" - } + "searchUrlGetParams": [ + { "name": "ff3", "value": "4" }, + { "name": "toolid", "value": "20004" }, + { "name": "campid", "value": "5338192028" }, + { "name": "customid", "value": "" }, + { "name": "mpre", "value": "https://www.ebay.co.uk/sch/{searchTerms}" } + ] } }, { "included": { @@ -674,13 +674,13 @@ }, "telemetryId": "ebay-au", "params": { - "searchUrlGetParams": { - "ff3": "4", - "toolid": "20004", - "campid": "5338192028", - "customid": "", - "mpre": "https://www.ebay.com.au/sch/{searchTerms}" - } + "searchUrlGetParams": [ + { "name": "ff3", "value": "4" }, + { "name": "toolid", "value": "20004" }, + { "name": "campid", "value": "5338192028" }, + { "name": "customid", "value": "" }, + { "name": "mpre", "value": "https://www.ebay.com.au/sch/{searchTerms}" } + ] } }, { "included": { @@ -698,13 +698,13 @@ }, "telemetryId": "ebay-de", "params": { - "searchUrlGetParams": { - "ff3": "4", - "toolid": "20004", - "campid": "5338192028", - "customid": "", - "mpre": "https://www.ebay.de/sch/{searchTerms}" - } + "searchUrlGetParams": [ + { "name": "ff3", "value": "4" }, + { "name": "toolid", "value": "20004" }, + { "name": "campid", "value": "5338192028" }, + { "name": "customid", "value": "" }, + { "name": "mpre", "value": "https://www.ebay.de/sch/{searchTerms}" } + ] } }, { "included": { @@ -716,13 +716,13 @@ }, "telemetryId": "ebay-at", "params": { - "searchUrlGetParams": { - "ff3": "4", - "toolid": "20004", - "campid": "5338192028", - "customid": "", - "mpre": "https://www.ebay.at/sch/{searchTerms}" - } + "searchUrlGetParams": [ + { "name": "ff3", "value": "4" }, + { "name": "toolid", "value": "20004" }, + { "name": "campid", "value": "5338192028" }, + { "name": "customid", "value": "" }, + { "name": "mpre", "value": "https://www.ebay.at/sch/{searchTerms}" } + ] } }, { "included": { @@ -740,13 +740,13 @@ }, "telemetryId": "ebay-ca", "params": { - "searchUrlGetParams": { - "ff3": "4", - "toolid": "20004", - "campid": "5338192028", - "customid": "", - "mpre": "https://www.ebay.ca/sch/{searchTerms}" - } + "searchUrlGetParams": [ + { "name": "ff3", "value": "4" }, + { "name": "toolid", "value": "20004" }, + { "name": "campid", "value": "5338192028" }, + { "name": "customid", "value": "" }, + { "name": "mpre", "value": "https://www.ebay.ca/sch/{searchTerms}" } + ] } }, { "included": { "locales": { "matches": ["fy-NL", "nl"] }}, @@ -755,13 +755,13 @@ }, "telemetryId": "ebay-nl", "params": { - "searchUrlGetParams": { - "ff3": "4", - "toolid": "20004", - "campid": "5338192028", - "customid": "", - "mpre": "https://www.ebay.nl/sch/{searchTerms}" - } + "searchUrlGetParams": [ + { "name": "ff3", "value": "4" }, + { "name": "toolid", "value": "20004" }, + { "name": "campid", "value": "5338192028" }, + { "name": "customid", "value": "" }, + { "name": "mpre", "value": "https://www.ebay.nl/sch/{searchTerms}" } + ] } }, { "included": { @@ -773,13 +773,13 @@ }, "telemetryId": "ebay-be", "params": { - "searchUrlGetParams": { - "ff3": "4", - "toolid": "20004", - "campid": "5338192028", - "customid": "", - "mpre": "https://www.befr.ebay.be/sch/{searchTerms}" - } + "searchUrlGetParams": [ + { "name": "ff3", "value": "4" }, + { "name": "toolid", "value": "20004" }, + { "name": "campid", "value": "5338192028" }, + { "name": "customid", "value": "" }, + { "name": "mpre", "value": "https://www.befr.ebay.be/sch/{searchTerms}" } + ] } }, { "included": { "locales": { "matches": ["ga-IE"] }}, @@ -788,13 +788,13 @@ }, "telemetryId": "ebay-ie", "params": { - "searchUrlGetParams": { - "ff3": "4", - "toolid": "20004", - "campid": "5338192028", - "customid": "", - "mpre": "https://www.ebay.ie/sch/{searchTerms}" - } + "searchUrlGetParams": [ + { "name": "ff3", "value": "4" }, + { "name": "toolid", "value": "20004" }, + { "name": "campid", "value": "5338192028" }, + { "name": "customid", "value": "" }, + { "name": "mpre", "value": "https://www.ebay.ie/sch/{searchTerms}" } + ] } }, { "included": { "locales": { "matches": ["it", "lij"] }}, @@ -803,13 +803,13 @@ }, "telemetryId": "ebay-it", "params": { - "searchUrlGetParams": { - "ff3": "4", - "toolid": "20004", - "campid": "5338192028", - "customid": "", - "mpre": "https://www.ebay.it/sch/{searchTerms}" - } + "searchUrlGetParams": [ + { "name": "ff3", "value": "4" }, + { "name": "toolid", "value": "20004" }, + { "name": "campid", "value": "5338192028" }, + { "name": "customid", "value": "" }, + { "name": "mpre", "value": "https://www.ebay.it/sch/{searchTerms}" } + ] } }, { "included": { "locales": { "matches": ["rm"] }}, @@ -818,13 +818,13 @@ }, "telemetryId": "ebay-ch", "params": { - "searchUrlGetParams": { - "ff3": "4", - "toolid": "20004", - "campid": "5338192028", - "customid": "", - "mpre": "https://www.ebay.ch/sch/{searchTerms}" - } + "searchUrlGetParams": [ + { "name": "ff3", "value": "4" }, + { "name": "toolid", "value": "20004" }, + { "name": "campid", "value": "5338192028" }, + { "name": "customid", "value": "" }, + { "name": "mpre", "value": "https://www.ebay.ch/sch/{searchTerms}" } + ] } }] }, diff --git a/browser/components/search/test/browser/browser_bing.js b/browser/components/search/test/browser/browser_bing.js index 99a9b0af198b..425098a1f21f 100644 --- a/browser/components/search/test/browser/browser_bing.js +++ b/browser/components/search/test/browser/browser_bing.js @@ -13,22 +13,26 @@ add_task(async function test() { let engine = Services.search.getEngineByName("Bing"); ok(engine, "Bing"); - let base = "https://www.bing.com/search?q=foo&pc=MOZI"; + let base = "https://www.bing.com/search?form={code}&pc=MOZI&q=foo"; let url; + function getUrl(code) { + return base.replace("{code}", code); + } + // Test search URLs (including purposes). url = engine.getSubmission("foo").uri.spec; - is(url, base + "&form=MOZSBR", "Check search URL for 'foo'"); + is(url, getUrl("MOZSBR"), "Check search URL for 'foo'"); url = engine.getSubmission("foo", null, "contextmenu").uri.spec; - is(url, base + "&form=MOZCON", "Check context menu search URL for 'foo'"); + is(url, getUrl("MOZCON"), "Check context menu search URL for 'foo'"); url = engine.getSubmission("foo", null, "keyword").uri.spec; - is(url, base + "&form=MOZLBR", "Check keyword search URL for 'foo'"); + is(url, getUrl("MOZLBR"), "Check keyword search URL for 'foo'"); url = engine.getSubmission("foo", null, "searchbar").uri.spec; - is(url, base + "&form=MOZSBR", "Check search bar search URL for 'foo'"); + is(url, getUrl("MOZSBR"), "Check search bar search URL for 'foo'"); url = engine.getSubmission("foo", null, "homepage").uri.spec; - is(url, base + "&form=MOZSPG", "Check homepage search URL for 'foo'"); + is(url, getUrl("MOZSPG"), "Check homepage search URL for 'foo'"); url = engine.getSubmission("foo", null, "newtab").uri.spec; - is(url, base + "&form=MOZTSB", "Check newtab search URL for 'foo'"); + is(url, getUrl("MOZTSB"), "Check newtab search URL for 'foo'"); // Check search suggestion URL. url = engine.getSubmission("foo", "application/x-suggestions+json").uri.spec; @@ -44,7 +48,7 @@ add_task(async function test() { name: "Bing", alias: null, description: "Bing. Search by Microsoft.", - searchForm: "https://www.bing.com/search?q=&pc=MOZI", + searchForm: "https://www.bing.com/search?pc=MOZI&q=", hidden: false, wrappedJSObject: { queryCharset: "UTF-8", @@ -54,16 +58,6 @@ add_task(async function test() { method: "GET", template: "https://www.bing.com/search", params: [ - { - name: "q", - value: "{searchTerms}", - purpose: undefined, - }, - { - name: "pc", - value: "MOZI", - purpose: undefined, - }, { name: "form", value: "MOZCON", @@ -89,6 +83,16 @@ add_task(async function test() { value: "MOZTSB", purpose: "newtab", }, + { + name: "pc", + value: "MOZI", + purpose: undefined, + }, + { + name: "q", + value: "{searchTerms}", + purpose: undefined, + }, ], }, { diff --git a/browser/components/search/test/browser/browser_ddg.js b/browser/components/search/test/browser/browser_ddg.js index d5536110942f..7639c79f7ece 100644 --- a/browser/components/search/test/browser/browser_ddg.js +++ b/browser/components/search/test/browser/browser_ddg.js @@ -13,22 +13,26 @@ add_task(async function test() { let engine = Services.search.getEngineByName("DuckDuckGo"); ok(engine, "DuckDuckGo"); - let base = "https://duckduckgo.com/?q=foo"; + let base = "https://duckduckgo.com/?t={code}&q=foo"; let url; + function getUrl(code) { + return base.replace("{code}", code); + } + // Test search URLs (including purposes). url = engine.getSubmission("foo").uri.spec; - is(url, base + "&t=ffsb", "Check search URL for 'foo'"); + is(url, getUrl("ffsb"), "Check search URL for 'foo'"); url = engine.getSubmission("foo", null, "contextmenu").uri.spec; - is(url, base + "&t=ffcm", "Check context menu search URL for 'foo'"); + is(url, getUrl("ffcm"), "Check context menu search URL for 'foo'"); url = engine.getSubmission("foo", null, "keyword").uri.spec; - is(url, base + "&t=ffab", "Check keyword search URL for 'foo'"); + is(url, getUrl("ffab"), "Check keyword search URL for 'foo'"); url = engine.getSubmission("foo", null, "searchbar").uri.spec; - is(url, base + "&t=ffsb", "Check search bar search URL for 'foo'"); + is(url, getUrl("ffsb"), "Check search bar search URL for 'foo'"); url = engine.getSubmission("foo", null, "homepage").uri.spec; - is(url, base + "&t=ffhp", "Check homepage search URL for 'foo'"); + is(url, getUrl("ffhp"), "Check homepage search URL for 'foo'"); url = engine.getSubmission("foo", null, "newtab").uri.spec; - is(url, base + "&t=ffnt", "Check newtab search URL for 'foo'"); + is(url, getUrl("ffnt"), "Check newtab search URL for 'foo'"); // Check search suggestion URL. url = engine.getSubmission("foo", "application/x-suggestions+json").uri.spec; @@ -53,11 +57,6 @@ add_task(async function test() { method: "GET", template: "https://duckduckgo.com/", params: [ - { - name: "q", - value: "{searchTerms}", - purpose: undefined, - }, { name: "t", value: "ffcm", @@ -83,6 +82,11 @@ add_task(async function test() { value: "ffnt", purpose: "newtab", }, + { + name: "q", + value: "{searchTerms}", + purpose: undefined, + }, ], }, { diff --git a/browser/components/search/test/browser/browser_google.js b/browser/components/search/test/browser/browser_google.js index 8eb3a1a914a9..f1b7bef47bcf 100644 --- a/browser/components/search/test/browser/browser_google.js +++ b/browser/components/search/test/browser/browser_google.js @@ -21,6 +21,7 @@ add_task(async function test() { ok(engine, "Found Google search engine"); // Check search suggestion URL. + // This also checks that the query is on the end of the URL. See bug 1484232. let url = engine.getSubmission("foo", "application/x-suggestions+json").uri .spec; is( diff --git a/browser/components/search/test/browser/browser_searchEngine_behaviors.js b/browser/components/search/test/browser/browser_searchEngine_behaviors.js index c370bd4c68f5..aca4ab138d68 100644 --- a/browser/components/search/test/browser/browser_searchEngine_behaviors.js +++ b/browser/components/search/test/browser/browser_searchEngine_behaviors.js @@ -22,23 +22,23 @@ const SEARCH_ENGINE_DETAILS = [ }, { alias: "b", - baseURL: "https://www.bing.com/search?q=foo&pc=MOZI", + baseURL: "https://www.bing.com/search?{code}pc=MOZI&q=foo", codes: { - context: "&form=MOZCON", - keyword: "&form=MOZLBR", - newTab: "&form=MOZTSB", - submission: "&form=MOZSBR", + context: "form=MOZCON&", + keyword: "form=MOZLBR&", + newTab: "form=MOZTSB&", + submission: "form=MOZSBR&", }, name: "Bing", }, { alias: "d", - baseURL: "https://duckduckgo.com/?q=foo", + baseURL: "https://duckduckgo.com/?{code}q=foo", codes: { - context: "&t=ffcm", - keyword: "&t=ffab", - newTab: "&t=ffnt", - submission: "&t=ffsb", + context: "t=ffcm&", + keyword: "t=ffab&", + newTab: "t=ffnt&", + submission: "t=ffsb&", }, name: "DuckDuckGo", }, @@ -111,7 +111,7 @@ async function testSearchEngine(engineDetails) { let url = engine.getSubmission("foo").uri.spec; Assert.equal( url, - base + engineDetails.codes.submission, + base.replace("{code}", engineDetails.codes.submission), "Check search URL for 'foo'" ); let sb = BrowserSearch.searchBar; @@ -119,7 +119,7 @@ async function testSearchEngine(engineDetails) { let engineTests = [ { name: "context menu search", - searchURL: base + engineDetails.codes.context, + searchURL: base.replace("{code}", engineDetails.codes.context), run() { // Simulate a contextmenu search // FIXME: This is a bit "low-level"... @@ -134,7 +134,7 @@ async function testSearchEngine(engineDetails) { }, { name: "keyword search", - searchURL: base + engineDetails.codes.keyword, + searchURL: base.replace("{code}", engineDetails.codes.keyword), run() { gURLBar.value = "? foo"; gURLBar.focus(); @@ -143,7 +143,7 @@ async function testSearchEngine(engineDetails) { }, { name: "keyword search with alias", - searchURL: base + engineDetails.codes.keyword, + searchURL: base.replace("{code}", engineDetails.codes.keyword), run() { gURLBar.value = `${engineDetails.alias} foo`; gURLBar.focus(); @@ -152,7 +152,7 @@ async function testSearchEngine(engineDetails) { }, { name: "search bar search", - searchURL: base + engineDetails.codes.submission, + searchURL: base.replace("{code}", engineDetails.codes.submission), run() { sb.focus(); sb.value = "foo"; @@ -161,7 +161,7 @@ async function testSearchEngine(engineDetails) { }, { name: "new tab search", - searchURL: base + engineDetails.codes.newTab, + searchURL: base.replace("{code}", engineDetails.codes.newTab), async preTest(tab) { let browser = tab.linkedBrowser; await BrowserTestUtils.loadURI(browser, "about:newtab"); diff --git a/toolkit/components/search/SearchEngine.jsm b/toolkit/components/search/SearchEngine.jsm index 3a98ec4680ff..9de0c7f3a2b1 100644 --- a/toolkit/components/search/SearchEngine.jsm +++ b/toolkit/components/search/SearchEngine.jsm @@ -1445,6 +1445,17 @@ SearchEngine.prototype = { _initEngineURLFromMetaData(type, params) { let url = new EngineURL(type, params.method || "GET", params.template); + // Do the MozParams first, so that we are more likely to get the query + // on the end of the URL, rather than the MozParams (xref bug 1484232). + if (params.mozParams) { + for (let p of params.mozParams) { + if ((p.condition || p.purpose) && !this._isDefault) { + continue; + } + url._addMozParam(p); + } + } + if (params.postParams) { let queries = new URLSearchParams(params.postParams); for (let [name, value] of queries) { @@ -1459,15 +1470,6 @@ SearchEngine.prototype = { } } - if (params.mozParams) { - for (let p of params.mozParams) { - if ((p.condition || p.purpose) && !this._isDefault) { - continue; - } - url._addMozParam(p); - } - } - this._urls.push(url); }, diff --git a/toolkit/components/search/SearchService.jsm b/toolkit/components/search/SearchService.jsm index cbc1ccf256c6..5668ef9a46fa 100644 --- a/toolkit/components/search/SearchService.jsm +++ b/toolkit/components/search/SearchService.jsm @@ -2588,16 +2588,18 @@ SearchService.prototype = { // Modern Config encodes params as objects whereas they are // strings in webExtensions, stringify them here. if ("params" in config) { - [ + for (const key of [ "searchUrlGetParams", "searchUrlPostParams", "suggestUrlGetParams", "suggestUrlPostParams", - ].forEach(key => { + ]) { if (key in config.params) { - params[key] = new URLSearchParams(config.params[key]).toString(); + params[key] = new URLSearchParams( + config.params[key].map(kv => [kv.name, kv.value]) + ).toString(); } - }); + } } if ("telemetryId" in config) { diff --git a/toolkit/components/search/schema/search-engine-config-schema.json b/toolkit/components/search/schema/search-engine-config-schema.json index 36ce9707238d..ccc6c72aca00 100644 --- a/toolkit/components/search/schema/search-engine-config-schema.json +++ b/toolkit/components/search/schema/search-engine-config-schema.json @@ -189,11 +189,23 @@ } }, "searchUrlCodes": { - "type": "object", + "type": "array", "title": "Codes", - "description": "A map of parameter name to the parameter value.", - "additionalProperties": { - "type": "string" + "description": "A array of objects - map of parameter name to the parameter value.", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string", + "title": "Name", + "description": "Name of the parameter that will be used in the query" + }, + "value": { + "type": "string", + "title": "Value", + "description": "The value of parameter (pref or purpose)" + } + } } }, "params": {