diff --git a/web/app.js b/web/app.js index f1fe833cb..125383681 100644 --- a/web/app.js +++ b/web/app.js @@ -301,13 +301,20 @@ const PDFViewerApplication = { */ async _readPreferences() { if ( - (typeof PDFJSDev === "undefined" || - PDFJSDev.test("!PRODUCTION || GENERIC")) && - AppOptions.get("disablePreferences") + typeof PDFJSDev === "undefined" || + PDFJSDev.test("!PRODUCTION || GENERIC") ) { - // Give custom implementations of the default viewer a simpler way to - // opt-out of having the `Preferences` override existing `AppOptions`. - return; + if (AppOptions.get("disablePreferences")) { + // Give custom implementations of the default viewer a simpler way to + // opt-out of having the `Preferences` override existing `AppOptions`. + return; + } + if (AppOptions._hasUserOptions()) { + console.warn( + "_readPreferences: The Preferences may override manually set AppOptions; " + + 'please use the "disablePreferences"-option in order to prevent that.' + ); + } } try { AppOptions.setAll(await this.preferences.getAll()); diff --git a/web/app_options.js b/web/app_options.js index b4b175b5b..646dbbaed 100644 --- a/web/app_options.js +++ b/web/app_options.js @@ -379,6 +379,13 @@ class AppOptions { static remove(name) { delete userOptions[name]; } + + /** + * @ignore + */ + static _hasUserOptions() { + return Object.keys(userOptions).length > 0; + } } export { AppOptions, compatibilityParams, OptionKind };