Use a bit more optional chaining in the viewer

This commit is contained in:
Jonas Jenwald 2022-04-07 16:20:41 +02:00
parent 27e738dff9
commit bb25b6dec5
2 changed files with 5 additions and 9 deletions

View File

@ -2047,9 +2047,8 @@ const PDFViewerApplication = {
* @private
*/
_unblockDocumentLoadEvent() {
if (document.blockUnblockOnload) {
document.blockUnblockOnload(false);
}
document.blockUnblockOnload?.(false);
// Ensure that this method is only ever run once.
this._unblockDocumentLoadEvent = () => {};
},
@ -2112,9 +2111,8 @@ if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
}
async function loadFakeWorker() {
if (!GlobalWorkerOptions.workerSrc) {
GlobalWorkerOptions.workerSrc = AppOptions.get("workerSrc");
}
GlobalWorkerOptions.workerSrc ||= AppOptions.get("workerSrc");
if (typeof PDFJSDev === "undefined" || !PDFJSDev.test("PRODUCTION")) {
window.pdfjsWorker = await import("pdfjs/core/worker.js");
return;

View File

@ -243,9 +243,7 @@ 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);
}
document.blockUnblockOnload?.(true);
if (
document.readyState === "interactive" ||