mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 09:20:06 +02:00
Add type validation to the default_preferences
generation (PR 10548 follow-up)
The generated `default_preferences.json` file is necessary when initializing the Firefox preferences, which only supports certain types, hence this patch adds additional validation to help prevent run-time errors in Firefox. Given that these changes add a code-path to `AppOptions.getAll` which could throw, the `OptionKind.PREFERENCE` branch is also modified to require *exact* matching to prevent (future) errors in the viewer. Finally the conditionally defined `defaultOptions` will no longer (potentially) be considered during the `gulp default_preferences` task, to make it more difficult for them to be accidentally included.
This commit is contained in:
parent
c43396c2b7
commit
f7cc331654
4 changed files with 14 additions and 8 deletions
|
@ -535,7 +535,7 @@ gulp.task('default_preferences-pre', function() {
|
|||
], { base: 'src/', }),
|
||||
gulp.src([
|
||||
'web/*.js',
|
||||
'!web/{pdfjs,preferences,viewer}.js',
|
||||
'!web/{app,pdfjs,preferences,viewer}.js',
|
||||
], { base: '.', }),
|
||||
]).pipe(transform('utf8', preprocess))
|
||||
.pipe(gulp.dest(DEFAULT_PREFERENCES_DIR + 'lib/'));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue