diff options
Diffstat (limited to 'components/script/parse/html.rs')
-rw-r--r-- | components/script/parse/html.rs | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/components/script/parse/html.rs b/components/script/parse/html.rs index d2ab13fbd3e..d647df64d13 100644 --- a/components/script/parse/html.rs +++ b/components/script/parse/html.rs @@ -25,8 +25,8 @@ use encoding::types::{Encoding, DecodeReplace}; use servo_net::resource_task::{Load, LoadData, Payload, Done, ResourceTask}; use servo_msg::constellation_msg::LoadData as MsgLoadData; use servo_util::task_state; -use servo_util::task_state::InHTMLParser; -use std::ascii::StrAsciiExt; +use servo_util::task_state::IN_HTML_PARSER; +use std::ascii::AsciiExt; use std::comm::channel; use std::str::MaybeOwned; use url::Url; @@ -48,19 +48,19 @@ fn parse_last_modified(timestamp: &str) -> String { // RFC 822, updated by RFC 1123 match time::strptime(timestamp, "%a, %d %b %Y %T %Z") { - Ok(t) => return t.to_local().strftime(format), + Ok(t) => return t.to_local().strftime(format).unwrap(), Err(_) => () } // RFC 850, obsoleted by RFC 1036 match time::strptime(timestamp, "%A, %d-%b-%y %T %Z") { - Ok(t) => return t.to_local().strftime(format), + Ok(t) => return t.to_local().strftime(format).unwrap(), Err(_) => () } // ANSI C's asctime() format match time::strptime(timestamp, "%c") { - Ok(t) => t.to_local().strftime(format), + Ok(t) => t.to_local().strftime(format).unwrap(), Err(_) => String::from_str("") } } @@ -210,8 +210,6 @@ pub fn parse_html(page: &Page, let load_response = input_port.recv(); - debug!("Fetched page; metadata is {:?}", load_response.metadata); - load_response.metadata.headers.as_ref().map(|headers| { let header = headers.iter().find(|h| h.header_name().as_slice().to_ascii_lower() == "last-modified".to_string() @@ -246,7 +244,7 @@ pub fn parse_html(page: &Page, let parser = ServoHTMLParser::new(base_url.clone(), document).root(); let parser: JSRef<ServoHTMLParser> = *parser; - task_state::enter(InHTMLParser); + task_state::enter(IN_HTML_PARSER); match input { InputString(s) => { @@ -268,7 +266,7 @@ pub fn parse_html(page: &Page, parser.parse_chunk(data); } Done(Err(err)) => { - fail!("Failed to load page URL {:s}, error: {:s}", url.serialize(), err); + panic!("Failed to load page URL {:s}, error: {:s}", url.serialize(), err); } Done(Ok(())) => break, } @@ -280,7 +278,7 @@ pub fn parse_html(page: &Page, parser.finish(); - task_state::exit(InHTMLParser); + task_state::exit(IN_HTML_PARSER); debug!("finished parsing"); } |