From 18a90f04db545c091aec5f244b74953d04140253 Mon Sep 17 00:00:00 2001 From: Bastien Orivel Date: Fri, 19 Apr 2019 18:22:42 +0200 Subject: [PATCH] Update webdriver to 0.39 --- Cargo.lock | 6 +++--- components/webdriver_server/Cargo.toml | 2 +- components/webdriver_server/lib.rs | 17 ++++++++++------- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2a09547b7e3f..a4e22a707c0b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4897,7 +4897,7 @@ dependencies = [ [[package]] name = "webdriver" -version = "0.38.1" +version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4940,7 +4940,7 @@ dependencies = [ "servo_url 0.0.1", "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "uuid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "webdriver 0.38.1 (registry+https://github.com/rust-lang/crates.io-index)", + "webdriver 0.39.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -5636,7 +5636,7 @@ dependencies = [ "checksum wayland-protocols 0.21.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d3f6cebb98963f028d397e9bad2acf9d3b2f6b76fae65aea191edd9e7c0df88c" "checksum wayland-scanner 0.21.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f1927ee62e4e149c010dc9eca8ca47e238416cd6f45f688eb9f8a8e9c3794c30" "checksum wayland-sys 0.21.4 (registry+https://github.com/rust-lang/crates.io-index)" = "ca41ed78a12256f81df6f53fcbe4503213ba442e02cdad3c9c888a64a668eaf4" -"checksum webdriver 0.38.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c6022ea74cc9f0085c01ff24965d935cd40f9592d7a56f13909c65f08ea98149" +"checksum webdriver 0.39.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0533b0b0a05e2e5c081317759a038482806c6085c9605dded03c8bbd2498b042" "checksum webrender 0.60.0 (git+https://github.com/servo/webrender)" = "" "checksum webrender_api 0.60.0 (git+https://github.com/servo/webrender)" = "" "checksum webrender_build 0.0.1 (git+https://github.com/servo/webrender)" = "" diff --git a/components/webdriver_server/Cargo.toml b/components/webdriver_server/Cargo.toml index 3fecf3380981..fd7b4a165909 100644 --- a/components/webdriver_server/Cargo.toml +++ b/components/webdriver_server/Cargo.toml @@ -31,4 +31,4 @@ servo_config = {path = "../config"} servo_url = {path = "../url"} url = "1.2" uuid = {version = "0.7", features = ["v4"]} -webdriver = "0.38" +webdriver = "0.39" diff --git a/components/webdriver_server/lib.rs b/components/webdriver_server/lib.rs index bf838715a4ca..9ce145d3bf31 100644 --- a/components/webdriver_server/lib.rs +++ b/components/webdriver_server/lib.rs @@ -109,7 +109,7 @@ struct WebDriverSession { /// Time to wait for injected scripts to run before interrupting them. A [`None`] value /// specifies that the script should run indefinitely. - script_timeout: u64, + script_timeout: Option, /// Time to wait for a page to finish loading upon navigation. load_timeout: u64, @@ -129,7 +129,7 @@ impl WebDriverSession { browsing_context_id: browsing_context_id, top_level_browsing_context_id: top_level_browsing_context_id, - script_timeout: 30_000, + script_timeout: Some(30_000), load_timeout: 300_000, implicit_wait_timeout: 0, } @@ -981,7 +981,7 @@ impl Handler { .ok_or(WebDriverError::new(ErrorStatus::SessionNotCreated, ""))?; if let Some(timeout) = parameters.script { - session.script_timeout = timeout + session.script_timeout = timeout; } if let Some(timeout) = parameters.page_load { session.load_timeout = timeout @@ -1019,11 +1019,14 @@ impl Handler { let func_body = ¶meters.script; let args_string = "window.webdriverCallback"; + let timeout_script = if let Some(script_timeout) = self.session()?.script_timeout { + format!("setTimeout(webdriverTimeout, {});", script_timeout) + } else { + "".into() + }; let script = format!( - "setTimeout(webdriverTimeout, {}); (function(callback) {{ {} }})({})", - self.session()?.script_timeout, - func_body, - args_string + "{} (function(callback) {{ {} }})({})", + timeout_script, func_body, args_string ); let (sender, receiver) = ipc::channel().unwrap();