mirror of
https://github.com/servo/servo.git
synced 2025-07-24 07:40:27 +01:00
XMLHttpRequest.responseXML returns null when a network error occurs
This commit is contained in:
parent
75c201f78e
commit
f089d166bc
1 changed files with 6 additions and 1 deletions
|
@ -1292,12 +1292,17 @@ impl XMLHttpRequest {
|
||||||
|
|
||||||
// https://xhr.spec.whatwg.org/#document-response
|
// https://xhr.spec.whatwg.org/#document-response
|
||||||
fn document_response(&self) -> Option<DomRoot<Document>> {
|
fn document_response(&self) -> Option<DomRoot<Document>> {
|
||||||
// Step 1
|
// Caching: if we have existing response xml, redirect it directly
|
||||||
let response = self.response_xml.get();
|
let response = self.response_xml.get();
|
||||||
if response.is_some() {
|
if response.is_some() {
|
||||||
return self.response_xml.get();
|
return self.response_xml.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Step 1
|
||||||
|
if self.response_status.get().is_err() {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
let mime_type = self.final_mime_type();
|
let mime_type = self.final_mime_type();
|
||||||
// TODO: prescan the response to determine encoding if final charset is null
|
// TODO: prescan the response to determine encoding if final charset is null
|
||||||
let charset = self.final_charset().unwrap_or(UTF_8);
|
let charset = self.final_charset().unwrap_or(UTF_8);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue