зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1238810 - Replace {FXA,WEAVE}_CONFIGURED with entries in the telemetry environment. r=chutten,markh,loines
Replace {FXA,WEAVE}_CONFIGURED with entries in the telemetry environment Differential Revision: https://phabricator.services.mozilla.com/D49166 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
9cd142917f
Коммит
962b41a45b
|
@ -986,7 +986,6 @@ FxAccountsInternal.prototype = {
|
|||
if (!this.isUserEmailVerified(credentials)) {
|
||||
this.startVerifiedCheck(credentials);
|
||||
}
|
||||
Services.telemetry.getHistogramById("FXA_CONFIGURED").add(1);
|
||||
await this.notifyObservers(ONLOGIN_NOTIFICATION);
|
||||
await this.updateDeviceRegistration();
|
||||
return currentAccountState.resolve();
|
||||
|
@ -1355,7 +1354,6 @@ FxAccountsInternal.prototype = {
|
|||
let currentState = this.currentAccountState;
|
||||
return currentState.getUserAccountData().then(data => {
|
||||
if (data) {
|
||||
Services.telemetry.getHistogramById("FXA_CONFIGURED").add(1);
|
||||
if (!this.isUserEmailVerified(data)) {
|
||||
this.startPollEmailStatus(
|
||||
currentState,
|
||||
|
|
|
@ -263,9 +263,6 @@ add_task(async function test_get_signed_in_user_initially_unset() {
|
|||
Assert.equal(result, null);
|
||||
|
||||
await account._internal.setSignedInUser(credentials);
|
||||
let histogram = Services.telemetry.getHistogramById("FXA_CONFIGURED");
|
||||
Assert.equal(histogram.snapshot().sum, 1);
|
||||
histogram.clear();
|
||||
|
||||
// getSignedInUser only returns a subset.
|
||||
result = await account.getSignedInUser();
|
||||
|
|
|
@ -120,8 +120,6 @@ WeaveService.prototype = {
|
|||
isConfigured =
|
||||
Weave.Status.checkSetup() != Weave.CLIENT_NOT_CONFIGURED;
|
||||
}
|
||||
let getHistogramById = Services.telemetry.getHistogramById;
|
||||
getHistogramById("WEAVE_CONFIGURED").add(isConfigured);
|
||||
if (isConfigured) {
|
||||
this.ensureLoaded();
|
||||
}
|
||||
|
|
|
@ -11893,14 +11893,6 @@
|
|||
"n_values": 6,
|
||||
"description": "1 = No SHA1 signatures, 2 = SHA1 certificates issued by an imported root, 3 = SHA1 certificates issued before 2016, 4 = SHA1 certificates issued after 2015, 5 = another error prevented successful verification"
|
||||
},
|
||||
"WEAVE_CONFIGURED": {
|
||||
"record_in_processes": ["main", "content"],
|
||||
"products": ["firefox", "fennec", "geckoview"],
|
||||
"expires_in_version": "default",
|
||||
"kind": "boolean",
|
||||
"description": "If any version of Firefox Sync is configured for this device",
|
||||
"releaseChannelCollection": "opt-out"
|
||||
},
|
||||
"WEAVE_CONFIGURED_MASTER_PASSWORD": {
|
||||
"record_in_processes": ["main", "content"],
|
||||
"products": ["firefox", "fennec", "geckoview"],
|
||||
|
@ -13216,16 +13208,6 @@
|
|||
"releaseChannelCollection": "opt-out",
|
||||
"description": "Time spent waiting for a navigator.requestMediaKeySystemAccess call to fail."
|
||||
},
|
||||
"FXA_CONFIGURED": {
|
||||
"record_in_processes": ["main", "content"],
|
||||
"products": ["firefox", "fennec", "geckoview"],
|
||||
"alert_emails": ["sync-dev@mozilla.org"],
|
||||
"bug_numbers": [1236383],
|
||||
"expires_in_version": "never",
|
||||
"kind": "flag",
|
||||
"releaseChannelCollection": "opt-out",
|
||||
"description": "If the user is signed in to a Firefox Account on this device. Recorded once per session just after startup as Sync is initialized."
|
||||
},
|
||||
"WEAVE_DEVICE_COUNT_DESKTOP": {
|
||||
"record_in_processes": ["main", "content"],
|
||||
"products": ["firefox", "fennec", "geckoview"],
|
||||
|
|
|
@ -49,6 +49,11 @@ ChromeUtils.defineModuleGetter(
|
|||
"UpdateUtils",
|
||||
"resource://gre/modules/UpdateUtils.jsm"
|
||||
);
|
||||
ChromeUtils.defineModuleGetter(
|
||||
this,
|
||||
"fxAccounts",
|
||||
"resource://gre/modules/FxAccounts.jsm"
|
||||
);
|
||||
|
||||
// The maximum length of a string (e.g. description) in the addons section.
|
||||
const MAX_ADDON_STRING_LENGTH = 100;
|
||||
|
@ -327,6 +332,7 @@ const SESSIONSTORE_WINDOWS_RESTORED_TOPIC = "sessionstore-windows-restored";
|
|||
const PREF_CHANGED_TOPIC = "nsPref:changed";
|
||||
const BLOCKLIST_LOADED_TOPIC = "plugin-blocklist-loaded";
|
||||
const AUTO_UPDATE_PREF_CHANGE_TOPIC = "auto-update-config-change";
|
||||
const SERVICES_INFO_CHANGE_TOPIC = "sync-ui-state:update";
|
||||
|
||||
/**
|
||||
* Enforces the parameter to a boolean value.
|
||||
|
@ -1362,6 +1368,7 @@ EnvironmentCache.prototype = {
|
|||
Services.obs.addObserver(this, SEARCH_ENGINE_MODIFIED_TOPIC);
|
||||
Services.obs.addObserver(this, SEARCH_SERVICE_TOPIC);
|
||||
Services.obs.addObserver(this, AUTO_UPDATE_PREF_CHANGE_TOPIC);
|
||||
Services.obs.addObserver(this, SERVICES_INFO_CHANGE_TOPIC);
|
||||
},
|
||||
|
||||
_removeObservers() {
|
||||
|
@ -1378,6 +1385,7 @@ EnvironmentCache.prototype = {
|
|||
Services.obs.removeObserver(this, SEARCH_ENGINE_MODIFIED_TOPIC);
|
||||
Services.obs.removeObserver(this, SEARCH_SERVICE_TOPIC);
|
||||
Services.obs.removeObserver(this, AUTO_UPDATE_PREF_CHANGE_TOPIC);
|
||||
Services.obs.removeObserver(this, SERVICES_INFO_CHANGE_TOPIC);
|
||||
},
|
||||
|
||||
observe(aSubject, aTopic, aData) {
|
||||
|
@ -1434,6 +1442,9 @@ EnvironmentCache.prototype = {
|
|||
case AUTO_UPDATE_PREF_CHANGE_TOPIC:
|
||||
this._currentEnvironment.settings.update.autoDownload = aData == "true";
|
||||
break;
|
||||
case SERVICES_INFO_CHANGE_TOPIC:
|
||||
this._updateServicesInfo();
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -1770,6 +1781,42 @@ EnvironmentCache.prototype = {
|
|||
this._currentEnvironment.settings.intl = getIntlSettings();
|
||||
Policy._intlLoaded = true;
|
||||
},
|
||||
// This exists as a separate function for testing.
|
||||
async _getFxaSignedInUser() {
|
||||
return fxAccounts.getSignedInUser();
|
||||
},
|
||||
|
||||
async _updateServicesInfo() {
|
||||
let syncEnabled = false;
|
||||
let accountEnabled = false;
|
||||
let weaveService = Cc["@mozilla.org/weave/service;1"].getService()
|
||||
.wrappedJSObject;
|
||||
syncEnabled = weaveService && weaveService.enabled;
|
||||
if (syncEnabled) {
|
||||
// All sync users are account users, definitely.
|
||||
accountEnabled = true;
|
||||
} else {
|
||||
// Not all account users are sync users. See if they're signed into FxA.
|
||||
try {
|
||||
let user = await this._getFxaSignedInUser();
|
||||
if (user) {
|
||||
accountEnabled = true;
|
||||
}
|
||||
} catch (e) {
|
||||
// We don't know. This might be a transient issue which will clear
|
||||
// itself up later, but the information in telemetry is quite possibly stale
|
||||
// (this is called from a change listener), so clear it out to avoid
|
||||
// reporting data which might be wrong until we can figure it out.
|
||||
delete this._currentEnvironment.services;
|
||||
this._log.error("_updateServicesInfo() caught error", e);
|
||||
return;
|
||||
}
|
||||
}
|
||||
this._currentEnvironment.services = {
|
||||
accountEnabled,
|
||||
syncEnabled,
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Get the partner data in object form.
|
||||
|
|
|
@ -14,6 +14,7 @@ This currently affects the following sections:
|
|||
|
||||
- profile
|
||||
- add-ons
|
||||
- services
|
||||
|
||||
|
||||
Structure:
|
||||
|
@ -86,6 +87,13 @@ Structure:
|
|||
effectiveContentProcessLevel: <integer>,
|
||||
}
|
||||
},
|
||||
// Optional, missing if fetching the information failed or had not yet completed.
|
||||
services: {
|
||||
// True if the user has a firefox account
|
||||
accountEnabled: <bool>,
|
||||
// True if the user has sync enabled.
|
||||
syncEnabled: <bool>
|
||||
},
|
||||
profile: {
|
||||
creationDate: <integer>, // integer days since UNIX epoch, e.g. 16446
|
||||
resetDate: <integer>, // integer days since UNIX epoch, e.g. 16446 - optional
|
||||
|
|
|
@ -401,7 +401,6 @@
|
|||
"TRANSLATION_OPPORTUNITIES",
|
||||
"TRANSLATION_OPPORTUNITIES_BY_LANGUAGE",
|
||||
"WEAVE_COMPLETE_SUCCESS_COUNT",
|
||||
"WEAVE_CONFIGURED",
|
||||
"WEAVE_CONFIGURED_MASTER_PASSWORD",
|
||||
"WEAVE_START_COUNT",
|
||||
"WEBCRYPTO_ALG",
|
||||
|
@ -1040,7 +1039,6 @@
|
|||
"VIDEO_EME_REQUEST_FAILURE_LATENCY_MS",
|
||||
"VIDEO_EME_REQUEST_SUCCESS_LATENCY_MS",
|
||||
"WEAVE_COMPLETE_SUCCESS_COUNT",
|
||||
"WEAVE_CONFIGURED",
|
||||
"WEAVE_CONFIGURED_MASTER_PASSWORD",
|
||||
"WEAVE_START_COUNT",
|
||||
"WEBCRYPTO_ALG",
|
||||
|
@ -1206,7 +1204,6 @@
|
|||
"FX_THUMBNAILS_BG_QUEUE_SIZE_ON_CAPTURE",
|
||||
"AUTO_REJECTED_TRANSLATION_OFFERS",
|
||||
"TRANSLATED_CHARACTERS",
|
||||
"WEAVE_CONFIGURED",
|
||||
"NEWTAB_PAGE_ENABLED",
|
||||
"MOZ_SQLITE_OPEN_MS",
|
||||
"SHOULD_TRANSLATION_UI_APPEAR",
|
||||
|
@ -1329,7 +1326,6 @@
|
|||
"FENNEC_SYNC_NUMBER_OF_SYNCS_FAILED_BACKOFF",
|
||||
"FENNEC_SYNC_NUMBER_OF_SYNCS_STARTED",
|
||||
"FENNEC_WAS_KILLED",
|
||||
"FXA_CONFIGURED",
|
||||
"FX_BROWSER_FULLSCREEN_USED",
|
||||
"FX_CONTENT_CRASH_DUMP_UNAVAILABLE",
|
||||
"FX_CONTENT_CRASH_NOT_SUBMITTED",
|
||||
|
|
|
@ -2539,6 +2539,60 @@ if (gIsWindows) {
|
|||
});
|
||||
}
|
||||
|
||||
add_task(async function test_environmentServicesInfo() {
|
||||
let cache = TelemetryEnvironment.testCleanRestart();
|
||||
await cache.onInitialized();
|
||||
let oldGetFxaSignedInUser = cache._getFxaSignedInUser;
|
||||
try {
|
||||
// Test the 'yes to both' case.
|
||||
|
||||
// This makes the weave service return that the usere is definitely a sync user
|
||||
Preferences.set("services.sync.username", "c00lperson123@example.com");
|
||||
let calledFxa = false;
|
||||
cache._getFxaSignedInUser = () => {
|
||||
calledFxa = true;
|
||||
return null;
|
||||
};
|
||||
|
||||
await cache._updateServicesInfo();
|
||||
ok(!calledFxa, "Shouldn't need to ask FxA if they're definitely signed in");
|
||||
deepEqual(cache.currentEnvironment.services, {
|
||||
accountEnabled: true,
|
||||
syncEnabled: true,
|
||||
});
|
||||
|
||||
// Test the fxa-but-not-sync case.
|
||||
Preferences.reset("services.sync.username");
|
||||
// We don't actually inspect the returned object, just t
|
||||
cache._getFxaSignedInUser = async () => {
|
||||
return {};
|
||||
};
|
||||
await cache._updateServicesInfo();
|
||||
deepEqual(cache.currentEnvironment.services, {
|
||||
accountEnabled: true,
|
||||
syncEnabled: false,
|
||||
});
|
||||
// Test the "no to both" case.
|
||||
cache._getFxaSignedInUser = async () => {
|
||||
return null;
|
||||
};
|
||||
await cache._updateServicesInfo();
|
||||
deepEqual(cache.currentEnvironment.services, {
|
||||
accountEnabled: false,
|
||||
syncEnabled: false,
|
||||
});
|
||||
// And finally, the 'fxa is in an error state' case.
|
||||
cache._getFxaSignedInUser = () => {
|
||||
throw new Error("You'll never know");
|
||||
};
|
||||
await cache._updateServicesInfo();
|
||||
equal(cache.currentEnvironment.services, null);
|
||||
} finally {
|
||||
cache._getFxaSignedInUser = oldGetFxaSignedInUser;
|
||||
Preferences.reset("services.sync.username");
|
||||
}
|
||||
});
|
||||
|
||||
add_task(async function test_environmentShutdown() {
|
||||
// Define and reset the test preference.
|
||||
const PREF_TEST = "toolkit.telemetry.test.pref1";
|
||||
|
|
Загрузка…
Ссылка в новой задаче