constructor() {
    if (
      (typeof PDFJSDev === "undefined" || PDFJSDev.test("TESTING")) &&
      this.constructor === BasePreferences
    ) {
      throw new Error("Cannot initialize BasePreferences.");
    }

    if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("CHROME")) {
      Object.defineProperty(this, "defaults", {
        get() {
          return this.#defaults;
        },
      });
    }

    this.#initializedPromise = this._readFromStorage(this.#defaults).then(
      ({ browserPrefs, prefs }) => {
        if (
          (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) &&
          AppOptions._checkDisablePreferences()
        ) {
          return;
        }
        AppOptions.setAll({ ...browserPrefs, ...prefs }, /* prefs = */ true);
      }
    );

    if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) {
      window.addEventListener(
        "updatedPreference",
        async ({ detail: { name, value } }) => {
          await this.#initializedPromise;
          AppOptions.setAll({ [name]: value }, /* prefs = */ true);
        }
      );
    }
  }
BasePreferences - Abstract base class for storing persistent settings.
  Used for settings that should be applied to all opened documents,
  or every time the viewer is loaded.