forked from mirrors/gecko-dev
Bug 1894554 - Forcefully trigger TelemetryControllers delayed initialization when opening about:telemetry. r=chutten
Differential Revision: https://phabricator.services.mozilla.com/D209165
This commit is contained in:
parent
6c253822af
commit
0047f11a7f
2 changed files with 27 additions and 0 deletions
|
|
@ -256,6 +256,15 @@ export var TelemetryController = Object.freeze({
|
||||||
promiseInitialized() {
|
promiseInitialized() {
|
||||||
return Impl.promiseInitialized();
|
return Impl.promiseInitialized();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allows to trigger TelemetryControllers delayed initialization now and waiting for its completion.
|
||||||
|
* The returned promise is guaranteed to resolve before TelemetryController is shutting down.
|
||||||
|
* @return {Promise} Resolved when delayed TelemetryController initialization completed.
|
||||||
|
*/
|
||||||
|
ensureInitialized() {
|
||||||
|
return Impl.ensureInitialized();
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
var Impl = {
|
var Impl = {
|
||||||
|
|
@ -1158,6 +1167,18 @@ var Impl = {
|
||||||
return this._delayedInitTaskDeferred.promise;
|
return this._delayedInitTaskDeferred.promise;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allows to trigger TelemetryControllers delayed initialization now and waiting for its completion.
|
||||||
|
* This will complete before TelemetryController is shutting down.
|
||||||
|
* @return {Promise} Resolved when delayed TelemetryController initialization completed.
|
||||||
|
*/
|
||||||
|
ensureInitialized() {
|
||||||
|
if (this._delayedInitTask) {
|
||||||
|
return this._delayedInitTask.finalize();
|
||||||
|
}
|
||||||
|
return Promise.resolve();
|
||||||
|
},
|
||||||
|
|
||||||
getCurrentPingData(aSubsession) {
|
getCurrentPingData(aSubsession) {
|
||||||
this._log.trace("getCurrentPingData - subsession: " + aSubsession);
|
this._log.trace("getCurrentPingData - subsession: " + aSubsession);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -352,6 +352,12 @@ var PingPicker = {
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateCurrentPingData() {
|
_updateCurrentPingData() {
|
||||||
|
TelemetryController.ensureInitialized().then(() =>
|
||||||
|
this._doUpdateCurrentPingData()
|
||||||
|
);
|
||||||
|
},
|
||||||
|
|
||||||
|
_doUpdateCurrentPingData() {
|
||||||
const subsession = document.getElementById("show-subsession-data").checked;
|
const subsession = document.getElementById("show-subsession-data").checked;
|
||||||
let ping = TelemetryController.getCurrentPingData(subsession);
|
let ping = TelemetryController.getCurrentPingData(subsession);
|
||||||
if (!ping) {
|
if (!ping) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue