From 637e95985a70ce7107b03b7cb2ca610e9f06bddb Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Sat, 22 Feb 2025 13:38:10 +0100 Subject: [PATCH] Simplify `JpxImage.setOptions` a little bit After PR 19392 we're only invoking this method *once* per document, hence the early-return branch shouldn't be necessary any more. --- src/core/jpx.js | 3 --- src/core/pdf_manager.js | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/core/jpx.js b/src/core/jpx.js index f25fc7c7d..8fd7c8b7f 100644 --- a/src/core/jpx.js +++ b/src/core/jpx.js @@ -38,9 +38,6 @@ class JpxImage { static #wasmUrl = null; static setOptions({ handler, useWasm, useWorkerFetch, wasmUrl }) { - if (this.#buffer || this.#modulePromise) { - return; - } this.#useWasm = useWasm; this.#useWorkerFetch = useWorkerFetch; this.#wasmUrl = wasmUrl; diff --git a/src/core/pdf_manager.js b/src/core/pdf_manager.js index 3b277ea85..02c4e58b4 100644 --- a/src/core/pdf_manager.js +++ b/src/core/pdf_manager.js @@ -70,7 +70,7 @@ class BasePdfManager { FeatureTest.isImageDecoderSupported; this.evaluatorOptions = Object.freeze(evaluatorOptions); - // Initially image-options once per document. + // Initialize image-options once per document. ImageResizer.setOptions(evaluatorOptions); JpegStream.setOptions(evaluatorOptions); JpxImage.setOptions({ ...evaluatorOptions, handler });