mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 989137 - Part 18: Fix experiments uninit behavior. r=bsmedberg
This commit is contained in:
parent
ceb826d852
commit
17b11996ae
@ -327,6 +327,14 @@ Experiments.Policy.prototype = {
|
||||
},
|
||||
};
|
||||
|
||||
function AlreadyShutdownError(message="already shut down") {
|
||||
this.name = "AlreadyShutdownError";
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
AlreadyShutdownError.prototype = new Error();
|
||||
AlreadyShutdownError.prototype.constructor = AlreadyShutdownError;
|
||||
|
||||
/**
|
||||
* Manages the experiments and provides an interface to control them.
|
||||
*/
|
||||
@ -434,7 +442,11 @@ Experiments.Experiments.prototype = {
|
||||
|
||||
this._shutdown = true;
|
||||
if (this._mainTask) {
|
||||
yield this._mainTask;
|
||||
try {
|
||||
yield this._mainTask;
|
||||
} catch (e if e instanceof AlreadyShutdownError) {
|
||||
// We error out of tasks after shutdown via that exception.
|
||||
}
|
||||
}
|
||||
|
||||
this._log.info("Completed uninitialization.");
|
||||
@ -457,7 +469,7 @@ Experiments.Experiments.prototype = {
|
||||
*/
|
||||
_checkForShutdown: function() {
|
||||
if (this._shutdown) {
|
||||
throw Error("uninit() already called");
|
||||
throw new AlreadyShutdownError("uninit() already called");
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -39,6 +39,7 @@ add_task(function* initializeState() {
|
||||
// this test running. We have to initialize the instance first, then
|
||||
// uninitialize it to prevent this.
|
||||
gExperiments = tmp.Experiments.instance();
|
||||
yield gExperiments._mainTask;
|
||||
yield gExperiments.uninit();
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user