From c70ceecff40275439516a89f54d69f24db8538f3 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Tue, 6 Sep 2022 13:00:44 +0200 Subject: [PATCH] Remove the "tagged" telemetry-reporting Given that this is no longer being recorded in Firefox, it shouldn't be necessary to keep the associated code in the default viewer. --- web/app.js | 45 --------------------------------------------- 1 file changed, 45 deletions(-) diff --git a/web/app.js b/web/app.js index 986caeed1..30073cc01 100644 --- a/web/app.js +++ b/web/app.js @@ -260,7 +260,6 @@ const PDFViewerApplication = { _saveInProgress: false, _docStats: null, _wheelUnusedTicks: 0, - _idleCallbacks: new Set(), _PDFBug: null, _hasAnnotationEditors: false, _title: document.title, @@ -816,19 +815,6 @@ const PDFViewerApplication = { secondaryToolbar.viewBookmarkButton.hidden = true; }, - /** - * @private - */ - _cancelIdleCallbacks() { - if (!this._idleCallbacks.size) { - return; - } - for (const callback of this._idleCallbacks) { - window.cancelIdleCallback(callback); - } - this._idleCallbacks.clear(); - }, - /** * Closes opened PDF document. * @returns {Promise} - Returns the promise, which is resolved when all @@ -886,7 +872,6 @@ const PDFViewerApplication = { this._docStats = null; this._hasAnnotationEditors = false; - this._cancelIdleCallbacks(); promises.push(this.pdfScriptingManager.destroyPromise); this.setTitle(); @@ -1427,19 +1412,6 @@ const PDFViewerApplication = { } this.pdfLayerViewer.render({ optionalContentConfig, pdfDocument }); }); - if ( - (typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) || - "requestIdleCallback" in window - ) { - const callback = window.requestIdleCallback( - () => { - this._collectTelemetry(pdfDocument); - this._idleCallbacks.delete(callback); - }, - { timeout: 1000 } - ); - this._idleCallbacks.add(callback); - } }); this._initializePageLabels(pdfDocument); @@ -1486,23 +1458,6 @@ const PDFViewerApplication = { }; }, - /** - * A place to fetch data for telemetry after one page is rendered and the - * viewer is idle. - * @private - */ - async _collectTelemetry(pdfDocument) { - const markInfo = await this.pdfDocument.getMarkInfo(); - if (pdfDocument !== this.pdfDocument) { - return; // Document was closed while waiting for mark info. - } - const tagged = markInfo?.Marked || false; - this.externalServices.reportTelemetry({ - type: "tagged", - tagged, - }); - }, - /** * @private */