diff --git a/web/app_options.js b/web/app_options.js index d61aa0bb7f437..25057367409a3 100644 --- a/web/app_options.js +++ b/web/app_options.js @@ -511,6 +511,11 @@ class AppOptions { } static set(name, value) { + const defaultOption = defaultOptions[name]; + + if (!defaultOption || typeof value !== typeof defaultOption.value) { + return; + } userOptions[name] = value; } @@ -518,22 +523,18 @@ class AppOptions { let events; for (const name in options) { - const userOption = options[name]; + const defaultOption = defaultOptions[name], + userOption = options[name]; + if (!defaultOption || typeof userOption !== typeof defaultOption.value) { + continue; + } if (prefs) { - const defaultOption = defaultOptions[name]; - - if (!defaultOption) { - continue; - } - const { kind, value } = defaultOption; + const { kind } = defaultOption; if (!(kind & OptionKind.BROWSER || kind & OptionKind.PREFERENCE)) { continue; } - if (typeof userOption !== typeof value) { - continue; - } if (this.eventBus && kind & OptionKind.EVENT_DISPATCH) { (events ||= new Map()).set(name, userOption); }