aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/xmlhttprequest.rs
diff options
context:
space:
mode:
authorAndreu Botella <abb@randomunok.com>2020-12-30 09:46:29 +0100
committerAndreu Botella <abb@randomunok.com>2020-12-31 13:43:33 +0100
commitcd34f156f6355faf97c95bfbaedc66c35b3a1759 (patch)
tree567f65d796d9ef6c53cbb6b41d2629c726d658ac /components/script/dom/xmlhttprequest.rs
parentbe19c03d967b4ec94eec86d1241b6e694ba857da (diff)
downloadservo-cd34f156f6355faf97c95bfbaedc66c35b3a1759.tar.gz
servo-cd34f156f6355faf97c95bfbaedc66c35b3a1759.zip
Fix `document.characterSet` not reflecting byte order marks.
The process of decoding the network byte stream to Unicode is backed by an instance of `encoding_rs::Decoder`, which will switch the encoding it uses if it finds a BOM in the byte stream. However, this change in encoding is not communicated back to the caller and so `document.characterSet` gives the wrong result. This change fixes that. See whatwg/html#5359 and whatwg/encoding#203 for the spec-level backing for this change. Signed-off-by: Andreu Botella <abb@randomunok.com>
Diffstat (limited to 'components/script/dom/xmlhttprequest.rs')
-rw-r--r--components/script/dom/xmlhttprequest.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/components/script/dom/xmlhttprequest.rs b/components/script/dom/xmlhttprequest.rs
index 626f370316e..772e00982be 100644
--- a/components/script/dom/xmlhttprequest.rs
+++ b/components/script/dom/xmlhttprequest.rs
@@ -1488,7 +1488,7 @@ impl XMLHttpRequest {
let (decoded, _, _) = charset.decode(&response);
let document = self.new_doc(IsHTMLDocument::HTMLDocument);
// TODO: Disable scripting while parsing
- ServoParser::parse_html_document(&document, DOMString::from(decoded), wr.get_url());
+ ServoParser::parse_html_document(&document, Some(DOMString::from(decoded)), wr.get_url());
document
}
@@ -1499,7 +1499,7 @@ impl XMLHttpRequest {
let (decoded, _, _) = charset.decode(&response);
let document = self.new_doc(IsHTMLDocument::NonHTMLDocument);
// TODO: Disable scripting while parsing
- ServoParser::parse_xml_document(&document, DOMString::from(decoded), wr.get_url());
+ ServoParser::parse_xml_document(&document, Some(DOMString::from(decoded)), wr.get_url());
document
}