mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 09:20:06 +02:00
Add better validation for the "PREFERENCE" kind AppOptions
Given that the "PREFERENCE" kind is used e.g. to generate the preference-list for the Firefox PDF Viewer, those options need to be carefully validated. With this patch we'll now check this unconditionally in development mode, during testing, and when creating the preferences in the gulpfile.
This commit is contained in:
parent
70015ffe6b
commit
90b2664622
6 changed files with 90 additions and 28 deletions
|
@ -23,7 +23,7 @@ import { AppOptions, OptionKind } from "./app_options.js";
|
|||
class BasePreferences {
|
||||
#defaults = Object.freeze(
|
||||
typeof PDFJSDev === "undefined"
|
||||
? AppOptions.getAll(OptionKind.PREFERENCE)
|
||||
? AppOptions.getAll(OptionKind.PREFERENCE, /* defaultOnly = */ true)
|
||||
: PDFJSDev.eval("DEFAULT_PREFERENCES")
|
||||
);
|
||||
|
||||
|
@ -48,7 +48,7 @@ class BasePreferences {
|
|||
({ browserPrefs, prefs }) => {
|
||||
const BROWSER_PREFS =
|
||||
typeof PDFJSDev === "undefined"
|
||||
? AppOptions.getAll(OptionKind.BROWSER)
|
||||
? AppOptions.getAll(OptionKind.BROWSER, /* defaultOnly = */ true)
|
||||
: PDFJSDev.eval("BROWSER_PREFERENCES");
|
||||
const options = Object.create(null);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue