Skip to content

Commit

Permalink
For #11961: collect telemetry on all unique unsupported features that…
Browse files Browse the repository at this point in the history
… trigger fallback error.

This expands upon the telemetry we are collecting that shows the fallback error.
  • Loading branch information
emalysz committed Jun 11, 2020
1 parent c9934de commit 372859b
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions web/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -864,11 +864,27 @@ const PDFViewerApplication = {
.catch(downloadByUrl); // Error occurred, try downloading with the URL.
},

_recordFallbackErrorTelemetry(featureId) {
if (
typeof PDFJSDev === "undefined" ||
PDFJSDev.test("MOZCENTRAL || GENERIC")
) {
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) {
Expand Down Expand Up @@ -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;
});

Expand Down Expand Up @@ -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 (
Expand Down

0 comments on commit 372859b

Please sign in to comment.