mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Update Hyper and OpenSSL
This commit is contained in:
parent
f66cae3f96
commit
e527c9a991
32 changed files with 298 additions and 396 deletions
|
@ -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(())
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue