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>

--HG--
extra : subtree_source : http%3A//tristan.corp.lon2.mozilla.com%3A8000
extra : subtree_revision : 7c3bea030da6982a4903328e18c4cbf96b284e10
This commit is contained in:
Jason Juang 2017-04-11 13:28:00 +01:00
parent 0a800c0b01
commit f6aa609d74

View File

@ -241,8 +241,8 @@ impl SpecNewSessionParameters {
}
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,