From 6447397c047223684f4e8d6f05745ce6b617f84b Mon Sep 17 00:00:00 2001 From: Fabian Lange Date: Wed, 25 Jun 2014 00:23:42 +0200 Subject: [PATCH] Do not run cleanup while printing is ongoing. --- web/viewer.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/web/viewer.js b/web/viewer.js index 30cdf27015cc9..0300ce2392767 100644 --- a/web/viewer.js +++ b/web/viewer.js @@ -117,6 +117,7 @@ var PDFView = { fellback: false, pdfDocument: null, sidebarOpen: false, + printing: false, pageViewScroll: null, thumbnailViewScroll: null, pageRotation: 0, @@ -1256,6 +1257,11 @@ var PDFView = { } } + if (this.printing) { + // If printing is currently ongoing do not reschedule cleanup. + return; + } + PDFView.idleTimeout = setTimeout(function () { PDFView.cleanup(); }, CLEANUP_TIMEOUT); @@ -1565,6 +1571,9 @@ var PDFView = { return; } + this.printing = true; + this.renderHighestPriority(); + var body = document.querySelector('body'); body.setAttribute('data-mozPrintCallback', true); for (i = 0, ii = this.pages.length; i < ii; ++i) { @@ -1583,6 +1592,9 @@ var PDFView = { while (div.hasChildNodes()) { div.removeChild(div.lastChild); } + + this.printing = false; + this.renderHighestPriority(); }, rotatePages: function pdfViewRotatePages(delta) {