Bug 986104 - Telemetry for reasons why XPIProvider doesn't start. r=Unfocused

This commit is contained in:
Irving Reid 2014-04-01 22:17:37 -04:00
parent b34cb3a129
commit 3bb5d2151f
2 changed files with 33 additions and 22 deletions

View File

@ -605,18 +605,29 @@ var AddonManagerInternal = {
try {
defaultProvidersEnabled = Services.prefs.getBoolPref(PREF_DEFAULT_PROVIDERS_ENABLED);
} catch (e) {}
AddonManagerPrivate.recordSimpleMeasure("default_providers", defaultProvidersEnabled);
// Ensure all default providers have had a chance to register themselves
if (defaultProvidersEnabled) {
DEFAULT_PROVIDERS.forEach(function(url) {
for (let url of DEFAULT_PROVIDERS) {
try {
Components.utils.import(url, {});
let scope = {};
Components.utils.import(url, scope);
// Sanity check - make sure the provider exports a symbol that
// has a 'startup' method
let syms = Object.keys(scope);
if ((syms.length < 1) ||
(typeof scope[syms[0]].startup != "function")) {
logger.warn("Provider " + url + " has no startup()");
AddonManagerPrivate.recordException("AMI", "provider " + url, "no startup()");
}
logger.debug("Loaded provider scope for " + url + ": " + Object.keys(scope).toSource());
}
catch (e) {
AddonManagerPrivate.recordException("AMI", "provider " + url + " load failed", e);
logger.error("Exception loading default provider \"" + url + "\"", e);
}
});
};
}
// Load any providers registered in the category manager
@ -772,6 +783,7 @@ var AddonManagerInternal = {
provider[aMethod].apply(provider, aArgs);
}
catch (e) {
AddonManagerPrivate.recordException("AMI", "provider " + aMethod, e);
logger.error("Exception calling provider " + aMethod, e);
}
}

View File

@ -9,7 +9,7 @@ const Ci = Components.interfaces;
const Cr = Components.results;
const Cu = Components.utils;
this.EXPORTED_SYMBOLS = [];
this.EXPORTED_SYMBOLS = ["XPIProvider"];
Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
@ -1545,7 +1545,7 @@ function makeSafe(aFunction) {
}
}
var XPIProvider = {
this.XPIProvider = {
// An array of known install locations
installLocations: null,
// A dictionary of known install locations by name
@ -1758,23 +1758,6 @@ var XPIProvider = {
* if it is a new profile or the version is unknown
*/
startup: function XPI_startup(aAppChanged, aOldAppVersion, aOldPlatformVersion) {
logger.debug("startup");
this.runPhase = XPI_STARTING;
this.installs = [];
this.installLocations = [];
this.installLocationsByName = {};
// Hook for tests to detect when saving database at shutdown time fails
this._shutdownError = null;
// Clear this at startup for xpcshell test restarts
this._telemetryDetails = {};
// Clear the set of enabled experiments (experiments disabled by default).
this._enabledExperiments = new Set();
// Register our details structure with AddonManager
AddonManagerPrivate.setTelemetryDetails("XPI", this._telemetryDetails);
AddonManagerPrivate.recordTimestamp("XPI_startup_begin");
function addDirectoryInstallLocation(aName, aKey, aPaths, aScope, aLocked) {
try {
var dir = FileUtils.getDir(aKey, aPaths);
@ -1811,6 +1794,22 @@ var XPIProvider = {
}
try {
AddonManagerPrivate.recordTimestamp("XPI_startup_begin");
logger.debug("startup");
this.runPhase = XPI_STARTING;
this.installs = [];
this.installLocations = [];
this.installLocationsByName = {};
// Hook for tests to detect when saving database at shutdown time fails
this._shutdownError = null;
// Clear this at startup for xpcshell test restarts
this._telemetryDetails = {};
// Clear the set of enabled experiments (experiments disabled by default).
this._enabledExperiments = new Set();
// Register our details structure with AddonManager
AddonManagerPrivate.setTelemetryDetails("XPI", this._telemetryDetails);
let hasRegistry = ("nsIWindowsRegKey" in Ci);
let enabledScopes = Prefs.getIntPref(PREF_EM_ENABLED_SCOPES,