Backed out changeset 3d7b77564cb7 (bug 1238810) for bc perma failures in browser_startup.js on a CLOSED TREE

This commit is contained in:
Oana Pop Rus 2019-10-24 00:38:10 +03:00
parent 98a637091e
commit 5033d599b4
8 changed files with 29 additions and 110 deletions

View File

@ -986,6 +986,7 @@ 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();
@ -1354,6 +1355,7 @@ 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,

View File

@ -263,6 +263,9 @@ 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();

View File

@ -120,6 +120,8 @@ WeaveService.prototype = {
isConfigured =
Weave.Status.checkSetup() != Weave.CLIENT_NOT_CONFIGURED;
}
let getHistogramById = Services.telemetry.getHistogramById;
getHistogramById("WEAVE_CONFIGURED").add(isConfigured);
if (isConfigured) {
this.ensureLoaded();
}

View File

@ -11891,6 +11891,14 @@
"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"],
@ -13206,6 +13214,16 @@
"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"],

View File

@ -49,11 +49,6 @@ 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;
@ -332,7 +327,6 @@ 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.
@ -1050,7 +1044,6 @@ function EnvironmentCache() {
}
p.push(this._loadAutoUpdateAsync());
p.push(this._loadIntlData());
p.push(this._updateServicesInfo());
for (const [
id,
@ -1369,7 +1362,6 @@ 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() {
@ -1386,7 +1378,6 @@ 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) {
@ -1443,9 +1434,6 @@ EnvironmentCache.prototype = {
case AUTO_UPDATE_PREF_CHANGE_TOPIC:
this._currentEnvironment.settings.update.autoDownload = aData == "true";
break;
case SERVICES_INFO_CHANGE_TOPIC:
this._updateServicesInfo();
break;
}
},
@ -1782,42 +1770,6 @@ 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.

View File

@ -14,7 +14,6 @@ This currently affects the following sections:
- profile
- add-ons
- services
Structure:
@ -87,13 +86,6 @@ 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

View File

@ -401,6 +401,7 @@
"TRANSLATION_OPPORTUNITIES",
"TRANSLATION_OPPORTUNITIES_BY_LANGUAGE",
"WEAVE_COMPLETE_SUCCESS_COUNT",
"WEAVE_CONFIGURED",
"WEAVE_CONFIGURED_MASTER_PASSWORD",
"WEAVE_START_COUNT",
"WEBCRYPTO_ALG",
@ -1039,6 +1040,7 @@
"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",
@ -1204,6 +1206,7 @@
"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",
@ -1326,6 +1329,7 @@
"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",

View File

@ -2539,60 +2539,6 @@ 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";