From aeceee1df3362de4c22e834da230ba408baaae5c Mon Sep 17 00:00:00 2001 From: calixteman Date: Wed, 29 Oct 2025 15:41:34 +0100 Subject: [PATCH] Revert "Add some telemetry in order to know what are the certificates used in pdfs (bug 1973573)" --- src/core/document.js | 62 -------------------------------------------- web/app.js | 7 ----- 2 files changed, 69 deletions(-) diff --git a/src/core/document.js b/src/core/document.js index a3892751f..7bc738bb5 100644 --- a/src/core/document.js +++ b/src/core/document.js @@ -1167,49 +1167,6 @@ class PDFDocument { }); } - #collectSignatureCertificates( - fields, - collectedSignatureCertificates, - visited = new RefSet() - ) { - if (!Array.isArray(fields)) { - return; - } - for (let field of fields) { - if (field instanceof Ref) { - if (visited.has(field)) { - continue; - } - visited.put(field); - } - field = this.xref.fetchIfRef(field); - if (!(field instanceof Dict)) { - continue; - } - if (field.has("Kids")) { - this.#collectSignatureCertificates( - field.get("Kids"), - collectedSignatureCertificates, - visited - ); - continue; - } - const isSignature = isName(field.get("FT"), "Sig"); - if (!isSignature) { - continue; - } - const value = field.get("V"); - if (!(value instanceof Dict)) { - continue; - } - const subFilter = value.get("SubFilter"); - if (!(subFilter instanceof Name)) { - continue; - } - collectedSignatureCertificates.add(subFilter.name); - } - } - get _xfaStreams() { const { acroForm } = this.catalog; if (!acroForm) { @@ -1525,20 +1482,6 @@ class PDFDocument { // specification). const sigFlags = acroForm.get("SigFlags"); const hasSignatures = !!(sigFlags & 0x1); - if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) { - if (hasSignatures) { - const collectedSignatureCertificates = new Set(); - this.#collectSignatureCertificates( - fields, - collectedSignatureCertificates - ); - if (collectedSignatureCertificates.size > 0) { - formInfo.collectedSignatureCertificates = Array.from( - collectedSignatureCertificates - ); - } - } - } const hasOnlyDocumentSignatures = hasSignatures && this.#hasOnlyDocumentSignatures(fields); formInfo.hasAcroForm = hasFields && !hasOnlyDocumentSignatures; @@ -1566,11 +1509,6 @@ class PDFDocument { IsSignaturesPresent: formInfo.hasSignatures, }; - if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) { - docInfo.collectedSignatureCertificates = - formInfo.collectedSignatureCertificates ?? null; - } - let infoDict; try { infoDict = xref.trailer.get("Info"); diff --git a/web/app.js b/web/app.js index 2dc66b6be..1f932d51a 100644 --- a/web/app.js +++ b/web/app.js @@ -1718,13 +1718,6 @@ const PDFViewerApplication = { if (pdfDocument !== this.pdfDocument) { return; // The document was closed while the metadata resolved. } - if (info.collectedSignatureCertificates) { - this.externalServices.reportTelemetry({ - type: "signatureCertificates", - data: info.collectedSignatureCertificates, - }); - } - this.documentInfo = info; this.metadata = metadata; this._contentDispositionFilename ??= contentDispositionFilename;