diff --git a/extensions/chromium/preferences_schema.json b/extensions/chromium/preferences_schema.json index 6ab4be3e6..5f365e661 100644 --- a/extensions/chromium/preferences_schema.json +++ b/extensions/chromium/preferences_schema.json @@ -26,6 +26,11 @@ ], "default": 0 }, + "enableHandToolOnLoad": { + "description": "DEPRECATED. Set cursorToolOnLoad to 1 to enable the hand tool by default.", + "type": "boolean", + "default": false + }, "cursorToolOnLoad": { "title": "Cursor tool on load", "description": "The cursor tool that is enabled upon load.\n 0 = Text selection tool.\n 1 = Hand tool.", diff --git a/web/chromecom.js b/web/chromecom.js index 533361467..43419db8e 100644 --- a/web/chromecom.js +++ b/web/chromecom.js @@ -308,16 +308,25 @@ class ChromePreferences extends BasePreferences { // Get preferences as set by the system administrator. // See extensions/chromium/preferences_schema.json for more information. // These preferences can be overridden by the user. - chrome.storage.managed.get(this.defaults, function(items) { + + // Deprecated preferences are removed from web/default_preferences.json, + // but kept in extensions/chromium/preferences_schema.json for backwards + // compatibility with managed preferences. + let defaultManagedPrefs = Object.assign({ + enableHandToolOnLoad: false, + }, this.defaults); + + chrome.storage.managed.get(defaultManagedPrefs, function(items) { + items = items || defaultManagedPrefs; // Migration code for https://github.com/mozilla/pdf.js/pull/7635. // Never remove this, because we have no means of modifying managed // preferences. - if (items && items.enableHandToolOnLoad && !items.cursorToolOnLoad) { + if (items.enableHandToolOnLoad && !items.cursorToolOnLoad) { // if the old enableHandToolOnLoad has a non-default value, // and cursorToolOnLoad has a default value, migrate. - items.enableHandToolOnLoad = false; items.cursorToolOnLoad = 1; } + delete items.enableHandToolOnLoad; getPreferences(items); }); } else {