Don't crash on invalid utf-8 in the HTML parser.

This was regressed by the html5ever landing.
This commit is contained in:
Ms2ger 2014-10-17 15:12:35 +02:00
parent 65856dd00a
commit b9d8533760
4 changed files with 5 additions and 6 deletions

View file

@ -496,7 +496,7 @@ pub fn parse_html(page: &Page,
match msg {
Payload(data) => {
// FIXME: use Vec<u8> (html5ever #34)
let data = String::from_utf8(data).unwrap();
let data = UTF_8.decode(data.as_slice(), DecodeReplace).unwrap();
parser.tokenizer().borrow_mut().feed(data);
}
Done(Err(err)) => {

View file

@ -1,3 +1,5 @@
[open-url-encoding.htm]
type: testharness
expected: CRASH
[XMLHttpRequest: open() - URL encoding]
expected: FAIL

View file

@ -1,3 +0,0 @@
[send-content-type-string.htm]
type: testharness
expected: CRASH

View file

@ -1,3 +1,3 @@
[send-entity-body-document.htm]
type: testharness
expected: CRASH
expected: TIMEOUT