Throw on bad ByteStrings

This commit is contained in:
Michael Wu 2015-10-12 10:47:49 -04:00
parent e733a7c46a
commit 3129fb2330
3 changed files with 14 additions and 1 deletions

View file

@ -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()))

View file

@ -0,0 +1,8 @@
[setrequestheader-bogus-name.htm]
type: testharness
[setRequestHeader should throw with header name "テスト".]
expected: FAIL
[setRequestHeader should throw with header name "X-テスト".]
expected: FAIL

View file

@ -0,0 +1,5 @@
[setrequestheader-bogus-value.htm]
type: testharness
[XMLHttpRequest: setRequestHeader() value argument checks 4]
expected: FAIL