From 9faf23309350351b7b169fd83b0fd9b1d34b127f Mon Sep 17 00:00:00 2001 From: Emma Malysz Date: Thu, 4 Jun 2020 11:01:41 -0700 Subject: [PATCH] For #11961: collect telemetry on all unique unsupported features that trigger fallback error. This expands upon the telemetry we are collecting that shows the fallback error. --- web/app.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/web/app.js b/web/app.js index 02a9b1087b464d..16d0b8dc1c9128 100644 --- a/web/app.js +++ b/web/app.js @@ -864,11 +864,27 @@ const PDFViewerApplication = { .catch(downloadByUrl); // Error occurred, try downloading with the URL. }, + _recordFallbackErrorTelemetry(featureId) { + if ( + typeof PDFJSDev === "undefined" || + PDFJSDev.test("MOZCENTRAL") + ) { + this.externalServices.reportTelemetry({ + type: "unsupportedFeature", + featureId, + }); + } + }, + fallback(featureId) { if ( typeof PDFJSDev === "undefined" || PDFJSDev.test("MOZCENTRAL || GENERIC") ) { + if (featureId) { + this._recordFallbackErrorTelemetry(featureId); + } + // For PDFs that contain script and form errors, we should only trigger // the fallback once the user has interacted with the page. if (this._delayedFallbackFeatureIds.length >= 1 && this._hasInteracted) { @@ -1247,6 +1263,7 @@ const PDFViewerApplication = { } console.warn("Warning: JavaScript is not supported"); this._delayedFallbackFeatureIds.push(UNSUPPORTED_FEATURES.javaScript); + this._recordFallbackErrorTelemetry(UNSUPPORTED_FEATURES.javaScript); return true; }); @@ -1329,6 +1346,7 @@ const PDFViewerApplication = { if (info.IsAcroFormPresent) { console.warn("Warning: AcroForm/XFA is not supported"); this._delayedFallbackFeatureIds.push(UNSUPPORTED_FEATURES.forms); + this._recordFallbackErrorTelemetry(UNSUPPORTED_FEATURES.forms); } if (