Validate the Preferences when fetching them from storage #9936
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Stop re-loading the Preferences in
PDFViewerApplication.open
, and remove theBasePreferences.reload
methodGiven that the various Preferences are currently, and have been for quite some time, only used when initializing
PDFViewerApplication
re-loading them when a new PDF file is opened in the viewer is essentially a no-op.Furthermore, with the only usage of
BasePreferences.reload
now gone, the value of that method seems questionable at best. In the event that the functionality is actually needed again, similar to theViewHistory
, it'd probably make more sense to simply replacePDFViewerApplication.preferences
with a newBasePreferences
instance instead (using e.g.DefaultExternalServices.createPreferences
).Validate the Preferences when fetching them from storage
When updating Preferences using the
set
method, the input is carefully validated. However, no validation is (currently) done when aBasePreferences
instance is created, which probably isn't that great. Hence this patch that simply ignores, to not unnecessarily break loading of the viewer itself, any invalid Preferences.