From cd34f156f6355faf97c95bfbaedc66c35b3a1759 Mon Sep 17 00:00:00 2001 From: Andreu Botella Date: Wed, 30 Dec 2020 09:46:29 +0100 Subject: 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 --- components/script/script_thread.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'components/script/script_thread.rs') diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs index b41c5885c83..68bbc524764 100644 --- a/components/script/script_thread.rs +++ b/components/script/script_thread.rs @@ -3415,15 +3415,13 @@ impl ScriptThread { (incomplete.browsing_context_id, incomplete.pipeline_id, None), ); - let parse_input = DOMString::new(); - document.set_https_state(metadata.https_state); document.set_navigation_start(incomplete.navigation_start_precise); if is_html_document == IsHTMLDocument::NonHTMLDocument { - ServoParser::parse_xml_document(&document, parse_input, final_url); + ServoParser::parse_xml_document(&document, None, final_url); } else { - ServoParser::parse_html_document(&document, parse_input, final_url); + ServoParser::parse_html_document(&document, None, final_url); } if incomplete.activity == DocumentActivity::FullyActive { -- cgit v1.2.3