mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 845966 - Detect more errors during FHR initialization; r=rnewman
This commit is contained in:
parent
6e10265a27
commit
288ec4b107
@ -238,17 +238,21 @@ AbstractHealthReporter.prototype = Object.freeze({
|
||||
this._initialized = false;
|
||||
this._shutdownRequested = true;
|
||||
|
||||
if (this._collectorInProgress) {
|
||||
this._log.warn("Collector is in progress of initializing. Waiting to finish.");
|
||||
return;
|
||||
}
|
||||
if (this._initializeHadError) {
|
||||
this._log.warn("Initialization had error. Shutting down immediately.");
|
||||
} else {
|
||||
if (this._collectorInProgress) {
|
||||
this._log.warn("Collector is in progress of initializing. Waiting to finish.");
|
||||
return;
|
||||
}
|
||||
|
||||
// If storage is in the process of initializing, we need to wait for it
|
||||
// to finish before continuing. The initialization process will call us
|
||||
// again once storage has initialized.
|
||||
if (this._storageInProgress) {
|
||||
this._log.warn("Storage is in progress of initializing. Waiting to finish.");
|
||||
return;
|
||||
// If storage is in the process of initializing, we need to wait for it
|
||||
// to finish before continuing. The initialization process will call us
|
||||
// again once storage has initialized.
|
||||
if (this._storageInProgress) {
|
||||
this._log.warn("Storage is in progress of initializing. Waiting to finish.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
this._log.warn("Initiating main shutdown procedure.");
|
||||
|
@ -236,6 +236,16 @@ InspectedHealthReporter.prototype = {
|
||||
return HealthReporter.prototype._onStorageCreated.call(this, storage);
|
||||
},
|
||||
|
||||
_initializeCollector: function () {
|
||||
for (let result of HealthReporter.prototype._initializeCollector.call(this)) {
|
||||
yield result;
|
||||
}
|
||||
|
||||
if (this.onInitializeCollectorFinished) {
|
||||
this.onInitializeCollectorFinished();
|
||||
}
|
||||
},
|
||||
|
||||
_onCollectorInitialized: function () {
|
||||
if (this.onCollectorInitialized) {
|
||||
this.onCollectorInitialized();
|
||||
|
@ -154,6 +154,21 @@ add_task(function test_shutdown_collector_in_progress() {
|
||||
do_check_eq(reporter.storageCloseCount, 1);
|
||||
});
|
||||
|
||||
// Simulates an error during collector initialization and verifies we shut down.
|
||||
add_task(function test_shutdown_when_collector_errors() {
|
||||
let reporter = yield getJustReporter("shutdown_when_collector_errors", SERVER_URI, true);
|
||||
|
||||
reporter.onInitializeCollectorFinished = function () {
|
||||
print("Throwing fake error.");
|
||||
throw new Error("Fake error during collector initialization.");
|
||||
};
|
||||
|
||||
// This will hang if shutdown logic is busted.
|
||||
reporter._waitForShutdown();
|
||||
do_check_eq(reporter.collectorShutdownCount, 1);
|
||||
do_check_eq(reporter.storageCloseCount, 1);
|
||||
});
|
||||
|
||||
add_task(function test_register_providers_from_category_manager() {
|
||||
const category = "healthreporter-js-modules";
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user