Skip to content

Commit 780cbad

Browse files
committed
Stop re-loading the Preferences in PDFViewerApplication.open, and remove the BasePreferences.reload method
Given 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 the `ViewHistory`, it'd probably make more sense to simply replace `PDFViewerApplication.preferences` with a new `BasePreferences` instance instead (using e.g. `DefaultExternalServices.createPreferences`).
1 parent d6f378f commit 780cbad

File tree

2 files changed

+0
-17
lines changed

2 files changed

+0
-17
lines changed

web/app.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -635,8 +635,6 @@ let PDFViewerApplication = {
635635
if (this.pdfLoadingTask) {
636636
// We need to destroy already opened document.
637637
return this.close().then(() => {
638-
// Reload the preferences if a document was previously opened.
639-
this.preferences.reload();
640638
// ... and repeat the open() call.
641639
return this.open(file, args);
642640
});

web/preferences.js

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -99,21 +99,6 @@ class BasePreferences {
9999
});
100100
}
101101

102-
/**
103-
* Replace the current preference values with the ones from storage.
104-
* @return {Promise} A promise that is resolved when the preference values
105-
* have been updated.
106-
*/
107-
reload() {
108-
return this._initializedPromise.then(() => {
109-
return this._readFromStorage(this.defaults);
110-
}).then((prefObj) => {
111-
if (prefObj) {
112-
this.prefs = prefObj;
113-
}
114-
});
115-
}
116-
117102
/**
118103
* Set the value of a preference.
119104
* @param {string} name The name of the preference that should be changed.

0 commit comments

Comments
 (0)