Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setPreference doesn't escape quotes in values #130

Open
ROpdebee opened this issue Nov 20, 2021 · 0 comments
Open

setPreference doesn't escape quotes in values #130

ROpdebee opened this issue Nov 20, 2021 · 0 comments

Comments

@ROpdebee
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant