зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1616899 - Add search suggestions to eBay. r=mikedeboer
Differential Revision: https://phabricator.services.mozilla.com/D78468
This commit is contained in:
Родитель
cc5e996863
Коммит
934a94d74b
|
@ -13,5 +13,8 @@
|
|||
},
|
||||
"searchUrlGetParams": {
|
||||
"message": "ff3=4&toolid=20004&campid=5338192028&customid=&mpre=https://www.ebay.at/sch/{searchTerms}"
|
||||
},
|
||||
"suggestUrlGetParams": {
|
||||
"message": "sId=16&fmt=osr&kwd={searchTerms}"
|
||||
}
|
||||
}
|
|
@ -13,5 +13,8 @@
|
|||
},
|
||||
"searchUrlGetParams": {
|
||||
"message": "ff3=4&toolid=20004&campid=5338192028&customid=&mpre=https://www.ebay.com.au/sch/{searchTerms}"
|
||||
},
|
||||
"suggestUrlGetParams": {
|
||||
"message": "sId=15&fmt=osr&kwd={searchTerms}"
|
||||
}
|
||||
}
|
|
@ -13,5 +13,8 @@
|
|||
},
|
||||
"searchUrlGetParams": {
|
||||
"message": "ff3=4&toolid=20004&campid=5338192028&customid=&mpre=https://www.befr.ebay.be/sch/{searchTerms}"
|
||||
},
|
||||
"suggestUrlGetParams": {
|
||||
"message": "sId=23&fmt=osr&kwd={searchTerms}"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,5 +13,8 @@
|
|||
},
|
||||
"searchUrlGetParams": {
|
||||
"message": "ff3=4&toolid=20004&campid=5338192028&customid=&mpre=https://www.ebay.ca/sch/{searchTerms}"
|
||||
},
|
||||
"suggestUrlGetParams": {
|
||||
"message": "sId=2&fmt=osr&kwd={searchTerms}"
|
||||
}
|
||||
}
|
|
@ -13,5 +13,8 @@
|
|||
},
|
||||
"searchUrlGetParams": {
|
||||
"message": "ff3=4&toolid=20004&campid=5338192028&customid=&mpre=https://www.ebay.ch/sch/{searchTerms}"
|
||||
},
|
||||
"suggestUrlGetParams": {
|
||||
"message": "sId=193&fmt=osr&kwd={searchTerms}"
|
||||
}
|
||||
}
|
|
@ -13,5 +13,8 @@
|
|||
},
|
||||
"searchUrlGetParams": {
|
||||
"message": "ff3=4&toolid=20004&campid=5338192028&customid=&mpre=https://www.ebay.de/sch/{searchTerms}"
|
||||
},
|
||||
"suggestUrlGetParams": {
|
||||
"message": "sId=77&fmt=osr&kwd={searchTerms}"
|
||||
}
|
||||
}
|
|
@ -13,5 +13,8 @@
|
|||
},
|
||||
"searchUrlGetParams": {
|
||||
"message": "ff3=4&toolid=20004&campid=5338192028&customid=&mpre=https://www.ebay.com/sch/{searchTerms}"
|
||||
},
|
||||
"suggestUrlGetParams": {
|
||||
"message": "sId=0&fmt=osr&kwd={searchTerms}"
|
||||
}
|
||||
}
|
|
@ -13,5 +13,8 @@
|
|||
},
|
||||
"searchUrlGetParams": {
|
||||
"message": "ff3=4&toolid=20004&campid=5338192028&customid=&mpre=https://www.ebay.es/sch/{searchTerms}"
|
||||
},
|
||||
"suggestUrlGetParams": {
|
||||
"message": "sId=186&fmt=osr&kwd={searchTerms}"
|
||||
}
|
||||
}
|
|
@ -13,5 +13,8 @@
|
|||
},
|
||||
"searchUrlGetParams": {
|
||||
"message": "ff3=4&toolid=20004&campid=5338192028&customid=&mpre=https://www.ebay.fr/sch/{searchTerms}"
|
||||
},
|
||||
"suggestUrlGetParams": {
|
||||
"message": "sId=71&fmt=osr&kwd={searchTerms}"
|
||||
}
|
||||
}
|
|
@ -13,5 +13,8 @@
|
|||
},
|
||||
"searchUrlGetParams": {
|
||||
"message": "ff3=4&toolid=20004&campid=5338192028&customid=&mpre=https://www.ebay.ie/sch/{searchTerms}"
|
||||
},
|
||||
"suggestUrlGetParams": {
|
||||
"message": "sId=205&fmt=osr&kwd={searchTerms}"
|
||||
}
|
||||
}
|
|
@ -13,5 +13,8 @@
|
|||
},
|
||||
"searchUrlGetParams": {
|
||||
"message": "ff3=4&toolid=20004&campid=5338192028&customid=&mpre=https://www.ebay.it/sch/{searchTerms}"
|
||||
},
|
||||
"suggestUrlGetParams": {
|
||||
"message": "sId=101&fmt=osr&kwd={searchTerms}"
|
||||
}
|
||||
}
|
|
@ -13,5 +13,8 @@
|
|||
},
|
||||
"searchUrlGetParams": {
|
||||
"message": "ff3=4&toolid=20004&campid=5338192028&customid=&mpre=https://www.ebay.nl/sch/{searchTerms}"
|
||||
},
|
||||
"suggestUrlGetParams": {
|
||||
"message": "sId=146&fmt=osr&kwd={searchTerms}"
|
||||
}
|
||||
}
|
|
@ -13,5 +13,8 @@
|
|||
},
|
||||
"searchUrlGetParams": {
|
||||
"message": "ff3=4&toolid=20004&campid=5338192028&customid=&mpre=https://www.ebay.co.uk/sch/{searchTerms}"
|
||||
},
|
||||
"suggestUrlGetParams": {
|
||||
"message": "sId=3&fmt=osr&kwd={searchTerms}"
|
||||
}
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
"name": "__MSG_extensionName__",
|
||||
"description": "__MSG_extensionDescription__",
|
||||
"manifest_version": 2,
|
||||
"version": "1.0",
|
||||
"version": "1.1",
|
||||
"applications": {
|
||||
"gecko": {
|
||||
"id": "ebay@search.mozilla.org"
|
||||
|
@ -21,7 +21,9 @@
|
|||
"name": "__MSG_extensionName__",
|
||||
"search_url": "__MSG_searchUrl__",
|
||||
"search_form": "__MSG_searchForm__",
|
||||
"search_url_get_params": "__MSG_searchUrlGetParams__"
|
||||
"search_url_get_params": "__MSG_searchUrlGetParams__",
|
||||
"suggest_url": "https://autosug.ebay.com/autosug",
|
||||
"suggest_url_get_params": "__MSG_suggestUrlGetParams__"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -62,6 +62,28 @@ add_task(async function test() {
|
|||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: "application/x-suggestions+json",
|
||||
method: "GET",
|
||||
template: "https://autosug.ebay.com/autosug",
|
||||
params: [
|
||||
{
|
||||
name: "sId",
|
||||
value: "0",
|
||||
purpose: undefined,
|
||||
},
|
||||
{
|
||||
name: "fmt",
|
||||
value: "osr",
|
||||
purpose: undefined,
|
||||
},
|
||||
{
|
||||
name: "kwd",
|
||||
value: "{searchTerms}",
|
||||
purpose: undefined,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
|
|
@ -531,26 +531,35 @@ class SearchConfigTest {
|
|||
Got "${searchForm.host}", expected to end with "${rules.domain}".`
|
||||
);
|
||||
|
||||
for (const urlType of [URLTYPE_SUGGEST_JSON, URLTYPE_SEARCH_HTML]) {
|
||||
const submission = engine.getSubmission("test", urlType);
|
||||
if (
|
||||
urlType == URLTYPE_SUGGEST_JSON &&
|
||||
(this._config.noSuggestionsURL || rules.noSuggestionsURL)
|
||||
) {
|
||||
this.assertOk(!submission, "Should not have a submission url");
|
||||
} else if (this._config.searchUrlBase) {
|
||||
this.assertEqual(
|
||||
submission.uri.prePath + submission.uri.filePath,
|
||||
this._config.searchUrlBase + rules.searchUrlEnd,
|
||||
`Should have the correct domain for type: ${urlType} ${location}.`
|
||||
);
|
||||
} else {
|
||||
this.assertOk(
|
||||
submission.uri.host.endsWith(rules.domain),
|
||||
`Should have the correct domain for type: ${urlType} ${location}.
|
||||
Got "${submission.uri.host}", expected to end with "${rules.domain}".`
|
||||
);
|
||||
}
|
||||
let submission = engine.getSubmission("test", URLTYPE_SEARCH_HTML);
|
||||
|
||||
if (this._config.searchUrlBase) {
|
||||
this.assertEqual(
|
||||
submission.uri.prePath + submission.uri.filePath,
|
||||
this._config.searchUrlBase + rules.searchUrlEnd,
|
||||
`Should have the correct domain for type: ${URLTYPE_SEARCH_HTML} ${location}.`
|
||||
);
|
||||
} else {
|
||||
this.assertOk(
|
||||
submission.uri.host.endsWith(rules.domain),
|
||||
`Should have the correct domain for type: ${URLTYPE_SEARCH_HTML} ${location}.
|
||||
Got "${submission.uri.host}", expected to end with "${rules.domain}".`
|
||||
);
|
||||
}
|
||||
|
||||
submission = engine.getSubmission("test", URLTYPE_SUGGEST_JSON);
|
||||
if (this._config.noSuggestionsURL || rules.noSuggestionsURL) {
|
||||
this.assertOk(!submission, "Should not have a submission url");
|
||||
} else if (this._config.suggestionUrlBase) {
|
||||
this.assertEqual(
|
||||
submission.uri.prePath + submission.uri.filePath,
|
||||
this._config.suggestionUrlBase,
|
||||
`Should have the correct domain for type: ${URLTYPE_SUGGEST_JSON} ${location}.`
|
||||
);
|
||||
this.assertOk(
|
||||
submission.uri.query.includes(rules.suggestUrlCode),
|
||||
`Should have the code in the uri`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -69,6 +69,7 @@ const test = new SearchConfigTest({
|
|||
],
|
||||
},
|
||||
searchUrlBase: "https://rover.ebay.com/rover/1/",
|
||||
suggestionUrlBase: "https://autosug.ebay.com/autosug",
|
||||
details: [
|
||||
{
|
||||
// Note: These should be based on region, but we don't currently enforce that.
|
||||
|
@ -85,6 +86,7 @@ const test = new SearchConfigTest({
|
|||
},
|
||||
],
|
||||
searchUrlEnd: "1553-53471-19255-0/1",
|
||||
suggestUrlCode: "sId=23",
|
||||
},
|
||||
{
|
||||
domain: "ebay.at",
|
||||
|
@ -96,6 +98,7 @@ const test = new SearchConfigTest({
|
|||
},
|
||||
],
|
||||
searchUrlEnd: "5221-53469-19255-0/1",
|
||||
suggestUrlCode: "sId=16",
|
||||
},
|
||||
{
|
||||
domain: "ebay.ca",
|
||||
|
@ -124,6 +127,7 @@ const test = new SearchConfigTest({
|
|||
},
|
||||
],
|
||||
searchUrlEnd: "706-53473-19255-0/1",
|
||||
suggestUrlCode: "sId=2",
|
||||
},
|
||||
{
|
||||
domain: "ebay.ch",
|
||||
|
@ -151,6 +155,7 @@ const test = new SearchConfigTest({
|
|||
},
|
||||
],
|
||||
searchUrlEnd: "5222-53480-19255-0/1",
|
||||
suggestUrlCode: "sId=193",
|
||||
},
|
||||
{
|
||||
domain: "ebay.com",
|
||||
|
@ -162,6 +167,7 @@ const test = new SearchConfigTest({
|
|||
],
|
||||
excluded: [{ regions: ["au", "be", "ca", "ch", "gb", "ie", "nl"] }],
|
||||
searchUrlEnd: "711-53200-19255-0/1",
|
||||
suggestUrlCode: "sId=0",
|
||||
},
|
||||
{
|
||||
domain: "ebay.com.au",
|
||||
|
@ -173,6 +179,7 @@ const test = new SearchConfigTest({
|
|||
},
|
||||
],
|
||||
searchUrlEnd: "705-53470-19255-0/1",
|
||||
suggestUrlCode: "sId=15",
|
||||
},
|
||||
{
|
||||
domain: "ebay.ie",
|
||||
|
@ -187,6 +194,7 @@ const test = new SearchConfigTest({
|
|||
},
|
||||
],
|
||||
searchUrlEnd: "5282-53468-19255-0/1",
|
||||
suggestUrlCode: "sId=205",
|
||||
},
|
||||
{
|
||||
domain: "ebay.co.uk",
|
||||
|
@ -202,6 +210,7 @@ const test = new SearchConfigTest({
|
|||
],
|
||||
excluded: [{ regions: ["au", "ie"] }],
|
||||
searchUrlEnd: "710-53481-19255-0/1",
|
||||
suggestUrlCode: "sId=3",
|
||||
},
|
||||
{
|
||||
domain: "ebay.de",
|
||||
|
@ -213,6 +222,7 @@ const test = new SearchConfigTest({
|
|||
],
|
||||
excluded: [{ regions: ["at", "ch"] }],
|
||||
searchUrlEnd: "707-53477-19255-0/1",
|
||||
suggestUrlCode: "sId=77",
|
||||
},
|
||||
{
|
||||
domain: "ebay.es",
|
||||
|
@ -225,6 +235,7 @@ const test = new SearchConfigTest({
|
|||
},
|
||||
],
|
||||
searchUrlEnd: "1185-53479-19255-0/1",
|
||||
suggestUrlCode: "sId=186",
|
||||
},
|
||||
{
|
||||
domain: "ebay.fr",
|
||||
|
@ -236,6 +247,7 @@ const test = new SearchConfigTest({
|
|||
],
|
||||
excluded: [{ regions: ["be", "ca", "ch"] }],
|
||||
searchUrlEnd: "709-53476-19255-0/1",
|
||||
suggestUrlCode: "sId=71",
|
||||
},
|
||||
{
|
||||
domain: "ebay.it",
|
||||
|
@ -246,6 +258,7 @@ const test = new SearchConfigTest({
|
|||
},
|
||||
],
|
||||
searchUrlEnd: "724-53478-19255-0/1",
|
||||
suggestUrlCode: "sId=101",
|
||||
},
|
||||
{
|
||||
domain: "ebay.nl",
|
||||
|
@ -261,9 +274,9 @@ const test = new SearchConfigTest({
|
|||
],
|
||||
excluded: [{ regions: ["be"] }],
|
||||
searchUrlEnd: "1346-53482-19255-0/1",
|
||||
suggestUrlCode: "sId=146",
|
||||
},
|
||||
],
|
||||
noSuggestionsURL: true,
|
||||
});
|
||||
|
||||
add_task(async function setup() {
|
||||
|
|
Загрузка…
Ссылка в новой задаче