Bug 977708 - Annotate crash reports with the current experiment, r=felipe

This commit is contained in:
Benjamin Smedberg 2014-03-24 15:38:13 -04:00
parent 0c5e899930
commit 620adcd3ea
2 changed files with 14 additions and 6 deletions

View File

@ -39,6 +39,11 @@ XPCOMUtils.defineLazyGetter(this, "CertUtils",
return mod;
});
#ifdef MOZ_CRASHREPORTER
XPCOMUtils.defineLazyServiceGetter(this, "gCrashReporter",
"@mozilla.org/xre/app-info;1",
"nsICrashReporter");
#endif
const FILE_CACHE = "experiments.json";
const OBSERVER_TOPIC = "experiments-changed";
@ -673,11 +678,6 @@ Experiments.Experiments.prototype = {
return this._pendingTasks.loadFromCache;
}
if (this._pendingTasks.updateManifest) {
// We're already updating the manifest, no need to load the cached version.
return this._pendingTasks.updateManifest;
}
let path = this._cacheFilePath;
this._pendingTasks.loadFromCache = Task.spawn(function () {
try {
@ -888,6 +888,7 @@ Experiments.Experiments.prototype = {
yield activeExperiment.stop();
yield activeExperiment.start();
} catch (e) {
gLogger.error(e);
// On failure try the next experiment.
activeExperiment = null;
}
@ -921,6 +922,7 @@ Experiments.Experiments.prototype = {
try {
yield experiment.start();
activeChanged = true;
activeExperiment = experiment;
break;
} catch (e) {
// On failure try the next experiment.
@ -933,6 +935,12 @@ Experiments.Experiments.prototype = {
Services.obs.notifyObservers(null, OBSERVER_TOPIC, null);
}
#ifdef MOZ_CRASHREPORTER
if (activeExperiment) {
gCrashReporter.annotateCrashReport("ActiveExperiment", activeExperiment.id);
}
#endif
throw new Task.Result(activeChanged);
}.bind(this));
},

View File

@ -9,7 +9,7 @@ EXTRA_COMPONENTS += [
JS_MODULES_PATH = 'modules/experiments'
EXTRA_JS_MODULES += [
EXTRA_PP_JS_MODULES += [
'Experiments.jsm',
]