diff options
author | ddh <dianehosfelt@gmail.com> | 2017-01-11 12:07:36 +0000 |
---|---|---|
committer | Anthony Ramine <n.oxyde@gmail.com> | 2017-03-31 16:32:21 +0200 |
commit | e527c9a991c00a3d01fcf262b9fee0b5c948436e (patch) | |
tree | 75a909ab4048eb74174454d65758efbb6c63934e /components/script/webdriver_handlers.rs | |
parent | f66cae3f96c1b9a835f2d33477593e083395f402 (diff) | |
download | servo-e527c9a991c00a3d01fcf262b9fee0b5c948436e.tar.gz servo-e527c9a991c00a3d01fcf262b9fee0b5c948436e.zip |
Update Hyper and OpenSSL
Diffstat (limited to 'components/script/webdriver_handlers.rs')
-rw-r--r-- | components/script/webdriver_handlers.rs | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/components/script/webdriver_handlers.rs b/components/script/webdriver_handlers.rs index 6618bac4241..7e7fe95122b 100644 --- a/components/script/webdriver_handlers.rs +++ b/components/script/webdriver_handlers.rs @@ -182,9 +182,9 @@ pub fn handle_get_active_element(documents: &Documents, pub fn handle_get_cookies(documents: &Documents, pipeline: PipelineId, - reply: IpcSender<Vec<Serde<Cookie>>>) { + reply: IpcSender<Vec<Serde<Cookie<'static>>>>) { // TODO: Return an error if the pipeline doesn't exist? - let cookies: Vec<Serde<Cookie>> = match documents.find_document(pipeline) { + let cookies = match documents.find_document(pipeline) { None => Vec::new(), Some(document) => { let url = document.url(); @@ -202,9 +202,9 @@ pub fn handle_get_cookies(documents: &Documents, pub fn handle_get_cookie(documents: &Documents, pipeline: PipelineId, name: String, - reply: IpcSender<Vec<Serde<Cookie>>>) { + reply: IpcSender<Vec<Serde<Cookie<'static>>>>) { // TODO: Return an error if the pipeline doesn't exist? - let cookies: Vec<Serde<Cookie>> = match documents.find_document(pipeline) { + let cookies = match documents.find_document(pipeline) { None => Vec::new(), Some(document) => { let url = document.url(); @@ -215,13 +215,13 @@ pub fn handle_get_cookie(documents: &Documents, receiver.recv().unwrap() }, }; - reply.send(cookies.into_iter().filter(|c| c.name == &*name).collect()).unwrap(); + reply.send(cookies.into_iter().filter(|c| c.name() == &*name).collect()).unwrap(); } // https://w3c.github.io/webdriver/webdriver-spec.html#add-cookie pub fn handle_add_cookie(documents: &Documents, pipeline: PipelineId, - cookie: Cookie, + cookie: Cookie<'static>, reply: IpcSender<Result<(), WebDriverCookieError>>) { // TODO: Return a different error if the pipeline doesn't exist? let document = match documents.find_document(pipeline) { @@ -229,22 +229,24 @@ pub fn handle_add_cookie(documents: &Documents, None => return reply.send(Err(WebDriverCookieError::UnableToSetCookie)).unwrap(), }; let url = document.url(); - let method = if cookie.httponly { + let method = if cookie.http_only() { HTTP } else { NonHTTP }; - reply.send(match (document.is_cookie_averse(), cookie.domain.clone()) { + + let domain = cookie.domain().map(ToOwned::to_owned); + reply.send(match (document.is_cookie_averse(), domain) { (true, _) => Err(WebDriverCookieError::InvalidDomain), - (false, Some(ref domain)) if url.host_str().map(|x| { x == &**domain }).unwrap_or(false) => { + (false, Some(ref domain)) if url.host_str().map(|x| { x == domain }).unwrap_or(false) => { let _ = document.window().upcast::<GlobalScope>().resource_threads().send( - SetCookieForUrl(url, cookie, method) + SetCookieForUrl(url, Serde(cookie), method) ); Ok(()) }, (false, None) => { let _ = document.window().upcast::<GlobalScope>().resource_threads().send( - SetCookieForUrl(url, cookie, method) + SetCookieForUrl(url, Serde(cookie), method) ); Ok(()) }, |