mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Implement displaying of text/plain documents
This is done by detecting the content type as text/plain and following the requirements from: https://html.spec.whatwg.org/multipage/browsers.html#read-text
This commit is contained in:
parent
82c52a7a1c
commit
618142fac7
4 changed files with 40 additions and 25 deletions
|
@ -82,6 +82,7 @@ use js;
|
|||
use url::Url;
|
||||
|
||||
use libc;
|
||||
use std::ascii::AsciiExt;
|
||||
use std::any::Any;
|
||||
use std::borrow::ToOwned;
|
||||
use std::cell::{Cell, RefCell};
|
||||
|
@ -984,10 +985,18 @@ impl ScriptTask {
|
|||
headers.get().map(|&LastModified(ref tm)| dom_last_modified(tm))
|
||||
});
|
||||
|
||||
let content_type = match response.metadata.content_type {
|
||||
Some((ref t, ref st)) if t.as_slice().eq_ignore_ascii_case("text") &&
|
||||
st.as_slice().eq_ignore_ascii_case("plain") => {
|
||||
Some("text/plain".to_owned())
|
||||
}
|
||||
_ => None
|
||||
};
|
||||
|
||||
let document = Document::new(window.r(),
|
||||
Some(final_url.clone()),
|
||||
IsHTMLDocument::HTMLDocument,
|
||||
None,
|
||||
content_type,
|
||||
last_modified,
|
||||
DocumentSource::FromParser).root();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue