Bug 1736864, add extra telemetry flag to indicate if the pdf viewer is opening an attachment, r=Gijs

Note that this doesn't ever trigger currently as pdf files loaded as attachments always get downloaded go through the external helper service

Differential Revision: https://phabricator.services.mozilla.com/D130098
This commit is contained in:
Neil Deakin 2021-11-10 18:52:24 +00:00
parent a14798e96b
commit 18cdb709cd
3 changed files with 24 additions and 2 deletions

View File

@ -21,8 +21,11 @@ var EXPORTED_SYMBOLS = ["PdfJsTelemetry"];
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
var PdfJsTelemetry = {
onViewerIsUsed() {
onViewerIsUsed(isAttachment) {
Services.telemetry.scalarAdd("pdf.viewer.used", 1);
if (isAttachment) {
Services.telemetry.scalarAdd("pdf.viewer.is_attachment", 1);
}
},
onFallbackError(featureId) {
let histogram = Services.telemetry.getHistogramById(

View File

@ -1209,8 +1209,10 @@ PdfStreamConverter.prototype = {
aRequest.QueryInterface(Ci.nsIWritablePropertyBag);
var contentDisposition = aRequest.DISPOSITION_INLINE;
var contentDispositionFilename;
try {
contentDisposition = aRequest.contentDisposition;
contentDispositionFilename = aRequest.contentDispositionFilename;
} catch (e) {}
@ -1229,7 +1231,9 @@ PdfStreamConverter.prototype = {
aRequest.setResponseHeader("Refresh", "", false);
}
PdfJsTelemetry.onViewerIsUsed();
PdfJsTelemetry.onViewerIsUsed(
contentDisposition == aRequest.DISPOSITION_ATTACHMENT
);
PdfJsTelemetry.onDocumentSize(aRequest.contentLength);
// Creating storage for PDF data

View File

@ -4182,6 +4182,21 @@ pdf.viewer:
record_in_processes:
- 'main'
- 'content'
is_attachment:
bug_numbers:
- 1736864
description: >
How many times a PDF that sends Content-Disposition: attachment is opened.
expires: "100"
kind: uint
notification_emails:
- rtestard@mozilla.com
release_channel_collection: opt-out
products:
- 'firefox'
record_in_processes:
- 'main'
- 'content'
fallback_shown:
bug_numbers:
- 1566882