geckodriver: Send some capabilities with the session response
authorJames Graham <james@hoppipolla.co.uk>
Tue, 21 Oct 2014 23:45:57 +0100
changeset 359395 6673a9d7f487ebf41ec90abac18bc661b8819b44
parent 359394 1ed990cd6cab47f7f99a043a56bbfbf46f6db9b6
child 359396 de4af8c953f0cb7b4deb01c494ae437664b8370b
push id31854
push userarchaeopteryx@coole-files.de
push dateSat, 20 May 2017 16:46:00 +0000
treeherdermozilla-central@51736db67723 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
geckodriver: Send some capabilities with the session response Source-Repo: https://github.com/mozilla/geckodriver Source-Revision: da0df07d621003404191002aac96693c1bc8c6b6
testing/geckodriver/src/httpserver.rs
testing/geckodriver/src/response.rs
--- a/testing/geckodriver/src/httpserver.rs
+++ b/testing/geckodriver/src/httpserver.rs
@@ -41,17 +41,17 @@ fn handle(mut incoming: Incoming) {
                             }
                             Err(err) => (err.http_status(), WebDriverResponse::from_err(&err))
                         }
                     },
                     Err(err) => {
                         (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();
                 }
                 resp.headers_mut().set(ContentLength(body.len()));
                 let mut stream = resp.start();
                 stream.write_str(body.as_slice());
                 stream.unwrap().end();
--- a/testing/geckodriver/src/response.rs
+++ b/testing/geckodriver/src/response.rs
@@ -51,28 +51,37 @@ impl WebDriverResponse {
         match message.command {
             GetMarionetteId => None,
             NewSession => {
                 if status == Success {
                     session.update(message,
                                    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,
                                             json::Null))
             },
             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,
                                                         "Failed to find value field");
                         return Some(WebDriverResponse::from_err(&error));
                     }
                 };
                 Some(WebDriverResponse::new(Some(session.id()),