Merge pull request #17694 from Snuffleupagus/validate-defaultOptions

Add better validation for the "PREFERENCE" kind `AppOptions`
This commit is contained in:
Jonas Jenwald 2024-03-12 18:24:37 +01:00 committed by GitHub
commit 30e69956db
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 104 additions and 48 deletions

View file

@ -863,11 +863,17 @@ async function parseDefaultPreferences(dir) {
"./" + DEFAULT_PREFERENCES_DIR + dir + "app_options.mjs"
);
const browserPrefs = AppOptions.getAll(OptionKind.BROWSER);
const browserPrefs = AppOptions.getAll(
OptionKind.BROWSER,
/* defaultOnly = */ true
);
if (Object.keys(browserPrefs).length === 0) {
throw new Error("No browser preferences found.");
}
const prefs = AppOptions.getAll(OptionKind.PREFERENCE);
const prefs = AppOptions.getAll(
OptionKind.PREFERENCE,
/* defaultOnly = */ true
);
if (Object.keys(prefs).length === 0) {
throw new Error("No default preferences found.");
}