geckodriver: Send some capabilities with the session response

Source-Repo: https://github.com/mozilla/geckodriver
Source-Revision: da0df07d621003404191002aac96693c1bc8c6b6

--HG--
extra : rebase_source : e8cf28ed88041fe4e40c92445be8edf94bcb6a32
This commit is contained in:
James Graham 2014-10-21 23:45:57 +01:00
Родитель 2512731a89
Коммит 995aebe007
2 изменённых файлов: 14 добавлений и 5 удалений

Просмотреть файл

@ -46,7 +46,7 @@ fn handle(mut incoming: Incoming) {
(err.http_status(), WebDriverResponse::from_err(&err))
}
};
let body = resp_data.to_json().to_string();
let body = format!("{}\n", resp_data.to_json().to_string());
{
let mut status_code = resp.status_mut();
*status_code = FromPrimitive::from_int(status).unwrap();

Просмотреть файл

@ -56,8 +56,19 @@ impl WebDriverResponse {
json_data.find(&"from".to_string()).unwrap(),
json_data.find(&"value".to_string()).unwrap());
};
//XXX spec - no idea what capabilities are supposed to be
let value = match json_data.find(&"value".to_string()) {
Some(data) => data,
None => {
let error = WebDriverError::new(Some(session.session_id.clone()),
UnknownError,
"Failed to find value field");
return Some(WebDriverResponse::from_err(&error));
}
};
Some(WebDriverResponse::new(Some(session.session_id.clone()), status,
json::Null))
value.clone()
))
},
Get(_) => {
Some(WebDriverResponse::new(Some(session.session_id.clone()), status,
@ -65,9 +76,7 @@ impl WebDriverResponse {
},
GetCurrentUrl => {
let value = match json_data.find(&"value".to_string()) {
Some(ref data) => {
data.clone()
},
Some(data) => data,
None => {
let error = WebDriverError::new(Some(session.session_id.clone()),
UnknownError,