mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-19 14:48:08 +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
10
gulpfile.mjs
10
gulpfile.mjs
|
@ -863,11 +863,17 @@ async function parseDefaultPreferences(dir) {
|
|||
"./" + DEFAULT_PREFERENCES_DIR + dir + "app_options.mjs"
|
||||
);
|
||||
|
||||
const browserPrefs = AppOptions.getAll(OptionKind.BROWSER);
|
||||
const browserPrefs = AppOptions.getAll(
|
||||
OptionKind.BROWSER,
|
||||
/* defaultOnly = */ true
|
||||
);
|
||||
if (Object.keys(browserPrefs).length === 0) {
|
||||
throw new Error("No browser preferences found.");
|
||||
}
|
||||
const prefs = AppOptions.getAll(OptionKind.PREFERENCE);
|
||||
const prefs = AppOptions.getAll(
|
||||
OptionKind.PREFERENCE,
|
||||
/* defaultOnly = */ true
|
||||
);
|
||||
if (Object.keys(prefs).length === 0) {
|
||||
throw new Error("No default preferences found.");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue