From 9769b3b71a25079e952924d90f0bdc3e95cc2b78 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Mon, 26 Sep 2022 16:28:16 +0200 Subject: [PATCH] [JS] Override the `Doc.external`-getter to avoid `alert`-modals on load (issue 15509) This property is documented in https://web.archive.org/web/20201112021418if_/https://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/AcrobatDC_js_api_reference.pdf#G5.1977075 Given that PR 14207, which is *somewhat* similar, landed without tests that's hopefully fine here as well. --- src/scripting_api/doc.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/scripting_api/doc.js b/src/scripting_api/doc.js index bfd0968d5..2f1d05e47 100644 --- a/src/scripting_api/doc.js +++ b/src/scripting_api/doc.js @@ -18,6 +18,8 @@ import { PDFObject } from "./pdf_object.js"; import { PrintParams } from "./print_params.js"; import { ZoomType } from "./constants.js"; +const DOC_EXTERNAL = false; + class InfoProxyHandler { static get(obj, prop) { return obj[prop.toLowerCase()]; @@ -272,7 +274,10 @@ class Doc extends PDFObject { } get external() { - return true; + // According to the specification this should be `true` in non-Acrobat + // applications, however we ignore that to avoid bothering users with + // an `alert`-dialog on document load (see issue 15509). + return DOC_EXTERNAL; } set external(_) {