diff options
author | Ms2ger <ms2ger@gmail.com> | 2015-01-04 11:53:35 +0100 |
---|---|---|
committer | Ms2ger <ms2ger@gmail.com> | 2015-01-04 15:26:40 +0100 |
commit | b16f9cea092c7591117684491565bcc528fca391 (patch) | |
tree | d7f734234564068cab598927947930cd6b009313 /components/script | |
parent | 3be587606f7172354632bdbc339e0bf1d97ae2a2 (diff) | |
download | servo-b16f9cea092c7591117684491565bcc528fca391.tar.gz servo-b16f9cea092c7591117684491565bcc528fca391.zip |
Qualify hyper enums.
Diffstat (limited to 'components/script')
-rw-r--r-- | components/script/cors.rs | 16 | ||||
-rw-r--r-- | components/script/dom/htmlformelement.rs | 4 | ||||
-rw-r--r-- | components/script/dom/xmlhttprequest.rs | 12 |
3 files changed, 16 insertions, 16 deletions
diff --git a/components/script/cors.rs b/components/script/cors.rs index 6b83bd889e9..24900e1daa1 100644 --- a/components/script/cors.rs +++ b/components/script/cors.rs @@ -18,10 +18,10 @@ use time::{now, Timespec}; use hyper::header::{Headers, Header, HeaderFormat, HeaderView}; use hyper::header::common::util as header_util; use hyper::client::Request; -use hyper::mime::{mod, Mime}; +use hyper::mime::{Mime, TopLevel, SubLevel}; use hyper::header::common::{ContentType, Host}; -use hyper::method::{Method, Get, Head, Post, Options}; -use hyper::status::Success; +use hyper::method::Method; +use hyper::status::StatusClass::Success; use url::{SchemeData, Url}; @@ -118,7 +118,7 @@ impl CORSRequest { let mut cors_response = CORSResponse::new(); let mut preflight = self.clone(); // Step 1 - preflight.method = Options; // Step 2 + preflight.method = Method::Options; // Step 2 preflight.headers = Headers::new(); // Step 3 // Step 4 preflight.headers.set(AccessControlRequestMethod(self.method.clone())); @@ -364,9 +364,9 @@ fn is_simple_header(h: &HeaderView) -> bool { match h.name().to_ascii_lower().as_slice() { "accept" | "accept-language" | "content-language" => true, "content-type" => match h.value() { - Some(&ContentType(Mime(mime::Text, mime::Plain, _))) | - Some(&ContentType(Mime(mime::Application, mime::WwwFormUrlEncoded, _))) | - Some(&ContentType(Mime(mime::Multipart, mime::FormData, _))) => true, + Some(&ContentType(Mime(TopLevel::Text, SubLevel::Plain, _))) | + Some(&ContentType(Mime(TopLevel::Application, SubLevel::WwwFormUrlEncoded, _))) | + Some(&ContentType(Mime(TopLevel::Multipart, SubLevel::FormData, _))) => true, _ => false @@ -377,7 +377,7 @@ fn is_simple_header(h: &HeaderView) -> bool { fn is_simple_method(m: &Method) -> bool { match *m { - Get | Head | Post => true, + Method::Get | Method::Head | Method::Post => true, _ => false } } diff --git a/components/script/dom/htmlformelement.rs b/components/script/dom/htmlformelement.rs index e313ac05195..c1c38c2f2c3 100644 --- a/components/script/dom/htmlformelement.rs +++ b/components/script/dom/htmlformelement.rs @@ -20,7 +20,7 @@ use dom::htmlelement::HTMLElement; use dom::htmlinputelement::HTMLInputElement; use dom::htmltextareaelement::HTMLTextAreaElement; use dom::node::{Node, NodeHelpers, NodeTypeId, document_from_node, window_from_node}; -use hyper::method::Post; +use hyper::method::Method; use servo_msg::constellation_msg::LoadData; use servo_util::str::DOMString; use script_task::{ScriptChan, ScriptMsg}; @@ -195,7 +195,7 @@ impl<'a> HTMLFormElementHelpers for JSRef<'a, HTMLFormElement> { load_data.url.query = Some(parsed_data); }, ("http", FormMethod::FormPost) | ("https", FormMethod::FormPost) => { - load_data.method = Post; + load_data.method = Method::Post; load_data.data = Some(parsed_data.into_bytes()); }, // https://html.spec.whatwg.org/multipage/forms.html#submit-get-action diff --git a/components/script/dom/xmlhttprequest.rs b/components/script/dom/xmlhttprequest.rs index b509128230b..4004a05a58a 100644 --- a/components/script/dom/xmlhttprequest.rs +++ b/components/script/dom/xmlhttprequest.rs @@ -36,7 +36,7 @@ use hyper::header::Headers; use hyper::header::common::{Accept, ContentLength, ContentType}; use hyper::http::RawStatus; use hyper::mime::{mod, Mime}; -use hyper::method::{Method, Get, Head, Connect, Trace, Extension}; +use hyper::method::Method; use js::jsapi::{JS_ParseJSON, JSContext}; use js::jsapi::JS_ClearPendingException; @@ -173,7 +173,7 @@ impl XMLHttpRequest { response_xml: Default::default(), response_headers: DOMRefCell::new(Headers::new()), - request_method: DOMRefCell::new(Get), + request_method: DOMRefCell::new(Method::Get), request_url: DOMRefCell::new(None), request_headers: DOMRefCell::new(Headers::new()), request_body_len: Cell::new(0), @@ -360,8 +360,8 @@ impl<'a> XMLHttpRequestMethods for JSRef<'a, XMLHttpRequest> { // Step 2 match maybe_method { // Step 4 - Some(Connect) | Some(Trace) => Err(Security), - Some(Extension(ref t)) if t.as_slice() == "TRACK" => Err(Security), + Some(Method::Connect) | Some(Method::Trace) => Err(Security), + Some(Method::Extension(ref t)) if t.as_slice() == "TRACK" => Err(Security), Some(_) if method.is_token() => { *self.request_method.borrow_mut() = maybe_method.unwrap(); @@ -493,7 +493,7 @@ impl<'a> XMLHttpRequestMethods for JSRef<'a, XMLHttpRequest> { } let data = match *self.request_method.borrow() { - Get | Head => None, // Step 3 + Method::Get | Method::Head => None, // Step 3 _ => data }; let extracted = data.as_ref().map(|d| d.extract()); @@ -955,7 +955,7 @@ impl<'a> PrivateXMLHttpRequestHelpers for JSRef<'a, XMLHttpRequest> { match self.response_headers.borrow().get() { Some(&ContentType(mime::Mime(_, _, ref params))) => { for &(ref name, ref value) in params.iter() { - if name == &mime::Charset { + if name == &mime::Attr::Charset { encoding = encoding_from_whatwg_label(value.to_string().as_slice()).unwrap_or(encoding); } } |