Merge pull request #11647 from Snuffleupagus/notifyPagesLoaded
[Firefox] Block the "load" event until all pages are loaded, to ensure that printing works (bug 1618553)
This commit is contained in:
commit
a447d05292
17
web/app.js
17
web/app.js
@ -943,6 +943,8 @@ const PDFViewerApplication = {
|
||||
this.load(pdfDocument);
|
||||
},
|
||||
exception => {
|
||||
this._unblockDocumentLoadEvent();
|
||||
|
||||
if (loadingTask !== this.pdfLoadingTask) {
|
||||
return undefined; // Ignore errors for previously opened PDF files.
|
||||
}
|
||||
@ -1420,6 +1422,8 @@ const PDFViewerApplication = {
|
||||
});
|
||||
|
||||
pagesPromise.then(() => {
|
||||
this._unblockDocumentLoadEvent();
|
||||
|
||||
this._initializeAutoPrint(pdfDocument, openActionPromise);
|
||||
});
|
||||
|
||||
@ -2335,6 +2339,19 @@ const PDFViewerApplication = {
|
||||
return wholeTicks;
|
||||
},
|
||||
|
||||
/**
|
||||
* Should be called *after* all pages have loaded, or if an error occurred,
|
||||
* to unblock the "load" event; see https://bugzilla.mozilla.org/show_bug.cgi?id=1618553
|
||||
* @private
|
||||
*/
|
||||
_unblockDocumentLoadEvent() {
|
||||
if (document.blockUnblockOnload) {
|
||||
document.blockUnblockOnload(false);
|
||||
}
|
||||
// Ensure that this method is only ever run once.
|
||||
this._unblockDocumentLoadEvent = () => {};
|
||||
},
|
||||
|
||||
/**
|
||||
* Used together with the integration-tests, to enable awaiting full
|
||||
* initialization of the scripting/sandbox.
|
||||
|
@ -236,6 +236,12 @@ function webViewerLoad() {
|
||||
}
|
||||
}
|
||||
|
||||
// Block the "load" event until all pages are loaded, to ensure that printing
|
||||
// works in Firefox; see https://bugzilla.mozilla.org/show_bug.cgi?id=1618553
|
||||
if (document.blockUnblockOnload) {
|
||||
document.blockUnblockOnload(true);
|
||||
}
|
||||
|
||||
if (
|
||||
document.readyState === "interactive" ||
|
||||
document.readyState === "complete"
|
||||
|
Loading…
x
Reference in New Issue
Block a user