mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-11 16:32:59 +00:00
Bug 1134268 - Part 2 - Fixup TelemetryEnvironment shutdown if the module wasnt initialized. r=vladan
This commit is contained in:
parent
54d2e0dda2
commit
159334c163
@ -261,8 +261,12 @@ this.TelemetryEnvironment = {
|
||||
*/
|
||||
shutdown: Task.async(function* () {
|
||||
if (this._shutdown) {
|
||||
this._log.error("shutdown - Already shut down");
|
||||
throw new Error("Already shut down");
|
||||
if (this._log) {
|
||||
this._log.error("shutdown - Already shut down");
|
||||
} else {
|
||||
Cu.reportError("TelemetryEnvironment.shutdown - Already shut down");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
this._log.trace("shutdown");
|
||||
|
@ -615,8 +615,10 @@ add_task(function* test_initAndShutdown() {
|
||||
TelemetryEnvironment.registerChangeListener("foo", () => {});
|
||||
TelemetryEnvironment.unregisterChangeListener("foo");
|
||||
|
||||
// Other calls after shutdown should reject.
|
||||
Assert.ok(yield isRejected(TelemetryEnvironment.shutdown()));
|
||||
// Shutting down again should be ignored.
|
||||
yield TelemetryEnvironment.shutdown();
|
||||
|
||||
// Getting the environment data should reject after shutdown.
|
||||
Assert.ok(yield isRejected(TelemetryEnvironment.getEnvironmentData()));
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user