This commit is contained in:
Phil Ringnalda 2014-11-28 12:02:04 -08:00
Родитель e30c04c40e c575c1bf7d
Коммит 5cd1a3aebe
21 изменённых файлов: 151 добавлений и 225 удалений

Просмотреть файл

@ -105,3 +105,11 @@ cfde3603b0206e119abea76fdd6e134b634348f1 FIREFOX_AURORA_31_BASE
dc23164ba2a289a8b22902e30990c77d9677c214 FIREFOX_AURORA_33_BASE
c360f3d1c00d73b0c1fb0a2c0da525cb55e58b83 FIREFOX_AURORA_34_BASE
cec1a116c4f9a3e887d52e9a26e8bbec200fe162 FIREFOX_AURORA_35_BASE
ca89fe55717059e4e43040d16d260765ffa9dca7 FIREFOX_AURORA_36_BASE
6047f510fb73c7dbe9866066fb01ddda3c170c9c FIREFOX_AURORA_37_BASE
ca89fe55717059e4e43040d16d260765ffa9dca7 FIREFOX_AURORA_36_BASE
0000000000000000000000000000000000000000 FIREFOX_AURORA_36_BASE
6047f510fb73c7dbe9866066fb01ddda3c170c9c FIREFOX_AURORA_37_BASE
0000000000000000000000000000000000000000 FIREFOX_AURORA_37_BASE
0000000000000000000000000000000000000000 FIREFOX_AURORA_36_BASE
b297a6727acfd21e757ddd38cd61894812666265 FIREFOX_AURORA_36_BASE

Просмотреть файл

@ -22,4 +22,4 @@
# changes to stick? As of bug 928195, this shouldn't be necessary! Please
# don't change CLOBBER for WebIDL changes any more.
Bug 1102488 - Changes to Android build system.
Merge day clobber

Просмотреть файл

@ -5,7 +5,7 @@
MOZ_APP_BASENAME=B2G
MOZ_APP_VENDOR=Mozilla
MOZ_APP_VERSION=36.0a1
MOZ_APP_VERSION=37.0a1
MOZ_APP_UA_NAME=Firefox
MOZ_UA_OS_AGNOSTIC=1

Просмотреть файл

