Fix flaky chrome://webrtc-internals stats reporting bug.

A timer polls stats regularly, using standard or legacy stats as
specified in a UI. Which stats to use can change while a pending request
is in progress. This CL adds a check to discard legacy stats that are
given to JS if we are not currently expecting legacy stats.
This is something we were already doing for addStandardStats() but had
forgotten to add to addLegacyStats(). The bug was only apparent every
now and then depending on timing.

Drive-by: Rename "nukeStatsList" to "clearStatsList"


Bug: 803014
Change-Id: I5323d58f25792c2b34f2432fe1e8482008db1f39
Reviewed-by: Guido Urdaneta <>
Commit-Queue: Henrik Boström <>
Cr-Commit-Position: refs/heads/master@{#653146}
2 files changed