From eb36fd375c0c127c74fac88e79d9c1cd9bd7b1ee Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Sun, 28 Jan 2024 17:12:24 +0100 Subject: [PATCH] Move the `debuggerSrc`-parameter into the `AppOptions` Having this parameter among a list of DOM-elements seems slightly strange now, however this is very old code hence the explanation for why this was done is for historical reasons (as is often the case). Hence we can simply move this into `AppOptions` instead, which seems more appropriate overall. --- web/app.js | 5 ++--- web/app_options.js | 5 +++++ web/viewer.js | 1 - 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/web/app.js b/web/app.js index 6f3f884a7..27a8e4a18 100644 --- a/web/app.js +++ b/web/app.js @@ -2167,11 +2167,10 @@ async function loadFakeWorker() { } async function loadPDFBug(self) { - const { debuggerScriptPath } = self.appConfig; const { PDFBug } = typeof PDFJSDev === "undefined" - ? await import(debuggerScriptPath) // eslint-disable-line no-unsanitized/method - : await __non_webpack_import__(debuggerScriptPath); + ? await import(AppOptions.get("debuggerSrc")) // eslint-disable-line no-unsanitized/method + : await __non_webpack_import__(AppOptions.get("debuggerSrc")); self._PDFBug = PDFBug; } diff --git a/web/app_options.js b/web/app_options.js index aa529e19e..b2d727793 100644 --- a/web/app_options.js +++ b/web/app_options.js @@ -105,6 +105,11 @@ const defaultOptions = { value: 0, kind: OptionKind.VIEWER + OptionKind.PREFERENCE, }, + debuggerSrc: { + /** @type {string} */ + value: "./debugger.mjs", + kind: OptionKind.VIEWER, + }, defaultZoomDelay: { /** @type {number} */ value: 400, diff --git a/web/viewer.js b/web/viewer.js index aa2bb5275..fea12640f 100644 --- a/web/viewer.js +++ b/web/viewer.js @@ -177,7 +177,6 @@ function getViewerConfiguration() { ), }, printContainer: document.getElementById("printContainer"), - debuggerScriptPath: "./debugger.mjs", }; }