Skip the PREFERENCE-branch in AppOptions.getAll in official builds

Given that this branch is only necessary in development mode and *during* building, but is never actually used in the final viewer-bundles, we can utilize the pre-processor to ignore this code.
This commit is contained in:
Jonas Jenwald 2023-10-31 20:13:13 +01:00
parent eebc230cf1
commit ce9cfa2d72

View File

@ -400,10 +400,13 @@ class AppOptions {
for (const name in defaultOptions) {
const defaultOption = defaultOptions[name];
if (kind) {
if ((kind & defaultOption.kind) === 0) {
if (!(kind & defaultOption.kind)) {
continue;
}
if (kind === OptionKind.PREFERENCE) {
if (
(typeof PDFJSDev === "undefined" || PDFJSDev.test("LIB")) &&
kind === OptionKind.PREFERENCE
) {
if (defaultOption.kind & OptionKind.BROWSER) {
throw new Error(`Invalid kind for preference: ${name}`);
}