зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1209920 - Drop support for <MozParam condition="defaultEngine", r=adw.
This commit is contained in:
Родитель
c0702597fd
Коммит
4fd72298c0
|
@ -67,7 +67,7 @@ function test() {
|
|||
|
||||
function checkSearchURL(event) {
|
||||
is(event.originalTarget.URL,
|
||||
"http://mochi.test:8888/browser/browser/components/search/test/?test=test+search&ie=utf-8&client=app&channel=contextsearch",
|
||||
"http://mochi.test:8888/browser/browser/components/search/test/?test=test+search&ie=utf-8&channel=contextsearch",
|
||||
"Checking context menu search URL");
|
||||
// Remove the tab opened by the search
|
||||
gBrowser.removeCurrentTab();
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
<Url type="text/html" method="GET" template="http://mochi.test:8888/browser/browser/components/search/test/">
|
||||
<Param name="test" value="{searchTerms}"/>
|
||||
<Param name="ie" value="utf-8"/>
|
||||
<MozParam name="client" condition="defaultEngine" trueValue="app-default" falseValue="app"/>
|
||||
<MozParam name="channel" condition="purpose" purpose="keyword" value="keywordsearch"/>
|
||||
<MozParam name="channel" condition="purpose" purpose="contextmenu" value="contextsearch"/>
|
||||
</Url>
|
||||
|
|
|
@ -1255,12 +1255,7 @@ EngineURL.prototype = {
|
|||
for (let i = 0; i < aJson.params.length; ++i) {
|
||||
let param = aJson.params[i];
|
||||
if (param.mozparam) {
|
||||
if (param.condition == "defaultEngine") {
|
||||
if (aEngine._isDefaultEngine())
|
||||
this.addParam(param.name, param.trueValue);
|
||||
else
|
||||
this.addParam(param.name, param.falseValue);
|
||||
} else if (param.condition == "pref") {
|
||||
if (param.condition == "pref") {
|
||||
let value = getMozParamPref(param.pref);
|
||||
this.addParam(param.name, value);
|
||||
}
|
||||
|
@ -2039,19 +2034,6 @@ Engine.prototype = {
|
|||
// _addMozParam is not needed here since it can be serialized fine without. _addMozParam
|
||||
// also requires a unique "name" which is not normally the case when @purpose is used.
|
||||
break;
|
||||
case "defaultEngine":
|
||||
// If this engine was the default search engine, use the true value
|
||||
if (this._isDefaultEngine())
|
||||
value = param.getAttribute("trueValue");
|
||||
else
|
||||
value = param.getAttribute("falseValue");
|
||||
url.addParam(param.getAttribute("name"), value);
|
||||
url._addMozParam({"name": param.getAttribute("name"),
|
||||
"falseValue": param.getAttribute("falseValue"),
|
||||
"trueValue": param.getAttribute("trueValue"),
|
||||
"condition": "defaultEngine"});
|
||||
break;
|
||||
|
||||
case "pref":
|
||||
try {
|
||||
value = getMozParamPref(param.getAttribute("pref"), value);
|
||||
|
@ -2073,17 +2055,6 @@ Engine.prototype = {
|
|||
this._urls.push(url);
|
||||
},
|
||||
|
||||
_isDefaultEngine: function SRCH_ENG__isDefaultEngine() {
|
||||
let defaultPrefB = Services.prefs.getDefaultBranch(BROWSER_SEARCH_PREF);
|
||||
let nsIPLS = Ci.nsIPrefLocalizedString;
|
||||
let defaultEngine;
|
||||
let pref = getGeoSpecificPrefName("defaultenginename");
|
||||
try {
|
||||
defaultEngine = defaultPrefB.getComplexValue(pref, nsIPLS).data;
|
||||
} catch (ex) {}
|
||||
return this.name == defaultEngine;
|
||||
},
|
||||
|
||||
/**
|
||||
* Get the icon from an OpenSearch Image element.
|
||||
* @see http://opensearch.a9.com/spec/1.1/description/#image
|
||||
|
|
|
@ -11,13 +11,11 @@
|
|||
<Param name="oe" value="utf-8"/>
|
||||
<Param name="aq" value="t"/>
|
||||
<!-- Dynamic parameters -->
|
||||
<MozParam name="client" condition="defaultEngine" trueValue="firefox-a" falseValue="firefox"/>
|
||||
<MozParam name="channel" condition="purpose" purpose="contextmenu" value="rcs"/>
|
||||
<MozParam name="channel" condition="purpose" purpose="keyword" value="fflb"/>
|
||||
</Url>
|
||||
<Url type="application/x-moz-default-purpose" method="GET" template="http://www.google.com/search" resultdomain="purpose.google.com">
|
||||
<Param name="q" value="{searchTerms}"/>
|
||||
<MozParam name="client" condition="defaultEngine" trueValue="firefox-a" falseValue="firefox"/>
|
||||
<!-- MozParam with a default value if purpose is not specified -->
|
||||
<MozParam name="channel" condition="purpose" purpose="" value="none"/>
|
||||
<MozParam name="channel" condition="purpose" purpose="contextmenu" value="rcs"/>
|
||||
|
|
|
@ -44,13 +44,6 @@
|
|||
"name": "aq",
|
||||
"value": "t"
|
||||
},
|
||||
{
|
||||
"name": "client",
|
||||
"falseValue": "firefox",
|
||||
"trueValue": "firefox-a",
|
||||
"condition": "defaultEngine",
|
||||
"mozparam": true
|
||||
},
|
||||
{
|
||||
"name": "channel",
|
||||
"value": "fflb",
|
||||
|
@ -74,13 +67,6 @@
|
|||
"name": "q",
|
||||
"value": "{searchTerms}"
|
||||
},
|
||||
{
|
||||
"name": "client",
|
||||
"falseValue": "firefox",
|
||||
"trueValue": "firefox-a",
|
||||
"condition": "defaultEngine",
|
||||
"mozparam": true
|
||||
},
|
||||
{
|
||||
"name": "channel",
|
||||
"value": "none",
|
||||
|
|
|
@ -273,11 +273,6 @@ var EXPECTED_ENGINE = {
|
|||
"value": "t",
|
||||
"purpose": undefined,
|
||||
},
|
||||
{
|
||||
"name": "client",
|
||||
"value": "firefox",
|
||||
"purpose": undefined,
|
||||
},
|
||||
{
|
||||
"name": "channel",
|
||||
"value": "fflb",
|
||||
|
@ -289,15 +284,6 @@ var EXPECTED_ENGINE = {
|
|||
"purpose": "contextmenu",
|
||||
},
|
||||
],
|
||||
mozparams: {
|
||||
"client": {
|
||||
"name": "client",
|
||||
"falseValue": "firefox",
|
||||
"trueValue": "firefox-a",
|
||||
"condition": "defaultEngine",
|
||||
"mozparam": true,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
type: "application/x-moz-default-purpose",
|
||||
|
@ -310,11 +296,6 @@ var EXPECTED_ENGINE = {
|
|||
"value": "{searchTerms}",
|
||||
"purpose": undefined,
|
||||
},
|
||||
{
|
||||
"name": "client",
|
||||
"value": "firefox",
|
||||
"purpose": undefined,
|
||||
},
|
||||
{
|
||||
"name": "channel",
|
||||
"value": "none",
|
||||
|
@ -331,15 +312,6 @@ var EXPECTED_ENGINE = {
|
|||
"purpose": "contextmenu",
|
||||
},
|
||||
],
|
||||
mozparams: {
|
||||
"client": {
|
||||
"name": "client",
|
||||
"falseValue": "firefox",
|
||||
"trueValue": "firefox-a",
|
||||
"condition": "defaultEngine",
|
||||
"mozparam": true,
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
|
@ -27,7 +27,7 @@ add_task(function* test_purpose() {
|
|||
base + aExpected);
|
||||
}
|
||||
|
||||
let base = "http://www.google.com/search?q=foo&ie=utf-8&oe=utf-8&aq=t&client=firefox";
|
||||
let base = "http://www.google.com/search?q=foo&ie=utf-8&oe=utf-8&aq=t";
|
||||
check_submission("", "foo");
|
||||
check_submission("", "foo", null);
|
||||
check_submission("", "foo", "text/html");
|
||||
|
@ -38,7 +38,7 @@ add_task(function* test_purpose() {
|
|||
check_submission("", "foo", "text/html", "invalid");
|
||||
|
||||
// Tests for a param that varies with a purpose but has a default value.
|
||||
base = "http://www.google.com/search?q=foo&client=firefox";
|
||||
base = "http://www.google.com/search?q=foo";
|
||||
check_submission("&channel=none", "foo", "application/x-moz-default-purpose");
|
||||
check_submission("&channel=none", "foo", "application/x-moz-default-purpose", null);
|
||||
check_submission("&channel=none", "foo", "application/x-moz-default-purpose", "");
|
||||
|
|
Загрузка…
Ссылка в новой задаче