tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 837df38629f229a8569cee836c87e6ac5b65329a
parent 247eb7481ba1a677ba382d19e7e5d431fba7307f
Author: Narcis Beleuzu <nbeleuzu@mozilla.com>
Date:   Tue,  7 Oct 2025 01:15:36 +0300

Revert "Bug 1990509 - Throw error if addSetting is called with unregistered pref. r=mkennedy" for causing bc failure with uncaught exception - PreferenceNotAddedError

This reverts commit 6b2bebcddd3fbecb908ea483b6a92adb3d9b0c69.

Diffstat:
Mtoolkit/content/preferences/Setting.mjs | 16----------------
Mtoolkit/content/tests/chrome/test_preferencesBindings_setting.html | 21---------------------
2 files changed, 0 insertions(+), 37 deletions(-)

diff --git a/toolkit/content/preferences/Setting.mjs b/toolkit/content/preferences/Setting.mjs @@ -35,17 +35,6 @@ ChromeUtils.defineESModuleGetters(lazy, { * @typedef {string | boolean | number} SettingValue */ -class PreferenceNotAddedError extends Error { - constructor(settingId, prefId) { - super( - `Setting "${settingId}" was unable to find Preference "${prefId}". Did you register it with Preferences.add/addAll?` - ); - this.name = "PreferenceNotAddedError"; - this.settingId = settingId; - this.prefId = prefId; - } -} - export class Setting extends EventEmitter { /** * @type {Preference | undefined | null} @@ -68,8 +57,6 @@ export class Setting extends EventEmitter { /** * @param {PreferencesSettingsConfig['id']} id * @param {PreferencesSettingsConfig} config - * @throws {Error} Will throw an error (PreferenceNotAddedError) if - * config.pref was not registered */ constructor(id, config) { super(); @@ -81,9 +68,6 @@ export class Setting extends EventEmitter { this.id = id; this.config = config; this.pref = config.pref && Preferences.get(config.pref); - if (config.pref && !this.pref) { - throw new PreferenceNotAddedError(id, config.pref); - } this._emitting = false; this.controllingExtensionInfo = { diff --git a/toolkit/content/tests/chrome/test_preferencesBindings_setting.html b/toolkit/content/tests/chrome/test_preferencesBindings_setting.html @@ -431,27 +431,6 @@ "Circular dependencies don't produce any console errors." ); }); - - // Verify that a PreferenceNotAddedError is thrown if adding a - // Setting with a preference that has not been registered - // through Preferences.add/addAll. - add_task(async function testPrefNotRegistered() { - const PREF_ID = "non_existent_pref"; - const SETTING_ID = "testSettingNoPref"; - try { - Preferences.addSetting({ - id: SETTING_ID, - pref: PREF_ID, - }); - } catch (e) { - let errorName = e.name; - is( - errorName, - "PreferenceNotAddedError", - "Adding a Setting without registering the Preference should throw a PreferenceNotAddedError" - ); - } - }); </script> </head> <body>