Bug 1222042 - Dont try to show ping data in about:telemetry if Telemetry is disabled. r=dexter

This commit is contained in:
rthyberg 2015-11-16 14:27:00 +01:00
parent 4526eb0ffe
commit 6e37b85f37
2 changed files with 9 additions and 1 deletions

View File

@ -232,7 +232,7 @@ this.TelemetryController = Object.freeze({
* Get the current session ping data as it would be sent out or stored.
*
* @param {bool} aSubsession Whether to get subsession data. Optional, defaults to false.
* @return {object} The current ping data in object form.
* @return {object} The current ping data if Telemetry is enabled, null otherwise.
*/
getCurrentPingData: function(aSubsession = false) {
return Impl.getCurrentPingData(aSubsession);
@ -956,6 +956,11 @@ var Impl = {
getCurrentPingData: function(aSubsession) {
this._log.trace("getCurrentPingData - subsession: " + aSubsession)
// Telemetry is disabled, don't gather any data.
if (!Telemetry.canRecordBase) {
return null;
}
const reason = aSubsession ? REASON_GATHER_SUBSESSION_PAYLOAD : REASON_GATHER_PAYLOAD;
const type = PING_TYPE_MAIN;
const payload = TelemetrySession.getPayload(reason);

View File

@ -328,6 +328,9 @@ var PingPicker = {
_updateCurrentPingData: function() {
const subsession = document.getElementById("show-subsession-data").checked;
const ping = TelemetryController.getCurrentPingData(subsession);
if (!ping) {
return;
}
displayPingData(ping, true);
},