From 19ffab82f15edc58faae4074872bfca6f4613345 Mon Sep 17 00:00:00 2001 From: Bogdan Cuza Date: Mon, 13 Apr 2015 15:13:15 +0300 Subject: Make Metadata use ContentType --- components/script/script_task.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'components/script/script_task.rs') diff --git a/components/script/script_task.rs b/components/script/script_task.rs index ec4b40bfc75..877289a27fd 100644 --- a/components/script/script_task.rs +++ b/components/script/script_task.rs @@ -83,7 +83,6 @@ use js; use url::Url; use libc; -use std::ascii::AsciiExt; use std::any::Any; use std::borrow::ToOwned; use std::cell::{Cell, RefCell}; @@ -96,6 +95,9 @@ use std::result::Result; use std::sync::mpsc::{channel, Sender, Receiver, Select}; use time::Tm; +use hyper::header::ContentType; +use hyper::mime::{Mime, TopLevel, SubLevel}; + thread_local!(pub static STACK_ROOTS: Cell> = Cell::new(None)); thread_local!(static SCRIPT_TASK_ROOT: RefCell> = RefCell::new(None)); @@ -1052,10 +1054,7 @@ impl ScriptTask { }); 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()) - } + Some(ContentType(Mime(TopLevel::Text, SubLevel::Plain, _))) => Some("text/plain".to_owned()), _ => None }; -- cgit v1.2.3