mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-10 02:05:37 +02:00
Ensure that any pending rendering operations in PDFViewer
/PDFThumbnailViewer
are cancelled when the viewer is closed
This commit is contained in:
parent
fb5aa58008
commit
a824c6c4f6
5 changed files with 66 additions and 27 deletions
|
@ -299,6 +299,7 @@ var PDFViewer = (function pdfViewer() {
|
|||
*/
|
||||
setDocument: function (pdfDocument) {
|
||||
if (this.pdfDocument) {
|
||||
this._cancelRendering();
|
||||
this._resetView();
|
||||
}
|
||||
|
||||
|
@ -424,10 +425,8 @@ var PDFViewer = (function pdfViewer() {
|
|||
this._pagesRequests = [];
|
||||
this._pageViewsReady = false;
|
||||
|
||||
var container = this.viewer;
|
||||
while (container.hasChildNodes()) {
|
||||
container.removeChild(container.lastChild);
|
||||
}
|
||||
// Remove the pages from the DOM.
|
||||
this.viewer.textContent = '';
|
||||
},
|
||||
|
||||
_scrollUpdate: function PDFViewer_scrollUpdate() {
|
||||
|
@ -802,6 +801,17 @@ var PDFViewer = (function pdfViewer() {
|
|||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
_cancelRendering: function PDFViewer_cancelRendering() {
|
||||
for (var i = 0, ii = this._pages.length; i < ii; i++) {
|
||||
if (this._pages[i]) {
|
||||
this._pages[i].cancelRendering();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {PDFPageView} pageView
|
||||
* @returns {PDFPage}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue