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

Don't let pref setting use isNaN() on the value if it's 'false' or 'true' to decide if it's a Number #1254

Closed
sefeng211 opened this issue Apr 27, 2020 · 2 comments

Comments

@sefeng211
Copy link
Collaborator

https://github.com/sitespeedio/browsertime/blob/master/lib/firefox/webdriver/index.js#L134 is problematic if the value is true or false, because isNaN evaluates to false for both cases, so it ends up using Number

We can fix it by doing

if (value === 'false') { value = false; ffOptions.setPreference(name, value); } else if (value === 'true') { value = true; ffOptions.setPreference(name, value); } else if (isNaN(value)) { ffOptions.setPreference(name, value); } else { ffOptions.setPreference(name, Number(value)); }
@soulgalore
Copy link
Member

Hi @sefeng211 great I missed that. I think from the beginning all configurations was just handled as strings as Chrome configs are done, and then I/we added a use case at a time. Let me fix that for the next release.

@soulgalore
Copy link
Member

Released in 8.7.1, thank you @sefeng211 !

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

2 participants