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:
Chris Double 2015-03-13 16:42:43 +13:00
parent 82c52a7a1c
commit 618142fac7
4 changed files with 40 additions and 25 deletions

View file

@ -55,6 +55,11 @@ fn load(mut load_data: LoadData, start_chan: Sender<TargetedLoadResponse>, cooki
let mut url = load_data.url.clone();
let mut redirected_to = HashSet::new();
let senders = ResponseSenders {
immediate_consumer: start_chan,
eventual_consumer: load_data.consumer
};
// If the URL is a view-source scheme then the scheme data contains the
// real URL that should be used for which the source is to be viewed.
// Change our existing URL to that and keep note that we are viewing
@ -62,16 +67,19 @@ fn load(mut load_data: LoadData, start_chan: Sender<TargetedLoadResponse>, cooki
let viewing_source = if url.scheme == "view-source" {
let inner_url = load_data.url.non_relative_scheme_data().unwrap();
url = Url::parse(inner_url).unwrap();
match url.scheme.as_slice() {
"http" | "https" => {}
_ => {
let s = format!("The {} scheme with view-source is not supported", url.scheme);
send_error(url, s, senders);
return;
}
};
true
} else {
false
};
let senders = ResponseSenders {
immediate_consumer: start_chan,
eventual_consumer: load_data.consumer
};
// Loop to handle redirects.
loop {
iters = iters + 1;