Merge pull request #18402 from Snuffleupagus/updatedPreference-move-listener
Move the "updatedPreference" event listener registration
This commit is contained in:
commit
bb3e3164e6
@ -67,16 +67,13 @@ class BasePreferences {
|
|||||||
typeof prefVal === typeof val ? prefVal : val;
|
typeof prefVal === typeof val ? prefVal : val;
|
||||||
}
|
}
|
||||||
AppOptions.setAll(options, /* init = */ true);
|
AppOptions.setAll(options, /* init = */ true);
|
||||||
|
|
||||||
if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) {
|
|
||||||
window.addEventListener("updatedPreference", evt => {
|
|
||||||
this.#updatePref(evt.detail);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) {
|
if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) {
|
||||||
|
window.addEventListener("updatedPreference", evt => {
|
||||||
|
this.#updatePref(evt.detail);
|
||||||
|
});
|
||||||
this.eventBus = null;
|
this.eventBus = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -101,10 +98,11 @@ class BasePreferences {
|
|||||||
throw new Error("Not implemented: _readFromStorage");
|
throw new Error("Not implemented: _readFromStorage");
|
||||||
}
|
}
|
||||||
|
|
||||||
#updatePref({ name, value }) {
|
async #updatePref({ name, value }) {
|
||||||
if (typeof PDFJSDev === "undefined" || !PDFJSDev.test("MOZCENTRAL")) {
|
if (typeof PDFJSDev === "undefined" || !PDFJSDev.test("MOZCENTRAL")) {
|
||||||
throw new Error("Not implemented: #updatePref");
|
throw new Error("Not implemented: #updatePref");
|
||||||
}
|
}
|
||||||
|
await this.#initializedPromise;
|
||||||
|
|
||||||
if (name in this.#browserDefaults) {
|
if (name in this.#browserDefaults) {
|
||||||
if (typeof value !== typeof this.#browserDefaults[name]) {
|
if (typeof value !== typeof this.#browserDefaults[name]) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user