Bug 1400870 - Keep the attribution code on environment changes. r=chutten

This patch makes sure |_updateSettings| carries over the attribution code,
if present. Without this patch the whole "environment.settings" section
is replaced and the attribution code disppears after the first environment
change/subsession split.

MozReview-Commit-ID: 8bxjVOl2mUp

--HG--
extra : rebase_source : c611d9148fc734ac5cb751fee8b86bad4550f11b
This commit is contained in:
Alessio Placitelli 2017-09-21 09:34:58 +02:00
parent da21f7fca0
commit 0ba0ff04be
2 changed files with 7 additions and 1 deletions

View File

@ -1363,7 +1363,13 @@ EnvironmentCache.prototype = {
updateChannel = UpdateUtils.getUpdateChannel(false);
} catch (e) {}
// Make sure to retain the attribution code across environment changes.
const attributionCode =
(this._currentEnvironment.settings &&
this._currentEnvironment.settings.attribution) || {};
this._currentEnvironment.settings = {
attribution: attributionCode,
blocklistEnabled: Services.prefs.getBoolPref(PREF_BLOCKLIST_ENABLED, true),
e10sEnabled: Services.appinfo.browserTabsRemoteAutostart,
e10sMultiProcesses: Services.appinfo.maxWebProcessCount,

View File

@ -450,7 +450,7 @@ function checkSettingsSection(data) {
Assert.equal(typeof data.settings.defaultSearchEngineData, "object");
}
if ("attribution" in data.settings) {
if (gIsWindows) {
Assert.equal(typeof data.settings.attribution, "object");
Assert.equal(data.settings.attribution.source, "google.com");
}