From a8d4aad8b910e8b2d23c780d62b9b2e2704c5060 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Sun, 11 Jun 2023 12:00:03 +0200 Subject: [PATCH] Limit `PDFPageProxy.getOperatorList` to development mode and GENERIC builds Given that this API method isn't used anywhere within the PDF.js library itself, except for the unit-tests, we can avoid including what's effectively dead code in e.g. the *built-in* Firefox PDF Viewer. --- src/display/api.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/display/api.js b/src/display/api.js index 46ceef1ac..e697f7bcf 100644 --- a/src/display/api.js +++ b/src/display/api.js @@ -1552,6 +1552,9 @@ class PDFPageProxy { annotationMode = AnnotationMode.ENABLE, printAnnotationStorage = null, } = {}) { + if (typeof PDFJSDev !== "undefined" && !PDFJSDev.test("GENERIC")) { + throw new Error("Not implemented: getOperatorList"); + } function operatorListChanged() { if (intentState.operatorList.lastChunk) { intentState.opListReadCapability.resolve(intentState.operatorList);