webdriver: Fix validate_port if value is a Json::U64 (#87)
authorJason Juang <juangj@gmail.com>
Tue, 11 Apr 2017 13:28:00 +0100
changeset 428138 7fc47a3922a8efc0b7fba5c4a5293b8115e92ec4
parent 428137 bc266f86ce85151547e968cb8da3f5178d2e67e9
child 428139 9e315ddf70188d3afaa640dcfd25d92ac954e597
push id7761
push userjlund@mozilla.com
push dateFri, 15 Sep 2017 00:19:52 +0000
treeherdermozilla-beta@c38455951db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone57.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
webdriver: Fix validate_port if value is a Json::U64 (#87) Fixes: https://github.com/mozilla/geckodriver/issues/631 Source-Repo: https://github.com/mozilla/webdriver-rust Source-Revision: 43defd8d6bf33bd1edf56fd6e669660f99fdb20e committer: Andreas Tolfsen <ato@mozilla.com>
testing/webdriver/src/capabilities.rs
--- a/testing/webdriver/src/capabilities.rs
+++ b/testing/webdriver/src/capabilities.rs
@@ -236,18 +236,18 @@ impl SpecNewSessionParameters {
                 ErrorStatus::InvalidArgument,
                 format!("{} was not a string", name)
             ))
         }
         Ok(())
     }
 
     fn validate_port(name: &str, value: &Json) -> WebDriverResult<()> {
-        match value {
-            &Json::I64(x) => {
+        match value.as_i64() {
+            Some(x) => {
                 if x < 0 || x > 2i64.pow(16) - 1 {
                     return Err(WebDriverError::new(
                         ErrorStatus::InvalidArgument,
                         format!("{} is out of range", name)))
                 }
             }
             _ => return Err(WebDriverError::new(
                 ErrorStatus::InvalidArgument,