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`).
This commit is contained in:
		
							parent
							
								
									d6f378fbaf
								
							
						
					
					
						commit
						780cbadcd7
					
				@ -635,8 +635,6 @@ let PDFViewerApplication = {
 | 
			
		||||
    if (this.pdfLoadingTask) {
 | 
			
		||||
      // We need to destroy already opened document.
 | 
			
		||||
      return this.close().then(() => {
 | 
			
		||||
        // Reload the preferences if a document was previously opened.
 | 
			
		||||
        this.preferences.reload();
 | 
			
		||||
        // ... and repeat the open() call.
 | 
			
		||||
        return this.open(file, args);
 | 
			
		||||
      });
 | 
			
		||||
 | 
			
		||||
@ -99,21 +99,6 @@ class BasePreferences {
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Replace the current preference values with the ones from storage.
 | 
			
		||||
   * @return {Promise} A promise that is resolved when the preference values
 | 
			
		||||
   *                   have been updated.
 | 
			
		||||
   */
 | 
			
		||||
  reload() {
 | 
			
		||||
    return this._initializedPromise.then(() => {
 | 
			
		||||
      return this._readFromStorage(this.defaults);
 | 
			
		||||
    }).then((prefObj) => {
 | 
			
		||||
      if (prefObj) {
 | 
			
		||||
        this.prefs = prefObj;
 | 
			
		||||
      }
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Set the value of a preference.
 | 
			
		||||
   * @param {string} name The name of the preference that should be changed.
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user