firefox-profile-js
firefox-profile-js copied to clipboard
`setPreference` doesn't escape quotes in values
Example
const profile = new FirefoxProfile();
profile.setPreference('foo', '"bar"');
profile.updatePreferences();
console.log(await readFile(profile.userPrefs, { encoding: 'utf8' }));
This leads to a file containing the following line:
user_pref("foo", ""bar"");
and FF errors out because it's invalid.
Workaround
profile.defaultPreferences['foo'] = JSON.stringify('"bar"');
profile.updatePreferences();
Potential fix
Use JSON.stringify
in setPreference
. That might be able to replace the custom cleaning logic altogether.