mirror of
https://github.com/zen-browser/desktop.git
synced 2026-09-14 00:50:46 +00:00
gh-15387: Fix #writeToDom crash when mod has checkbox preferences (gh-15388)
This commit is contained in:
@@ -182,15 +182,21 @@ class nsZenMods extends nsZenPreloadedFeature {
|
||||
({ enabled, preferences, name }) => ({
|
||||
enabled,
|
||||
sanitizedName: this.sanitizeModName(name),
|
||||
prefs: preferences.map(({ property, type }) => ({
|
||||
property,
|
||||
type,
|
||||
sanitizedProperty: property?.replaceAll(DOT_RE, "-"),
|
||||
value:
|
||||
enabled === undefined || enabled
|
||||
? Services.prefs.getStringPref(property, "")
|
||||
: "",
|
||||
})),
|
||||
prefs: preferences.map(({ property, type }) => {
|
||||
const isEnabled = enabled === undefined || enabled;
|
||||
const getPref =
|
||||
type === "checkbox"
|
||||
? Services.prefs.getBoolPref
|
||||
: Services.prefs.getStringPref;
|
||||
const fallback = type === "checkbox" ? false : "";
|
||||
|
||||
return {
|
||||
property,
|
||||
type,
|
||||
sanitizedProperty: property?.replaceAll(DOT_RE, "-"),
|
||||
value: isEnabled ? getPref(property, fallback) : fallback,
|
||||
};
|
||||
}),
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user