From 1ca816d7247f5f7b3e53a7c9421d313f8e905731 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Sun, 14 Feb 2021 10:39:42 +0100 Subject: [PATCH] Directly use `requestIdleCallback` in `MOZCENTRAL`-builds Given the following compatibility information, we really shouldn't need to check for the availability of `requestIdleCallback` in Firefox; see https://developer.mozilla.org/en-US/docs/Web/API/Window/requestIdleCallback#browser_compatibility --- web/app.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/web/app.js b/web/app.js index 69a155a64..1435a4687 100644 --- a/web/app.js +++ b/web/app.js @@ -1423,7 +1423,10 @@ const PDFViewerApplication = { pdfViewer.optionalContentConfigPromise.then(optionalContentConfig => { this.pdfLayerViewer.render({ optionalContentConfig, pdfDocument }); }); - if ("requestIdleCallback" in window) { + if ( + (typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) || + "requestIdleCallback" in window + ) { const callback = window.requestIdleCallback( () => { this._collectTelemetry(pdfDocument);