Merge pull request #11463 from Snuffleupagus/bug-1606566

[Firefox] Ensure that telemetry will be correctly recorded even when the PDF header is missing (bug 1606566)
This commit is contained in:
Rob Wu 2020-01-01 23:02:42 +01:00 committed by GitHub
commit b833f84307
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1314,7 +1314,28 @@ const PDFViewerApplication = {
PDFJSDev.test("FIREFOX || MOZCENTRAL") PDFJSDev.test("FIREFOX || MOZCENTRAL")
) { ) {
// Telemetry labels must be C++ variable friendly. // Telemetry labels must be C++ variable friendly.
const versionId = `v${info.PDFFormatVersion.replace(".", "_")}`; let versionId = "other";
// Keep these in sync with mozilla central's Histograms.json.
const KNOWN_VERSIONS = [
"1.0",
"1.1",
"1.2",
"1.3",
"1.4",
"1.5",
"1.6",
"1.7",
"1.8",
"1.9",
"2.0",
"2.1",
"2.2",
"2.3",
];
if (KNOWN_VERSIONS.includes(info.PDFFormatVersion)) {
versionId = `v${info.PDFFormatVersion.replace(".", "_")}`;
}
let generatorId = "other"; let generatorId = "other";
// Keep these in sync with mozilla central's Histograms.json. // Keep these in sync with mozilla central's Histograms.json.
const KNOWN_GENERATORS = [ const KNOWN_GENERATORS = [