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; return mod;
}); });
#ifdef MOZ_CRASHREPORTER
XPCOMUtils.defineLazyServiceGetter(this, "gCrashReporter",
"@mozilla.org/xre/app-info;1",
"nsICrashReporter");
#endif
const FILE_CACHE = "experiments.json"; const FILE_CACHE = "experiments.json";
const OBSERVER_TOPIC = "experiments-changed"; const OBSERVER_TOPIC = "experiments-changed";
@ -673,11 +678,6 @@ Experiments.Experiments.prototype = {
return this._pendingTasks.loadFromCache; 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; let path = this._cacheFilePath;
this._pendingTasks.loadFromCache = Task.spawn(function () { this._pendingTasks.loadFromCache = Task.spawn(function () {
try { try {
@ -888,6 +888,7 @@ Experiments.Experiments.prototype = {
yield activeExperiment.stop(); yield activeExperiment.stop();
yield activeExperiment.start(); yield activeExperiment.start();
} catch (e) { } catch (e) {
gLogger.error(e);
// On failure try the next experiment. // On failure try the next experiment.
activeExperiment = null; activeExperiment = null;
} }
@ -921,6 +922,7 @@ Experiments.Experiments.prototype = {
try { try {
yield experiment.start(); yield experiment.start();
activeChanged = true; activeChanged = true;
activeExperiment = experiment;
break; break;
} catch (e) { } catch (e) {
// On failure try the next experiment. // On failure try the next experiment.
@ -933,6 +935,12 @@ Experiments.Experiments.prototype = {
Services.obs.notifyObservers(null, OBSERVER_TOPIC, null); Services.obs.notifyObservers(null, OBSERVER_TOPIC, null);
} }
#ifdef MOZ_CRASHREPORTER
if (activeExperiment) {
gCrashReporter.annotateCrashReport("ActiveExperiment", activeExperiment.id);
}
#endif
throw new Task.Result(activeChanged); throw new Task.Result(activeChanged);
}.bind(this)); }.bind(this));
}, },

View File

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