diff --git a/src/display/api.js b/src/display/api.js index 9c70a7c22..5b91922f1 100644 --- a/src/display/api.js +++ b/src/display/api.js @@ -1510,8 +1510,14 @@ class PDFPageProxy { internalRenderTask.capability.resolve(); } - this._stats?.timeEnd("Rendering"); - this._stats?.timeEnd("Overall"); + if (this._stats) { + this._stats.timeEnd("Rendering"); + this._stats.timeEnd("Overall"); + + if (globalThis.Stats?.enabled) { + globalThis.Stats.add(this.pageNumber, this._stats); + } + } }; const internalRenderTask = new InternalRenderTask({ diff --git a/web/app.js b/web/app.js index 491761d69..80ab34877 100644 --- a/web/app.js +++ b/web/app.js @@ -1898,10 +1898,6 @@ const PDFViewerApplication = { signal, }); - if (AppOptions.get("pdfBug")) { - eventBus._on("pagerendered", reportPageStatsPDFBug, { signal }); - eventBus._on("pagechanging", reportPageStatsPDFBug, { signal }); - } if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) { eventBus._on("fileinputchange", webViewerFileInputChange, { signal }); eventBus._on("openfile", webViewerOpenFile, { signal }); @@ -2187,16 +2183,6 @@ async function loadPDFBug(self) { self._PDFBug = PDFBug; } -function reportPageStatsPDFBug({ pageNumber }) { - if (!globalThis.Stats?.enabled) { - return; - } - const pageView = PDFViewerApplication.pdfViewer.getPageView( - /* index = */ pageNumber - 1 - ); - globalThis.Stats.add(pageNumber, pageView?.pdfPage?.stats); -} - function webViewerPageRender({ pageNumber }) { // If the page is (the most) visible when it starts rendering, // ensure that the page number input loading indicator is displayed.