Bug 1120409 - nsITelemetry.histogramSnapshots will no longer return keyed histograms. r=gfritzsche

This commit is contained in:
Gregory Moore 2017-02-22 14:53:56 -08:00
parent 557f236c19
commit 7acf827c12
2 changed files with 14 additions and 0 deletions

View File

@ -2279,6 +2279,12 @@ TelemetryHistogram::CreateHistogramSnapshots(JSContext *cx,
continue;
}
mozilla::Telemetry::HistogramID id;
nsresult rv = internal_GetHistogramEnumId(h->histogram_name().c_str(), &id);
if (NS_WARN_IF(NS_FAILED(rv)) || gHistograms[id].keyed) {
continue;
}
Histogram* original = h;
#if !defined(MOZ_WIDGET_ANDROID)
if (subsession) {

View File

@ -757,6 +757,14 @@ add_task(function* test_keyed_histogram_recording_enabled() {
"Keyed histogram add should not record when recording is disabled");
});
add_task(function* test_histogramSnapshots() {
let keyed = Telemetry.getKeyedHistogramById("TELEMETRY_TEST_KEYED_COUNT");
keyed.add("a", 1);
// Check that keyed histograms are not returned
Assert.ok(!("TELEMETRY_TEST_KEYED_COUNT#a" in Telemetry.histogramSnapshots));
});
add_task(function* test_datasets() {
// Check that datasets work as expected.