Skip to content

Commit

Permalink
Skip the PREFERENCE-branch in AppOptions.getAll in official builds
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Snuffleupagus committed Oct 31, 2023
1 parent eebc230 commit ce9cfa2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions web/app_options.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
}
Expand Down

0 comments on commit ce9cfa2

Please sign in to comment.