Skip to content

Commit

Permalink
Merge pull request mozilla#5001 from CodingFabian/issue-4994
Browse files Browse the repository at this point in the history
Do not run cleanup while printing is ongoing.
  • Loading branch information
yurydelendik committed Jun 25, 2014
2 parents b482393 + 6447397 commit 2e98f90
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions web/viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ var PDFView = {
fellback: false,
pdfDocument: null,
sidebarOpen: false,
printing: false,
pageViewScroll: null,
thumbnailViewScroll: null,
pageRotation: 0,
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand All @@ -1583,6 +1592,9 @@ var PDFView = {
while (div.hasChildNodes()) {
div.removeChild(div.lastChild);
}

this.printing = false;
this.renderHighestPriority();
},

rotatePages: function pdfViewRotatePages(delta) {
Expand Down

0 comments on commit 2e98f90

Please sign in to comment.