@ -404,6 +404,11 @@ pref("browser.search.order.1", "chrome://browser-region/locale/re
pref("browser.search.order.2", "chrome://browser-region/locale/region.properties");
pref("browser.search.order.3", "chrome://browser-region/locale/region.properties");
pref("browser.search.defaultenginename.US", "data:text/plain,browser.search.defaultenginename.US=Yahoo");
pref("browser.search.order.US.1", "data:text/plain,browser.search.order.US.1=Yahoo");
pref("browser.search.order.US.2", "data:text/plain,browser.search.order.US.2=Google");
pref("browser.search.order.US.3", "data:text/plain,browser.search.order.US.3=Bing");
// search bar results always open in a new tab
pref("browser.search.openintab", false);

Просмотреть файл

@ -53,8 +53,9 @@ function test() {
ok(data.days.hasDay(now), "Have data for today.");
let day = data.days.getDay(now);
// Will need to be changed if Google isn't the default search engine.
let field = "google.contextmenu";
// Will need to be changed if Yahoo isn't the default search engine.
let defaultProviderID = "yahoo";
let field = defaultProviderID + ".contextmenu";
ok(day.has(field), "Have search recorded for context menu.");
// If any other mochitests perform a context menu search, this will fail.

Просмотреть файл

@ -27,8 +27,10 @@ add_task(function* test_healthreport_search_recording() {
let now = new Date();
let oldCount = 0;
// This will to be need changed if default search engine is not Google.
let field = "google.urlbar";
// This will to be need changed if default search engine is not Yahoo.
let defaultEngineID = "yahoo";
let field = defaultEngineID + ".urlbar";
if (data.days.hasDay(now)) {
let day = data.days.getDay(now);
@ -71,7 +73,7 @@ add_task(function* test_healthreport_search_recording() {
ok(data.days.hasDay(now), "Have engines data when Telemetry is enabled.");
day = data.days.getDay(now);
ok(day.has("default"), "We have default engine data.");
is(day.get("default"), "google", "The default engine is reported properly.");
is(day.get("default"), defaultEngineID, "The default engine is reported properly.");
// Restore.
Services.prefs.setBoolPref("toolkit.telemetry.enabled", oldTelemetry);

Просмотреть файл

@ -7,44 +7,12 @@
"use strict";
const BROWSER_SEARCH_PREF = "browser.search.";
const MOZ_PARAM_LOCALE_REGEX = /\{moz:locale\}/g;
const MOZ_PARAM_DIST_ID_REGEX = /\{moz:distributionID\}/g;
const MOZ_PARAM_OFFICIAL_REGEX = /\{moz:official\}/g;
// Custom search parameters
const MOZ_OFFICIAL = Services.appinfo.isOfficialBranding ? "official" : "unofficial";
XPCOMUtils.defineLazyGetter(this, "distributionID", () => {
try {
return Services.prefs.getCharPref(BROWSER_SEARCH_PREF + "distributionID");
} catch (ex) {
return Services.appinfo.distributionID;
}
});
XPCOMUtils.defineLazyGetter(this, "GOOGLE_CLIENT", () => {
switch (Services.appinfo.defaultUpdateChannel) {
case "beta":
return "firefox-beta";
case "aurora":
return "firefox-aurora";
case "nightly":
return "firefox-nightly";
default:
return "firefox-a";
}
});
function test() {
// Bug 992270: Ignore uncaught about:home exceptions (related to snippets from IndexedDB)
ignoreAllUncaughtExceptions(true);
function replaceUrl(base) {
return base.replace(MOZ_PARAM_LOCALE_REGEX, getLocale())
.replace(MOZ_PARAM_DIST_ID_REGEX, distributionID)
.replace(MOZ_PARAM_OFFICIAL_REGEX, MOZ_OFFICIAL);
return base;
}
let gMutationObserver = null;
@ -115,7 +83,7 @@ function test() {
},
{
name: "Search with Google from about:home",
searchURL: replaceUrl("https://www.google.com/search?q=foo&ie=utf-8&oe=utf-8&aq=t&rls={moz:distributionID}:{moz:locale}:{moz:official}&client=" + GOOGLE_CLIENT + "&channel=np&source=hp"),
searchURL: replaceUrl("https://www.google.com/search?q=foo&ie=utf-8&oe=utf-8"),
run: function () {
verify_about_home_search("Google");
}

Просмотреть файл

@ -7,52 +7,11 @@
"use strict";
const BROWSER_SEARCH_PREF = "browser.search.";
const MOZ_PARAM_LOCALE = /\{moz:locale\}/g;
const MOZ_PARAM_DIST_ID = /\{moz:distributionID\}/g;
const MOZ_PARAM_OFFICIAL = /\{moz:official\}/g;
let runtime = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime);
// Custom search parameters
const MOZ_OFFICIAL = runtime.isOfficialBranding ? "official" : "unofficial";
var google_client;
switch (runtime.defaultUpdateChannel) {
case "beta":
google_client = "firefox-beta";
break;
case "aurora":
google_client = "firefox-aurora";
break;
case "nightly":
google_client = "firefox-nightly";
break;
default:
google_client = "firefox-a";
break;
}
const GOOGLE_CLIENT = google_client;
const MOZ_DISTRIBUTION_ID = runtime.distributionID;
function test() {
let engine = Services.search.getEngineByName("Google");
ok(engine, "Google");
is(Services.search.defaultEngine, engine, "Check that Google is the default search engine");
let distributionID;
try {
distributionID = Services.prefs.getCharPref(BROWSER_SEARCH_PREF + "distributionID");
} catch (ex) {
distributionID = MOZ_DISTRIBUTION_ID;
}
let base = "https://www.google.com/search?q=foo&ie=utf-8&oe=utf-8&aq=t&rls={moz:distributionID}:{moz:locale}:{moz:official}&client=" + GOOGLE_CLIENT;
base = base.replace(MOZ_PARAM_LOCALE, getLocale());
base = base.replace(MOZ_PARAM_DIST_ID, distributionID);
base = base.replace(MOZ_PARAM_OFFICIAL, MOZ_OFFICIAL);
let base = "https://www.google.com/search?q=foo&ie=utf-8&oe=utf-8";
let url;
@ -60,15 +19,15 @@ function test() {
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 + "&channel=rcs", "Check context menu search URL for 'foo'");
is(url, base, "Check context menu search URL for 'foo'");
url = engine.getSubmission("foo", null, "keyword").uri.spec;
is(url, base + "&channel=fflb", "Check keyword search URL for 'foo'");
is(url, base, "Check keyword search URL for 'foo'");
url = engine.getSubmission("foo", null, "searchbar").uri.spec;
is(url, base + "&channel=sb", "Check search bar search URL for 'foo'");
is(url, base, "Check search bar search URL for 'foo'");
url = engine.getSubmission("foo", null, "homepage").uri.spec;
is(url, base + "&channel=np&source=hp", "Check homepage search URL for 'foo'");
is(url, base, "Check homepage search URL for 'foo'");
url = engine.getSubmission("foo", null, "newtab").uri.spec;
is(url, base + "&channel=nts", "Check newtab search URL for 'foo'");
is(url, base, "Check newtab search URL for 'foo'");
// Check search suggestion URL.
url = engine.getSubmission("foo", "application/x-suggestions+json").uri.spec;
@ -86,8 +45,7 @@ function test() {
name: "Google",
alias: null,
description: "Google Search",
searchForm: "https://www.google.com/search?q=&ie=utf-8&oe=utf-8&aq=t&rls=" +
distributionID + ":" + getLocale() + ":" + MOZ_OFFICIAL + "&client=" + GOOGLE_CLIENT,
searchForm: "https://www.google.com/search?q=&ie=utf-8&oe=utf-8",
type: Ci.nsISearchEngine.TYPE_MOZSEARCH,
hidden: false,
wrappedJSObject: {
@ -120,60 +78,8 @@ function test() {
"value": "utf-8",
"purpose": undefined,
},
{
"name": "aq",
"value": "t",
"purpose": undefined,
},
{
"name": "rls",
"value": "{moz:distributionID}:{moz:locale}:{moz:official}",
"purpose": undefined,
},
{
"name": "client",
"value": GOOGLE_CLIENT,
"purpose": undefined,
},
{
"name": "channel",
"value": "rcs",
"purpose": "contextmenu",
},
{
"name": "channel",
"value": "fflb",
"purpose": "keyword",
},
{
"name": "channel",
"value": "sb",
"purpose": "searchbar",
},
{
"name": "channel",
"value": "np",
"purpose": "homepage",
},
{
"name": "channel",
"value": "nts",
"purpose": "newtab",
},
{
"name": "source",
"value": "hp",
"purpose": "homepage",
},
],
mozparams: {
"client": {
"name": "client",
"falseValue": "firefox",
"trueValue": GOOGLE_CLIENT,
"condition": "defaultEngine",
"mozparam": true,
},
},
},
],

Просмотреть файл

@ -7,52 +7,14 @@
"use strict";
const BROWSER_SEARCH_PREF = "browser.search.";
const MOZ_PARAM_LOCALE = /\{moz:locale\}/g;
const MOZ_PARAM_DIST_ID = /\{moz:distributionID\}/g;
const MOZ_PARAM_OFFICIAL = /\{moz:official\}/g;
let runtime = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime);
// Custom search parameters
const MOZ_OFFICIAL = runtime.isOfficialBranding ? "official" : "unofficial";
var google_client;
switch (runtime.defaultUpdateChannel) {
case "beta":
google_client = "firefox-beta";
break;
case "aurora":
google_client = "firefox-aurora";
break;
case "nightly":
google_client = "firefox-nightly";
break;
default:
google_client = "firefox-a";
break;
}
const GOOGLE_CLIENT = google_client;
const MOZ_DISTRIBUTION_ID = runtime.distributionID;
function test() {
let engine = Services.search.getEngineByName("Google");
ok(engine, "Google is installed");
is(Services.search.defaultEngine, engine, "Check that Google is the default search engine");
let previouslySelectedEngine = Services.search.currentEngine;
Services.search.currentEngine = engine;
let distributionID;
try {
distributionID = Services.prefs.getCharPref(BROWSER_SEARCH_PREF + "distributionID");
} catch (ex) {
distributionID = MOZ_DISTRIBUTION_ID;
}
let base = "https://www.google.com/search?q=foo&ie=utf-8&oe=utf-8&aq=t&rls={moz:distributionID}:{moz:locale}:{moz:official}&client=" + GOOGLE_CLIENT;
base = base.replace(MOZ_PARAM_LOCALE, getLocale());
base = base.replace(MOZ_PARAM_DIST_ID, distributionID);
base = base.replace(MOZ_PARAM_OFFICIAL, MOZ_OFFICIAL);
let base = "https://www.google.com/search?q=foo&ie=utf-8&oe=utf-8";
let url;
@ -66,7 +28,7 @@ function test() {
var gTests = [
{
name: "context menu search",
searchURL: base + "&channel=rcs",
searchURL: base,
run: function () {
// Simulate a contextmenu search
// FIXME: This is a bit "low-level"...
@ -75,7 +37,7 @@ function test() {
},
{
name: "keyword search",
searchURL: base + "&channel=fflb",
searchURL: base,
run: function () {
gURLBar.value = "? foo";
gURLBar.focus();
@ -84,7 +46,7 @@ function test() {
},
{
name: "search bar search",
searchURL: base + "&channel=sb",
searchURL: base,
run: function () {
let sb = BrowserSearch.searchBar;
sb.focus();
@ -97,7 +59,7 @@ function test() {
},
{
name: "new tab search",
searchURL: base + "&channel=nts",
searchURL: base,
run: function () {
function doSearch(doc) {
// Re-add the listener, and perform a search
@ -177,6 +139,7 @@ function test() {
registerCleanupFunction(function () {
gBrowser.removeProgressListener(listener);
gBrowser.removeTab(tab);
Services.search.currentEngine = previouslySelectedEngine;
});
tab.linkedBrowser.addEventListener("load", function load() {

Просмотреть файл

@ -13,7 +13,7 @@ function test() {
let engine = Services.search.getEngineByName("Yahoo");
ok(engine, "Yahoo");
let base = "https://search.yahoo.com/search?p=foo&ei=UTF-8&fr=moz35";
let base = "https://search.yahoo.com/yhs/search?p=foo&ei=UTF-8&hspart=mozilla&hsimp=yhs-001";
let url;
// Test search URLs (including purposes).
@ -29,7 +29,7 @@ function test() {
name: "Yahoo",
alias: null,
description: "Yahoo Search",
searchForm: "https://search.yahoo.com/search?p=&ei=UTF-8&fr=moz35",
searchForm: "https://search.yahoo.com/yhs/search?p=&ei=UTF-8&hspart=mozilla&hsimp=yhs-001",
type: Ci.nsISearchEngine.TYPE_MOZSEARCH,
hidden: false,
wrappedJSObject: {
@ -61,7 +61,7 @@ function test() {
{
type: "text/html",
method: "GET",
template: "https://search.yahoo.com/search",
template: "https://search.yahoo.com/yhs/search",
params: [
{
name: "p",
@ -74,8 +74,13 @@ function test() {
purpose: undefined,
},
{
name: "fr",
value: "moz35",
name: "hspart",
value: "mozilla",
purpose: undefined,
},
{
name: "hsimp",
value: "yhs-001",
purpose: undefined,
},
],

Просмотреть файл

@ -17,7 +17,7 @@ function test() {
let previouslySelectedEngine = Services.search.currentEngine;
Services.search.currentEngine = engine;
let base = "https://search.yahoo.com/search?p=foo&ei=UTF-8&fr=moz35";
let base = "https://search.yahoo.com/yhs/search?p=foo&ei=UTF-8&hspart=mozilla&hsimp=yhs-001";
let url;
// Test search URLs (including purposes).

Просмотреть файл

@ -1 +1 @@
36.0a1
37.0a1

Просмотреть файл

@ -14,22 +14,5 @@
<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"/>
<MozParam name="channel" condition="purpose" purpose="searchbar" value="sb"/>
<MozParam name="channel" condition="purpose" purpose="homepage" value="np"/>
<MozParam name="channel" condition="purpose" purpose="newtab" value="nts"/>
<MozParam name="source" condition="purpose" purpose="homepage" value="hp"/>
</Url>
</SearchPlugin>

Просмотреть файл

@ -15,10 +15,11 @@
<Param name="appid" value="ffd" />
<Param name="command" value="{searchTerms}" />
</Url>
<Url type="text/html" method="GET" template="https://search.yahoo.com/search"
<Url type="text/html" method="GET" template="https://search.yahoo.com/yhs/search"
resultdomain="yahoo.com" rel="searchform">
<Param name="p" value="{searchTerms}"/>
<Param name="ei" value="UTF-8"/>
<MozParam name="fr" condition="pref" pref="yahoo-fr" />
<Param name="hspart" value="mozilla"/>
<Param name="hsimp" value="yhs-001"/>
</Url>
</SearchPlugin>

Просмотреть файл

@ -10,4 +10,4 @@
# hardcoded milestones in the tree from these two files.
#--------------------------------------------------------
36.0a1
37.0a1

Просмотреть файл

@ -5,7 +5,7 @@
MOZ_APP_BASENAME=Fennec
MOZ_APP_VENDOR=Mozilla
MOZ_APP_VERSION=36.0a1
MOZ_APP_VERSION=37.0a1
MOZ_APP_UA_NAME=Firefox
MOZ_BRANDING_DIRECTORY=mobile/android/branding/unofficial

Просмотреть файл

@ -11,9 +11,6 @@
<Param name="q" value="{searchTerms}"/>
<Param name="ie" value="utf-8"/>
<Param name="oe" value="utf-8"/>
<Param name="aq" value="t"/>
<!-- Dynamic parameters -->
<Param name="rls" value="{moz:distributionID}:{moz:locale}:{moz:official}"/>
</Url>
<SearchForm>https://www.google.com</SearchForm>
</SearchPlugin>

Просмотреть файл

@ -3,7 +3,7 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# Definitions used by constants.js.
weave_version := 1.38.0
weave_version := 1.39.0
weave_id := {340c2bbc-ce74-4362-90b5-7c26312808ef}
# Preprocess files.

Просмотреть файл

@ -401,6 +401,39 @@ loadListener.prototype = {
onStatus: function (aRequest, aContext, aStatus, aStatusArg) {}
}
// Hacky method that tries to determine if this user is in a US geography, and
// using an en-US build.
function getIsUS() {
// If we've set the pref before, just return that result.
let cachePref = "browser.search.isUS";
try {
return Services.prefs.getBoolPref(cachePref);
} catch(e) {}
if (getLocale() != "en-US") {
Services.prefs.setBoolPref(cachePref, false);
return false;
}
// Timezone assumptions! We assume that if the system clock's timezone is
// between Newfoundland and Hawaii, that the user is in North America.
// This includes all of South America as well, but we have relatively few
// en-US users there, so that's OK.
// 150 minutes = 2.5 hours (UTC-2.5), which is
// Newfoundland Daylight Time (http://www.timeanddate.com/time/zones/ndt)
// 600 minutes = 10 hours (UTC-10), which is
// Hawaii-Aleutian Standard Time (http://www.timeanddate.com/time/zones/hast)
let UTCOffset = (new Date()).getTimezoneOffset();
let isNA = UTCOffset >= 150 && UTCOffset <= 600;
Services.prefs.setBoolPref(cachePref, isNA);
return isNA;
}
/**
* Used to verify a given DOM node's localName and namespaceURI.
@ -2999,8 +3032,16 @@ SearchService.prototype = {
let defaultPrefB = Services.prefs.getDefaultBranch(BROWSER_SEARCH_PREF);
let nsIPLS = Ci.nsIPrefLocalizedString;
let defaultEngine;
let defPref;
if (getIsUS()) {
defPref = "defaultenginename.US";
} else {
defPref = "defaultenginename";
}
try {
defaultEngine = defaultPrefB.getComplexValue("defaultenginename", nsIPLS).data;
defaultEngine = defaultPrefB.getComplexValue(defPref, nsIPLS).data;
} catch (ex) {
// If the default pref is invalid (e.g. an add-on set it to a bogus value)
// getEngineByName will just return null, which is the best we can do.
@ -3780,7 +3821,11 @@ SearchService.prototype = {
catch (e) { }
while (true) {
engineName = getLocalizedPref(BROWSER_SEARCH_PREF + "order." + (++i));
prefName = BROWSER_SEARCH_PREF + "order.";
if (getIsUS()) {
prefName += "US.";
}
engineName = getLocalizedPref(prefName + (++i));
if (!engineName)
break;
@ -3942,7 +3987,12 @@ SearchService.prototype = {
// Now look through the "browser.search.order" branch.
for (var j = 1; ; j++) {
engineName = getLocalizedPref(BROWSER_SEARCH_PREF + "order." + j);
var prefName = BROWSER_SEARCH_PREF + "order.";
if (getIsUS()) {
prefName += "US.";
}
prefName += j;
engineName = getLocalizedPref(prefName);
if (!engineName)
break;

Просмотреть файл

@ -8,9 +8,43 @@ const kSelectedEnginePref = "browser.search.selectedEngine";
const kTestEngineName = "Test search engine";
// These two functions (getLocale and getIsUS) are copied from nsSearchService.js
function getLocale() {
let LOCALE_PREF = "general.useragent.locale";
return Services.prefs.getCharPref(LOCALE_PREF);
}
function getIsUS() {
if (getLocale() != "en-US") {
return false;
}
// Timezone assumptions! We assume that if the system clock's timezone is
// between Newfoundland and Hawaii, that the user is in North America.
// This includes all of South America as well, but we have relatively few
// en-US users there, so that's OK.
// 150 minutes = 2.5 hours (UTC-2.5), which is
// Newfoundland Daylight Time (http://www.timeanddate.com/time/zones/ndt)
// 600 minutes = 10 hours (UTC-10), which is
// Hawaii-Aleutian Standard Time (http://www.timeanddate.com/time/zones/hast)
let UTCOffset = (new Date()).getTimezoneOffset();
let isNA = UTCOffset >= 150 && UTCOffset <= 600;
return isNA;
}
function getDefaultEngineName() {
const nsIPLS = Ci.nsIPrefLocalizedString;
return Services.prefs.getComplexValue(kDefaultenginenamePref, nsIPLS).data;
// Copy the logic from nsSearchService
let pref = kDefaultenginenamePref;
if (getIsUS()) {
pref += ".US";
}
return Services.prefs.getComplexValue(pref, nsIPLS).data;
}
function waitForNotification(aExpectedData) {
@ -94,7 +128,10 @@ add_task(function* test_persistAcrossRestarts() {
// Cleanup (set the engine back to default).
Services.search.currentEngine = Services.search.defaultEngine;
do_check_eq(Services.search.currentEngine.name, getDefaultEngineName());
// This check is no longer valid with bug 1102416's patch - defaultEngine
// is not based on the same value as _originalDefaultEngine in non-Firefox
// users of the search service.
//do_check_eq(Services.search.currentEngine.name, getDefaultEngineName());
});
// An engine set without a valid hash should be ignored.

Просмотреть файл

@ -21,7 +21,7 @@ namespace mozilla {
*/
struct Module
{
static const unsigned int kVersion = 36;
static const unsigned int kVersion = 37;
struct CIDEntry;