mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
120 lines
8.3 KiB
JavaScript
120 lines
8.3 KiB
JavaScript
/* Any copyright is dedicated to the Public Domain.
|
|
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
|
|
|
/*
|
|
* Test Bing search plugin URLs
|
|
*/
|
|
|
|
"use strict";
|
|
|
|
const BROWSER_SEARCH_PREF = "browser.search.";
|
|
|
|
function test() {
|
|
let engine = Services.search.getEngineByName("Bing");
|
|
ok(engine, "Bing");
|
|
|
|
let base = "https://www.bing.com/search?q=foo&pc=MOZI";
|
|
let url;
|
|
|
|
// Test search URLs (including purposes).
|
|
url = engine.getSubmission("foo").uri.spec;
|
|
is(url, base, "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'");
|
|
url = engine.getSubmission("foo", null, "keyword").uri.spec;
|
|
is(url, base + "&form=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'");
|
|
url = engine.getSubmission("foo", null, "homepage").uri.spec;
|
|
is(url, base + "&form=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'");
|
|
|
|
// Check search suggestion URL.
|
|
url = engine.getSubmission("foo", "application/x-suggestions+json").uri.spec;
|
|
is(url, "https://www.bing.com/osjson.aspx?query=foo&form=OSDJAS&language=" + getLocale(), "Check search suggestion URL for 'foo'");
|
|
|
|
// Check all other engine properties.
|
|
const EXPECTED_ENGINE = {
|
|
name: "Bing",
|
|
alias: null,
|
|
description: "Bing. Search by Microsoft.",
|
|
searchForm: "https://www.bing.com/search?q=&pc=MOZI",
|
|
type: Ci.nsISearchEngine.TYPE_MOZSEARCH,
|
|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j48Zvl+D2pTz/YKLGAcBxcfSZCtulEWUAhGDQW3HstcOOF8P//jKRagC+SkQE/58/0pa7c7L9N5V+aKTw3kH3FxvKXmhYI83y3VXl64Jbs3htye2/IsbH8NZB9Zabw3FT+JR/nTypYwMDAEGBw+8AtWQj71x/mU/clT92XZGT8ry7+zlzxhbnic0n+LxRZIC/8yUju5blH4siC//8z3nghfOOF8MLj2jKCnydH7EXTRVoqCjC4g0f2yXteTEHSLNCVft0WcNhM4QXxiYmEIIIATcm3mpJvn37gmX7Q8OozYYLqycloTz/wLDulRYzpDMT4QFf6NZz95gvnyjMa+27I/SM6xxGwQJj7R6rtJQYGhk8/2NaeU9t+RfH3X2ZcihWEP5Fmgazg53qfY9zsv1ed0dh4UeXbL5yKudl/R5tdd9O6T4IFGhJvyz1OHbkts/qc2qfv7LiUMTIwOGk8irW4yo8jP2O3wEzxubHcy7I1Dq+/cOIymoGBQVn0Q5rtRTXx93jUYLFAX+b1sw88p+5L4tHGy/Er2uy6m9YDRsb/eJRht8BS+emCY7q4NDAyMLhpPYixuMbD/gu/0VD1WBtezz7w9O81vvNKEE1cTfxdmu0lZdEPxBiNzwIGBoa//xhXndFYfU4NUsnwcf6Ms7jmpPGQ1BoHpwUQcOOF0OT9RoayryJNr3Oz/ybRcCIsoBwMmkp/8FoAADmgy6ulKggYAAAAAElFTkSuQmCC",
|
|
_urls : [
|
|
{
|
|
type: "application/x-suggestions+json",
|
|
method: "GET",
|
|
template: "https://www.bing.com/osjson.aspx",
|
|
params: [
|
|
{
|
|
name: "query",
|
|
value: "{searchTerms}",
|
|
purpose: undefined,
|
|
},
|
|
{
|
|
name: "form",
|
|
value: "OSDJAS",
|
|
purpose: undefined,
|
|
},
|
|
{
|
|
name: "language",
|
|
value: "{moz:locale}",
|
|
purpose: undefined,
|
|
},
|
|
],
|
|
},
|
|
{
|
|
type: "text/html",
|
|
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",
|
|
purpose: "contextmenu",
|
|
},
|
|
{
|
|
name: "form",
|
|
value: "MOZSBR",
|
|
purpose: "searchbar",
|
|
},
|
|
{
|
|
name: "form",
|
|
value: "MOZSPG",
|
|
purpose: "homepage",
|
|
},
|
|
{
|
|
name: "form",
|
|
value: "MOZLBR",
|
|
purpose:"keyword",
|
|
},
|
|
{
|
|
name: "form",
|
|
value: "MOZTSB",
|
|
purpose: "newtab",
|
|
},
|
|
],
|
|
mozparams: {},
|
|
},
|
|
],
|
|
},
|
|
};
|
|
|
|
isSubObjectOf(EXPECTED_ENGINE, engine, "Bing");
|
|
}
|