mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-03 23:30:46 +00:00
Bug 587780 - Part 3 - Switch consumers from using a special content-type to the purpose argument. r=rnewman,gavin
--HG-- extra : rebase_source : 0803327b33f416fb0c679015495d376f6bce19a0
This commit is contained in:
parent
9f5ae308bc
commit
3b61721a12
@ -236,7 +236,7 @@
|
||||
oncommand="AddKeywordForSearchField();"/>
|
||||
<menuitem id="context-searchselect"
|
||||
oncommand="BrowserSearch.loadSearch(getBrowserSelection(), true,
|
||||
'application/x-moz-contextsearch');"/>
|
||||
'contextmenu');"/>
|
||||
<menuseparator id="frame-sep"/>
|
||||
<menu id="frame" label="&thisFrameMenu.label;" accesskey="&thisFrameMenu.accesskey;">
|
||||
<menupopup>
|
||||
|
@ -17,7 +17,7 @@ var pairs = [
|
||||
["1.1.1.1", "http://1.1.1.1/"],
|
||||
["ftp://example", "ftp://example/"],
|
||||
["ftp.example.bar", "ftp://ftp.example.bar/"],
|
||||
["ex ample", Services.search.originalDefaultEngine.getSubmission("ex ample", "application/x-moz-keywordsearch").uri.spec],
|
||||
["ex ample", Services.search.originalDefaultEngine.getSubmission("ex ample", null, "keyword").uri.spec],
|
||||
];
|
||||
|
||||
function testNext() {
|
||||
|
@ -7,12 +7,12 @@ var gTests = [
|
||||
{
|
||||
name: "normal search (search service)",
|
||||
testText: "test search",
|
||||
searchURL: Services.search.originalDefaultEngine.getSubmission("test search", "application/x-moz-keywordsearch").uri.spec
|
||||
searchURL: Services.search.originalDefaultEngine.getSubmission("test search", null, "keyword").uri.spec
|
||||
},
|
||||
{
|
||||
name: "?-prefixed search (search service)",
|
||||
testText: "? foo ",
|
||||
searchURL: Services.search.originalDefaultEngine.getSubmission("foo", "application/x-moz-keywordsearch").uri.spec
|
||||
searchURL: Services.search.originalDefaultEngine.getSubmission("foo", null, "keyword").uri.spec
|
||||
},
|
||||
{
|
||||
name: "normal search (keyword.url)",
|
||||
|
@ -8,18 +8,8 @@
|
||||
<Param name="test" value="{searchTerms}"/>
|
||||
<Param name="ie" value="utf-8"/>
|
||||
<MozParam name="client" condition="defaultEngine" trueValue="app-default" falseValue="app"/>
|
||||
</Url>
|
||||
<Url type="application/x-moz-keywordsearch" 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"/>
|
||||
<Param name="channel" value="keywordsearch"/>
|
||||
</Url>
|
||||
<Url type="application/x-moz-contextsearch" 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"/>
|
||||
<Param name="channel" value="contextsearch"/>
|
||||
<MozParam name="channel" condition="purpose" purpose="keyword" value="keywordsearch"/>
|
||||
<MozParam name="channel" condition="purpose" purpose="contextmenu" value="contextsearch"/>
|
||||
</Url>
|
||||
<SearchForm>http://mochi.test:8888/browser/browser/components/search/test/</SearchForm>
|
||||
</SearchPlugin>
|
||||
|
@ -13,13 +13,9 @@
|
||||
</Url>
|
||||
<Url type="text/html" method="GET" template="http://www.bing.com/search">
|
||||
<Param name="q" value="{searchTerms}"/>
|
||||
<Param name="form" value="MOZSBR"/>
|
||||
<MozParam name="pc" condition="pref" pref="ms-pc"/>
|
||||
</Url>
|
||||
<Url type="application/x-moz-keywordsearch" method="GET" template="http://www.bing.com/search">
|
||||
<Param name="q" value="{searchTerms}"/>
|
||||
<Param name="form" value="MOZLBR"/>
|
||||
<MozParam name="pc" condition="pref" pref="ms-pc"/>
|
||||
<MozParam name="form" condition="purpose" purpose="" value="MOZSBR"/>
|
||||
<MozParam name="form" condition="purpose" purpose="keyword" value="MOZLBR"/>
|
||||
</Url>
|
||||
<SearchForm>http://www.bing.com/search</SearchForm>
|
||||
</SearchPlugin>
|
||||
|
@ -2,16 +2,6 @@
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
|
||||
#define GOOGLE_PARAMS <Param name="q" value="{searchTerms}"/><Param name="ie" value="utf-8"/><Param name="oe" value="utf-8"/><Param name="aq" value="t"/><Param name="rls" value="{moz:distributionID}:{moz:locale}:{moz:official}"/>
|
||||
#if MOZ_UPDATE_CHANNEL == beta
|
||||
#define GOOGLE_CLIENT_PARAM <MozParam name="client" condition="defaultEngine" trueValue="firefox-beta" falseValue="firefox"/>
|
||||
#elif MOZ_UPDATE_CHANNEL == aurora
|
||||
#define GOOGLE_CLIENT_PARAM <MozParam name="client" condition="defaultEngine" trueValue="firefox-aurora" falseValue="firefox"/>
|
||||
#elif MOZ_UPDATE_CHANNEL == nightly
|
||||
#define GOOGLE_CLIENT_PARAM <MozParam name="client" condition="defaultEngine" trueValue="firefox-nightly" falseValue="firefox"/>
|
||||
#else
|
||||
#define GOOGLE_CLIENT_PARAM <MozParam name="client" condition="defaultEngine" trueValue="firefox-a" falseValue="firefox"/>
|
||||
#endif
|
||||
<SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/">
|
||||
<ShortName>Google</ShortName>
|
||||
<Description>Google Search</Description>
|
||||
@ -19,20 +9,22 @@
|
||||
<Image width="16" height="16">data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABUUlEQVR42pWTzUsCYRCH9y9zu3SooCCkjhIRRLeIykXokiWCJ7PvDpZRlz6si1lIQZ3SQxQdOhREpgSm0JeQvfu0+i6I7LKLh4F5h5nnnRl+o6jTdHn8omAYbVqhXqvYFXcEBKFDwcoZZB8B4LkEB9cwGGmFKHb01A1EU9JXzfdvDYZi1lwLwBcVAIwsNWPesIwls7gDtB2Z7N9ujVe+IX2LO2AgItB1OL9vJqsmILDrOoK02IkBAdYy4FsQJC5h+VQCHQDWTqYSgo8fuHuRxS4Ae3stQ7UGE5ttAHqCUgfxC7m4ryrowOyeO6CxqHwZxtYFqtYc5+kNan/gDTsAeueEIRj7n/rmRQMwueUAGF0VAAT3rQBTC0Y3DoDOGbm00icML4oWHYSTgo0MFqjlmPpDgqMcFCuQf4erBzjOwXjcriu9qHg0uutO2+es6fl67T9ptebvFRjBVgAAAABJRU5ErkJggg==</Image>
|
||||
<Url type="application/x-suggestions+json" method="GET" template="https://www.google.com/complete/search?client=firefox&q={searchTerms}"/>
|
||||
<Url type="text/html" method="GET" template="https://www.google.com/search">
|
||||
#expand __GOOGLE_PARAMS__
|
||||
#expand __GOOGLE_CLIENT_PARAM__
|
||||
</Url>
|
||||
<!-- Keyword search URL is the same as the default, but with an additional parameter -->
|
||||
<Url type="application/x-moz-keywordsearch" method="GET" template="https://www.google.com/search">
|
||||
#expand __GOOGLE_PARAMS__
|
||||
#expand __GOOGLE_CLIENT_PARAM__
|
||||
<Param name="channel" value="fflb"/>
|
||||
</Url>
|
||||
<!-- Context/Right-click search URL is the same as the default, but with an additional parameter -->
|
||||
<Url type="application/x-moz-contextsearch" method="GET" template="https://www.google.com/search">
|
||||
#expand __GOOGLE_PARAMS__
|
||||
#expand __GOOGLE_CLIENT_PARAM__
|
||||
<Param name="channel" value="rcs"/>
|
||||
<Param name="q" value="{searchTerms}"/>
|
||||
<Param name="ie" value="utf-8"/>
|
||||
<Param name="oe" value="utf-8"/>
|
||||
<Param name="aq" value="t"/>
|
||||
<Param name="rls" value="{moz:distributionID}:{moz:locale}:{moz:official}"/>
|
||||
#if MOZ_UPDATE_CHANNEL == beta
|
||||
<MozParam name="client" condition="defaultEngine" trueValue="firefox-beta" falseValue="firefox"/>
|
||||
#elif MOZ_UPDATE_CHANNEL == aurora
|
||||
<MozParam name="client" condition="defaultEngine" trueValue="firefox-aurora" falseValue="firefox"/>
|
||||
#elif MOZ_UPDATE_CHANNEL == nightly
|
||||
<MozParam name="client" condition="defaultEngine" trueValue="firefox-nightly" falseValue="firefox"/>
|
||||
#else
|
||||
<MozParam name="client" condition="defaultEngine" trueValue="firefox-a" falseValue="firefox"/>
|
||||
#endif
|
||||
<MozParam name="channel" condition="purpose" purpose="contextmenu" value="rcs"/>
|
||||
<MozParam name="channel" condition="purpose" purpose="keyword" value="fflb"/>
|
||||
</Url>
|
||||
<SearchForm>https://www.google.com/</SearchForm>
|
||||
</SearchPlugin>
|
||||
|
@ -367,22 +367,12 @@ NS_IMETHODIMP nsDefaultURIFixup::KeywordToURI(const nsACString& aKeyword,
|
||||
searchSvc->GetOriginalDefaultEngine(getter_AddRefs(defaultEngine));
|
||||
if (defaultEngine) {
|
||||
nsCOMPtr<nsISearchSubmission> submission;
|
||||
// We want to allow default search plugins to specify alternate
|
||||
// parameters that are specific to keyword searches. For the moment,
|
||||
// do this by first looking for a magic
|
||||
// "application/x-moz-keywordsearch" submission type. In the future,
|
||||
// we should instead use a solution that relies on bug 587780.
|
||||
// We allow default search plugins to specify alternate
|
||||
// parameters that are specific to keyword searches.
|
||||
defaultEngine->GetSubmission(NS_ConvertUTF8toUTF16(keyword),
|
||||
NS_LITERAL_STRING("application/x-moz-keywordsearch"),
|
||||
EmptyString(),
|
||||
NS_LITERAL_STRING("keyword"),
|
||||
getter_AddRefs(submission));
|
||||
// If getting the special x-moz-keywordsearch submission type failed,
|
||||
// fall back to the default response type.
|
||||
if (!submission) {
|
||||
defaultEngine->GetSubmission(NS_ConvertUTF8toUTF16(keyword),
|
||||
EmptyString(),
|
||||
getter_AddRefs(submission));
|
||||
}
|
||||
|
||||
if (submission) {
|
||||
// The submission depends on POST data (i.e. the search engine's
|
||||
// "method" is POST), we can't use this engine for keyword
|
||||
|
Loading…
x
Reference in New Issue
Block a user