mirror of
https://github.com/servo/servo.git
synced 2025-08-02 20:20:14 +01:00
Throw on bad ByteStrings
This commit is contained in:
parent
e733a7c46a
commit
3129fb2330
3 changed files with 14 additions and 1 deletions
|
@ -577,7 +577,7 @@ impl FromJSValConvertible for ByteString {
|
|||
let char_vec = slice::from_raw_parts(chars, length as usize);
|
||||
|
||||
if char_vec.iter().any(|&c| c > 0xFF) {
|
||||
// XXX Throw
|
||||
throw_type_error(cx, "Invalid ByteString");
|
||||
Err(())
|
||||
} else {
|
||||
Ok(ByteString::new(char_vec.iter().map(|&c| c as u8).collect()))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue