Merge pull request #12765 from Snuffleupagus/_initializeAutoPrint-scripting-tweaks
Avoid the `getJavaScript` API-call in `PDFViewerApplication._initializeAutoPrint` when "enableScripting" is set
This commit is contained in:
commit
9c99df7cac
@ -1652,7 +1652,7 @@ const PDFViewerApplication = {
|
|||||||
async _initializeAutoPrint(pdfDocument, openActionPromise) {
|
async _initializeAutoPrint(pdfDocument, openActionPromise) {
|
||||||
const [openAction, javaScript] = await Promise.all([
|
const [openAction, javaScript] = await Promise.all([
|
||||||
openActionPromise,
|
openActionPromise,
|
||||||
pdfDocument.getJavaScript(),
|
!AppOptions.get("enableScripting") ? pdfDocument.getJavaScript() : null,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if (pdfDocument !== this.pdfDocument) {
|
if (pdfDocument !== this.pdfDocument) {
|
||||||
@ -1660,10 +1660,10 @@ const PDFViewerApplication = {
|
|||||||
}
|
}
|
||||||
let triggerAutoPrint = false;
|
let triggerAutoPrint = false;
|
||||||
|
|
||||||
if (openAction && openAction.action === "Print") {
|
if (openAction?.action === "Print") {
|
||||||
triggerAutoPrint = true;
|
triggerAutoPrint = true;
|
||||||
}
|
}
|
||||||
if (javaScript && !AppOptions.get("enableScripting")) {
|
if (javaScript) {
|
||||||
javaScript.some(js => {
|
javaScript.some(js => {
|
||||||
if (!js) {
|
if (!js) {
|
||||||
// Don't warn/fallback for empty JavaScript actions.
|
// Don't warn/fallback for empty JavaScript actions.
|
||||||
@ -1686,9 +1686,7 @@ const PDFViewerApplication = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (triggerAutoPrint) {
|
if (triggerAutoPrint) {
|
||||||
setTimeout(() => {
|
|
||||||
this.triggerPrinting();
|
this.triggerPrinting();
|
||||||
});
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user