diff --git a/web/firefoxcom.js b/web/firefoxcom.js index a7cd0068b..3add42240 100644 --- a/web/firefoxcom.js +++ b/web/firefoxcom.js @@ -150,6 +150,10 @@ class Preferences extends BasePreferences { async _readFromStorage(prefObj) { return FirefoxCom.requestAsync("getPreferences", prefObj); } + + async _writeToStorage(prefObj) { + return FirefoxCom.requestAsync("setPreferences", prefObj); + } } (function listenFindEvents() { diff --git a/web/preferences.js b/web/preferences.js index 61a01ea88..d44e4a39a 100644 --- a/web/preferences.js +++ b/web/preferences.js @@ -108,14 +108,14 @@ class BasePreferences { * provided that the preference exists and the types match. */ async set(name, value) { - if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) { - throw new Error("Please use `about:config` to change preferences."); - } await this.#initializedPromise; AppOptions.setAll({ [name]: value }, /* prefs = */ true); - const prefs = AppOptions.getAll(OptionKind.PREFERENCE); - await this._writeToStorage(prefs); + await this._writeToStorage( + typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL") + ? { [name]: AppOptions.get(name) } + : AppOptions.getAll(OptionKind.PREFERENCE) + ); } /**