Merge pull request #16583 from Snuffleupagus/Firefox-disable-pref-changes
[Firefox] Disable the ability to change preferences directly from the viewer
This commit is contained in:
commit
24b2c3a5e3
@ -174,13 +174,9 @@ class DownloadManager {
|
||||
}
|
||||
|
||||
class FirefoxPreferences extends BasePreferences {
|
||||
async _writeToStorage(prefObj) {
|
||||
return FirefoxCom.requestAsync("setPreferences", prefObj);
|
||||
}
|
||||
|
||||
async _readFromStorage(prefObj) {
|
||||
const prefStr = await FirefoxCom.requestAsync("getPreferences", prefObj);
|
||||
return JSON.parse(prefStr);
|
||||
const prefs = await FirefoxCom.requestAsync("getPreferences", prefObj);
|
||||
return typeof prefs === "string" ? JSON.parse(prefs) : prefs;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -83,6 +83,9 @@ class BasePreferences {
|
||||
* have been reset.
|
||||
*/
|
||||
async reset() {
|
||||
if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) {
|
||||
throw new Error("Please use `about:config` to change preferences.");
|
||||
}
|
||||
await this.#initializedPromise;
|
||||
const prefs = this.#prefs;
|
||||
|
||||
@ -102,6 +105,9 @@ 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;
|
||||
const defaultValue = this.#defaults[name],
|
||||
prefs = this.#prefs;
|
||||
|
Loading…
Reference in New Issue
Block a user