We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
In our implementation of String.prototype.startsWith we're not type checking the argument and blindly coercing it into a string. https://github.com/boa-dev/boa/blob/master/boa/src/builtins/string/mod.rs#L301
String.prototype.startsWith
We should match on the value (or if let) and if its a regular expression throw a type error:
ctx.throw_type_error("First argument to String.prototype.startsWith must not be a regular expression")?;
There should be a test also
Same here: https://github.com/boa-dev/boa/blob/master/boa/src/builtins/string/mod.rs#L344 and here: https://github.com/boa-dev/boa/blob/master/boa/src/builtins/string/mod.rs#L390
Example JS
const str1 = 'Saturday night plans'; console.log(str1.startsWith(/saturday/));
Contributing: https://github.com/boa-dev/boa/blob/master/CONTRIBUTING.md Debugging: https://github.com/boa-dev/boa/blob/master/docs/debugging.md
The text was updated successfully, but these errors were encountered:
Can I take a stab at this?
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
In our implementation of
String.prototype.startsWith
we're not type checking the argument and blindly coercing it into a string.https://github.com/boa-dev/boa/blob/master/boa/src/builtins/string/mod.rs#L301
We should match on the value (or if let) and if its a regular expression throw a type error:
There should be a test also
Same here: https://github.com/boa-dev/boa/blob/master/boa/src/builtins/string/mod.rs#L344
and here: https://github.com/boa-dev/boa/blob/master/boa/src/builtins/string/mod.rs#L390
Example JS
Contributing: https://github.com/boa-dev/boa/blob/master/CONTRIBUTING.md
Debugging: https://github.com/boa-dev/boa/blob/master/docs/debugging.md
The text was updated successfully, but these errors were encountered: