зеркало из https://github.com/mozilla/gecko-dev.git
geckodriver: Support the new version of the new session command.
Support the alwaysMatch/firstMatch new session command. Move the capabilities handling into geckodriver as far as possible so that marionette itself should not be rejecting sessions (as this is expensive and can only happen after gecko starts). Use mozversion to provide (currently somewhat hacky) version number matching for the browserVersion capability. Source-Repo: https://github.com/mozilla/geckodriver Source-Revision: 6f1e3c192463342a0a49f5f3f0af914ad0e1ae7a committer: Andreas Tolfsen <ato@mozilla.com> --HG-- extra : rebase_source : eec91abc5dcab0f35cd758ad1900a5d15988bd0d
This commit is contained in:
Родитель
34230c6dc4
Коммит
6329d1b840
|
@ -3,20 +3,21 @@ name = "geckodriver"
|
|||
version = "0.15.0"
|
||||
dependencies = [
|
||||
"chrono 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"clap 2.20.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"clap 2.22.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.10.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"mozprofile 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"mozrunner 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"mozversion 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"regex 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-serialize 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-serialize 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"slog 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"slog-atomic 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"slog-stdlog 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"slog-stream 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"uuid 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"webdriver 0.23.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"webdriver 0.24.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"zip 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
|
@ -31,7 +32,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "aho-corasick"
|
||||
version = "0.6.2"
|
||||
version = "0.6.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"memchr 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -56,13 +57,13 @@ name = "backtrace-sys"
|
|||
version = "0.1.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"gcc 0.3.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gcc 0.3.45 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "0.7.0"
|
||||
version = "0.8.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
|
@ -79,7 +80,7 @@ name = "bzip2-sys"
|
|||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"gcc 0.3.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gcc 0.3.45 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
|
@ -99,16 +100,15 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "2.20.5"
|
||||
version = "2.22.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bitflags 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"strsim 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"term_size 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-segmentation 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"vec_map 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"vec_map 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -144,7 +144,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "gcc"
|
||||
version = "0.3.43"
|
||||
version = "0.3.45"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
|
@ -160,9 +160,9 @@ dependencies = [
|
|||
"httparse 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"mime 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"mime 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num_cpus 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-serialize 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-serialize 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"time 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"traitobject 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -230,7 +230,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
|
||||
[[package]]
|
||||
name = "lazy_static"
|
||||
version = "0.2.4"
|
||||
version = "0.2.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
|
@ -258,7 +258,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "mime"
|
||||
version = "0.2.2"
|
||||
version = "0.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -269,7 +269,7 @@ name = "miniz-sys"
|
|||
version = "0.1.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"gcc 0.3.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gcc 0.3.45 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
|
@ -293,6 +293,16 @@ dependencies = [
|
|||
"winreg 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mozversion"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"regex 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rust-ini 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"semver 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "msdos_time"
|
||||
version = "0.1.5"
|
||||
|
@ -358,7 +368,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "redox_syscall"
|
||||
version = "0.1.16"
|
||||
version = "0.1.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
|
@ -366,7 +376,7 @@ name = "regex"
|
|||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"aho-corasick 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"aho-corasick 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"memchr 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"regex-syntax 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"thread_local 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -378,6 +388,14 @@ name = "regex-syntax"
|
|||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "rust-ini"
|
||||
version = "0.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustc-demangle"
|
||||
version = "0.1.4"
|
||||
|
@ -385,7 +403,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
|
||||
[[package]]
|
||||
name = "rustc-serialize"
|
||||
version = "0.3.22"
|
||||
version = "0.3.23"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
|
@ -401,6 +419,19 @@ name = "semver"
|
|||
version = "0.1.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "semver"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "semver-parser"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "slog"
|
||||
version = "1.5.2"
|
||||
|
@ -430,7 +461,7 @@ version = "1.1.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"crossbeam 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"slog 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"slog-term 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -523,7 +554,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
dependencies = [
|
||||
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"redox_syscall 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"redox_syscall 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
|
@ -596,12 +627,12 @@ version = "0.1.18"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"rand 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-serialize 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-serialize 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "vec_map"
|
||||
version = "0.6.0"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
|
@ -611,7 +642,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
|
||||
[[package]]
|
||||
name = "webdriver"
|
||||
version = "0.23.1"
|
||||
version = "0.24.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"backtrace 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -619,8 +650,9 @@ dependencies = [
|
|||
"hyper 0.10.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"regex 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-serialize 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-serialize 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"time 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -641,7 +673,7 @@ dependencies = [
|
|||
"advapi32-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"kernel32-sys 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ktmw32-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-serialize 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-serialize 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
|
@ -659,20 +691,20 @@ dependencies = [
|
|||
|
||||
[metadata]
|
||||
"checksum advapi32-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "307c92332867e586720c0222ee9d890bbe8431711efed8a1b06bc5b40fc66bd7"
|
||||
"checksum aho-corasick 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0638fd549427caa90c499814196d1b9e3725eb4d15d7339d6de073a680ed0ca2"
|
||||
"checksum aho-corasick 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "500909c4f87a9e52355b26626d890833e9e1d53ac566db76c36faa984b889699"
|
||||
"checksum backtrace 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f551bc2ddd53aea015d453ef0b635af89444afa5ed2405dd0b2062ad5d600d80"
|
||||
"checksum backtrace-sys 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "d192fd129132fbc97497c1f2ec2c2c5174e376b95f535199ef4fe0a293d33842"
|
||||
"checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d"
|
||||
"checksum bitflags 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1370e9fc2a6ae53aea8b7a5110edbd08836ed87c88736dfabccade1c2b44bff4"
|
||||
"checksum bzip2 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e39c71fcff507b547240346a894c5df38e6fd42fb02590a5d5b3f2dae9173ad2"
|
||||
"checksum bzip2-sys 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "98ce3fff84d4e90011f464bbdf48e3428f04270439f703868fd489d2aaedfc30"
|
||||
"checksum cfg-if 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "de1e760d7b6535af4241fca8bd8adf68e2e7edacc6b29f5d399050c5e48cf88c"
|
||||
"checksum chrono 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)" = "9213f7cd7c27e95c2b57c49f0e69b1ea65b27138da84a170133fd21b07659c00"
|
||||
"checksum clap 2.20.5 (registry+https://github.com/rust-lang/crates.io-index)" = "7db281b0520e97fbd15cd615dcd8f8bcad0c26f5f7d5effe705f090f39e9a758"
|
||||
"checksum clap 2.22.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e17a4a72ffea176f77d6e2db609c6c919ef221f23862c9915e687fb54d833485"
|
||||
"checksum cookie 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ce776927cd64cbe74ebd1d9b375edb9d1b6bfa808618ddf9548645e019ebdfbb"
|
||||
"checksum crossbeam 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "0c5ea215664ca264da8a9d9c3be80d2eaf30923c259d03e870388eb927508f97"
|
||||
"checksum dbghelp-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "97590ba53bcb8ac28279161ca943a924d1fd4a8fb3fa63302591647c4fc5b850"
|
||||
"checksum flate2 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)" = "d4e4d0c15ef829cbc1b7cda651746be19cceeb238be7b1049227b14891df9e25"
|
||||
"checksum gcc 0.3.43 (registry+https://github.com/rust-lang/crates.io-index)" = "c07c758b972368e703a562686adb39125707cc1ef3399da8c019fc6c2498a75d"
|
||||
"checksum gcc 0.3.45 (registry+https://github.com/rust-lang/crates.io-index)" = "40899336fb50db0c78710f53e87afc54d8c7266fb76262fecc78ca1a7f09deae"
|
||||
"checksum httparse 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a6e7a63e511f9edffbab707141fbb8707d1a3098615fb2adbd5769cdfcc9b17d"
|
||||
"checksum hyper 0.10.5 (registry+https://github.com/rust-lang/crates.io-index)" = "43a15e3273b2133aaac0150478ab443fb89f15c3de41d8d93d8f3bb14bf560f6"
|
||||
"checksum idna 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1053236e00ce4f668aeca4a769a09b3bf5a682d802abd6f3cb39374f6b162c11"
|
||||
|
@ -682,15 +714,16 @@ dependencies = [
|
|||
"checksum ktmw32-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7f9313a869ff779ae08dd990b75a92dc06aa16d771f41305f7286649cd39a0ee"
|
||||
"checksum language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a"
|
||||
"checksum lazy_static 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "cf186d1a8aa5f5bee5fd662bc9c1b949e0259e1bcc379d1f006847b0080c7417"
|
||||
"checksum lazy_static 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "7291b1dd97d331f752620b02dfdbc231df7fc01bf282a00769e1cdb963c460dc"
|
||||
"checksum lazy_static 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "4732c563b9a21a406565c4747daa7b46742f082911ae4753f390dc9ec7ee1a97"
|
||||
"checksum libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)" = "88ee81885f9f04bff991e306fea7c1c60a5f0f9e409e99f6b40e3311a3363135"
|
||||
"checksum log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "5141eca02775a762cc6cd564d8d2c50f67c0ea3a372cbf1c51592b3e029e10ad"
|
||||
"checksum matches 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "efd7622e3022e1a6eaa602c4cea8912254e5582c9c692e9167714182244801b1"
|
||||
"checksum memchr 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1dbccc0e46f1ea47b9f17e6d67c5a96bd27030519c519c9c91327e31275a47b4"
|
||||
"checksum mime 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b5c93a4bd787ddc6e7833c519b73a50883deb5863d76d9b71eb8216fb7f94e66"
|
||||
"checksum mime 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "5514f038123342d01ee5f95129e4ef1e0470c93bc29edf058a46f9ee3ba6737e"
|
||||
"checksum miniz-sys 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "28eaee17666671fa872e567547e8428e83308ebe5808cdf6a0e28397dbe2c726"
|
||||
"checksum mozprofile 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "01177c10a9a0a905d6b21dc6d994186f941c9b15fe1034a4b62d440fddc83c81"
|
||||
"checksum mozrunner 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d0058147554cd0b9062b2bd1951590cb7a22023cb6b76bd7317496c51eb50da0"
|
||||
"checksum mozversion 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b9459629985b7524e318242bcdfbf8ccf66b53c6bd0872fdf376815b89b7b169"
|
||||
"checksum msdos_time 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "65ba9d75bcea84e07812618fedf284a64776c2f2ea0cad6bca7f69739695a958"
|
||||
"checksum num 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)" = "98b15ba84e910ea7a1973bccd3df7b31ae282bf9d8bd2897779950c9b8303d40"
|
||||
"checksum num-integer 0.1.33 (registry+https://github.com/rust-lang/crates.io-index)" = "21e4df1098d1d797d27ef0c69c178c3fab64941559b290fcae198e0825c9c8b5"
|
||||
|
@ -699,13 +732,16 @@ dependencies = [
|
|||
"checksum num_cpus 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a18c392466409c50b87369414a2680c93e739aedeb498eb2bff7d7eb569744e2"
|
||||
"checksum podio 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e5422a1ee1bc57cc47ae717b0137314258138f38fd5f3cea083f43a9725383a0"
|
||||
"checksum rand 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "022e0636ec2519ddae48154b028864bdce4eaf7d35226ab8e65c611be97b189d"
|
||||
"checksum redox_syscall 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "8dd35cc9a8bdec562c757e3d43c1526b5c6d2653e23e2315065bc25556550753"
|
||||
"checksum redox_syscall 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)" = "29dbdfd4b9df8ab31dec47c6087b7b13cbf4a776f335e4de8efba8288dda075b"
|
||||
"checksum regex 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4278c17d0f6d62dfef0ab00028feb45bd7d2102843f80763474eeb1be8a10c01"
|
||||
"checksum regex-syntax 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9191b1f57603095f105d317e375d19b1c9c5c3185ea9633a99a6dcbed04457"
|
||||
"checksum rust-ini 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "06d4e8b0b50e7e7f827d609fa9746e1cf6371a1fa15404a1a0a86152a801079f"
|
||||
"checksum rustc-demangle 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "3058a43ada2c2d0b92b3ae38007a2d0fa5e9db971be260e0171408a4ff471c95"
|
||||
"checksum rustc-serialize 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)" = "237546c689f20bb44980270c73c3b9edd0891c1be49cc1274406134a66d3957b"
|
||||
"checksum rustc-serialize 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)" = "684ce48436d6465300c9ea783b6b14c4361d6b8dcbb1375b486a69cc19e2dfb0"
|
||||
"checksum rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "c5f5376ea5e30ce23c03eb77cbe4962b988deead10910c372b226388b594c084"
|
||||
"checksum semver 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)" = "d4f410fedcf71af0345d7607d246e7ad15faaadd49d240ee3b24e5dc21a820ac"
|
||||
"checksum semver 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a3186ec9e65071a2095434b1f5bb24838d4e8e130f584c790f6033c79943537"
|
||||
"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
|
||||
"checksum slog 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bab9d589681f7d6b9ca4ed5cc861779a392bca7beaae2f69f2341617415a78dc"
|
||||
"checksum slog-atomic 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d6f5a4e4908d6818fe553b6126ba5377801556ab885c65ebf960b722a6778864"
|
||||
"checksum slog-extra 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "511581f4dd1dc90e4eca99b60be8a692d9c975e8757558aa774f16007d27492a"
|
||||
|
@ -731,9 +767,9 @@ dependencies = [
|
|||
"checksum url 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f5ba8a749fb4479b043733416c244fa9d1d3af3d7c23804944651c8a448cb87e"
|
||||
"checksum utf8-ranges 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "662fab6525a98beff2921d7f61a39e7d59e0b425ebc7d0d9e66d316e55124122"
|
||||
"checksum uuid 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "78c590b5bd79ed10aad8fb75f078a59d8db445af6c743e55c4a53227fc01c13f"
|
||||
"checksum vec_map 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cac5efe5cb0fa14ec2f84f83c701c562ee63f6dcc680861b21d65c682adfb05f"
|
||||
"checksum vec_map 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f8cdc8b93bd0198ed872357fb2e667f7125646b1762f16d60b2c96350d361897"
|
||||
"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
|
||||
"checksum webdriver 0.23.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d89863a79c050db66f7d666b907752900505badff82683b6af04605a6dca2041"
|
||||
"checksum webdriver 0.24.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5ec09fff6c7a59e9a8a4ad0439d5f308d769ddca29857170e101b1fc6735150f"
|
||||
"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
|
||||
"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"
|
||||
"checksum winreg 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e63857fb213f619b4c4fff86b158285c76766aac7e7474967e92fb6dbbfeefe9"
|
||||
|
|
|
@ -19,6 +19,7 @@ lazy_static = "0.1"
|
|||
log = "0.3"
|
||||
mozprofile = "0.2"
|
||||
mozrunner = "0.3"
|
||||
mozversion = "0.1"
|
||||
regex = "0.2"
|
||||
rustc-serialize = "0.3"
|
||||
slog = "1"
|
||||
|
@ -26,5 +27,5 @@ slog-atomic = "0.4"
|
|||
slog-stdlog = "1"
|
||||
slog-stream = "1"
|
||||
uuid = "0.1.18"
|
||||
webdriver = "0.23"
|
||||
webdriver = "0.24"
|
||||
zip = "0.1"
|
||||
|
|
|
@ -1,21 +1,210 @@
|
|||
use std::collections::BTreeMap;
|
||||
use std::fs;
|
||||
use std::io;
|
||||
use std::io::BufWriter;
|
||||
use std::io::Cursor;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::str::FromStr;
|
||||
|
||||
use logging::LogLevel;
|
||||
use marionette::LogOptions;
|
||||
use mozprofile::preferences::Pref;
|
||||
use mozprofile::profile::Profile;
|
||||
use mozrunner::runner::platform::firefox_default_path;
|
||||
use mozversion::{self, firefox_version, Version};
|
||||
use rustc_serialize::base64::FromBase64;
|
||||
use rustc_serialize::json::Json;
|
||||
use webdriver::command::NewSessionParameters;
|
||||
use std::collections::BTreeMap;
|
||||
use std::default::Default;
|
||||
use std::error::Error;
|
||||
use std::fs;
|
||||
use std::io::BufWriter;
|
||||
use std::io::Cursor;
|
||||
use std::io;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::str::FromStr;
|
||||
use webdriver::capabilities::BrowserCapabilities;
|
||||
use webdriver::error::{ErrorStatus, WebDriverError, WebDriverResult};
|
||||
use zip;
|
||||
|
||||
use logging::LogLevel;
|
||||
pub struct FirefoxCapabilities<'a> {
|
||||
pub chosen_binary: Option<PathBuf>,
|
||||
fallback_binary: Option<&'a PathBuf>,
|
||||
version_cache: BTreeMap<PathBuf, String>,
|
||||
}
|
||||
|
||||
impl <'a> FirefoxCapabilities<'a> {
|
||||
pub fn new(fallback_binary: Option<&'a PathBuf>) -> FirefoxCapabilities<'a> {
|
||||
FirefoxCapabilities {
|
||||
chosen_binary: None,
|
||||
fallback_binary: fallback_binary,
|
||||
version_cache: BTreeMap::new()
|
||||
}
|
||||
}
|
||||
|
||||
fn set_binary(&mut self, capabilities: &BTreeMap<String, Json>) {
|
||||
self.chosen_binary = capabilities.get("moz:firefoxOptions")
|
||||
.and_then(|x| x.find("binary"))
|
||||
.and_then(|x| x.as_string())
|
||||
.map(|x| PathBuf::from(x))
|
||||
.or_else(|| self.fallback_binary
|
||||
.map(|x| x.clone()))
|
||||
.or_else(|| firefox_default_path())
|
||||
.and_then(|x| x.canonicalize().ok())
|
||||
}
|
||||
|
||||
fn version(&mut self) -> Result<Option<String>, mozversion::Error> {
|
||||
if let Some(ref binary) = self.chosen_binary {
|
||||
if let Some(value) = self.version_cache.get(binary) {
|
||||
return Ok(Some((*value).clone()))
|
||||
}
|
||||
let rv = try!(firefox_version(&*binary))
|
||||
.version_string;
|
||||
if let Some(ref version) = rv {
|
||||
self.version_cache.insert(binary.clone(), version.clone());
|
||||
}
|
||||
Ok(rv)
|
||||
}
|
||||
else {
|
||||
//TODO: try launching the binary here to figure out the version
|
||||
Ok(None)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: put this in webdriver-rust
|
||||
fn convert_version_error(err: mozversion::Error) -> WebDriverError {
|
||||
WebDriverError::new(
|
||||
ErrorStatus::SessionNotCreated,
|
||||
err.description().to_string())
|
||||
}
|
||||
|
||||
impl <'a> BrowserCapabilities for FirefoxCapabilities<'a> {
|
||||
fn init(&mut self, capabilities: &BTreeMap<String, Json>) {
|
||||
self.set_binary(capabilities);
|
||||
}
|
||||
|
||||
fn browser_name(&mut self, _: &BTreeMap<String, Json>) -> WebDriverResult<Option<String>> {
|
||||
Ok(Some("firefox".into()))
|
||||
}
|
||||
|
||||
fn browser_version(&mut self, _: &BTreeMap<String, Json>) -> WebDriverResult<Option<String>> {
|
||||
self.version()
|
||||
.or_else(|x| Err(convert_version_error(x)))
|
||||
}
|
||||
|
||||
fn platform_name(&mut self, _: &BTreeMap<String, Json>) -> WebDriverResult<Option<String>> {
|
||||
Ok(if cfg!(target_os="windows") {
|
||||
Some("windows".into())
|
||||
} else if cfg!(target_os="macos") {
|
||||
Some("mac".into())
|
||||
} else if cfg!(target_os="linux") {
|
||||
Some("linux".into())
|
||||
} else {
|
||||
None
|
||||
})
|
||||
}
|
||||
|
||||
fn accept_insecure_certs(&mut self, _: &BTreeMap<String, Json>) -> WebDriverResult<bool> {
|
||||
let version_str = try!(self.version()
|
||||
.or_else(|x| Err(convert_version_error(x))));
|
||||
if let Some(x) = version_str {
|
||||
Ok(try!(Version::from_str(&*x)
|
||||
.or_else(|x| Err(convert_version_error(x)))).major > 52)
|
||||
} else {
|
||||
Ok(false)
|
||||
}
|
||||
}
|
||||
|
||||
fn compare_browser_version(&mut self, version: &str, comparison: &str) -> WebDriverResult<bool> {
|
||||
try!(Version::from_str(version)
|
||||
.or_else(|x| Err(convert_version_error(x))))
|
||||
.matches(comparison)
|
||||
.or_else(|x| Err(convert_version_error(x)))
|
||||
}
|
||||
|
||||
fn accept_proxy(&mut self, _: &BTreeMap<String, Json>, _: &BTreeMap<String, Json>) -> WebDriverResult<bool> {
|
||||
Ok(true)
|
||||
}
|
||||
|
||||
fn validate_custom(&self, name: &str, value: &Json) -> WebDriverResult<()> {
|
||||
if !name.starts_with("moz:") {
|
||||
return Ok(())
|
||||
}
|
||||
match name {
|
||||
"moz:firefoxOptions" => {
|
||||
let data = try_opt!(value.as_object(),
|
||||
ErrorStatus::InvalidArgument,
|
||||
"moz:firefoxOptions is not an object");
|
||||
for (key, value) in data.iter() {
|
||||
match &**key {
|
||||
"binary" => {
|
||||
if !value.is_string() {
|
||||
return Err(WebDriverError::new(
|
||||
ErrorStatus::InvalidArgument,
|
||||
"binary path is not a string"));
|
||||
}
|
||||
},
|
||||
"args" => {
|
||||
if !try_opt!(value.as_array(),
|
||||
ErrorStatus::InvalidArgument,
|
||||
"args is not an array")
|
||||
.iter()
|
||||
.all(|value| value.is_string()) {
|
||||
return Err(WebDriverError::new(
|
||||
ErrorStatus::InvalidArgument,
|
||||
"args entry is not a string"));
|
||||
}
|
||||
},
|
||||
"profile" => {
|
||||
if !value.is_string() {
|
||||
return Err(WebDriverError::new(
|
||||
ErrorStatus::InvalidArgument,
|
||||
"profile is not a string"));
|
||||
}
|
||||
},
|
||||
"log" => {
|
||||
let log_data = try_opt!(value.as_object(),
|
||||
ErrorStatus::InvalidArgument,
|
||||
"log value is not an object");
|
||||
for (log_key, log_value) in log_data.iter() {
|
||||
match &**log_key {
|
||||
"level" => {
|
||||
let level = try_opt!(log_value.as_string(),
|
||||
ErrorStatus::InvalidArgument,
|
||||
"log level is not a string");
|
||||
if LogLevel::from_str(level).is_err() {
|
||||
return Err(WebDriverError::new(
|
||||
ErrorStatus::InvalidArgument,
|
||||
format!("{} is not a valid log level",
|
||||
level)))
|
||||
}
|
||||
}
|
||||
x => return Err(WebDriverError::new(
|
||||
ErrorStatus::InvalidArgument,
|
||||
format!("Invalid log field {}", x)))
|
||||
}
|
||||
}
|
||||
},
|
||||
"prefs" => {
|
||||
let prefs_data = try_opt!(value.as_object(),
|
||||
ErrorStatus::InvalidArgument,
|
||||
"prefs value is not an object");
|
||||
if !prefs_data.values()
|
||||
.all(|x| x.is_string() || x.is_i64() || x.is_boolean()) {
|
||||
return Err(WebDriverError::new(
|
||||
ErrorStatus::InvalidArgument,
|
||||
"Preference values not all string or integer or boolean"));
|
||||
}
|
||||
}
|
||||
x => return Err(WebDriverError::new(
|
||||
ErrorStatus::InvalidArgument,
|
||||
format!("Invalid moz:firefoxOptions field {}", x)))
|
||||
}
|
||||
}
|
||||
}
|
||||
_ => return Err(WebDriverError::new(ErrorStatus::InvalidArgument,
|
||||
format!("Unrecognised option {}", name)))
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn accept_custom(&mut self, _: &str, _: &Json, _: &BTreeMap<String, Json>) -> WebDriverResult<bool> {
|
||||
Ok(true)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct FirefoxOptions {
|
||||
|
@ -27,41 +216,31 @@ pub struct FirefoxOptions {
|
|||
}
|
||||
|
||||
impl FirefoxOptions {
|
||||
pub fn from_capabilities(capabilities: &mut NewSessionParameters) -> WebDriverResult<FirefoxOptions> {
|
||||
if let Some(options) = capabilities.consume("moz:firefoxOptions") {
|
||||
pub fn new() -> FirefoxOptions {
|
||||
Default::default()
|
||||
}
|
||||
|
||||
pub fn from_capabilities(binary_path: Option<PathBuf>,
|
||||
capabilities: &mut BTreeMap<String, Json>)
|
||||
-> WebDriverResult<FirefoxOptions> {
|
||||
|
||||
let mut rv = FirefoxOptions::new();
|
||||
|
||||
rv.binary = binary_path;
|
||||
|
||||
if let Some(options) = capabilities.remove("moz:firefoxOptions") {
|
||||
let firefox_options = try!(options
|
||||
.as_object()
|
||||
.ok_or(WebDriverError::new(
|
||||
ErrorStatus::InvalidArgument,
|
||||
"'moz:firefoxOptions' capability was not an object")));
|
||||
let binary = try!(FirefoxOptions::load_binary(&firefox_options));
|
||||
let profile = try!(FirefoxOptions::load_profile(&firefox_options));
|
||||
let args = try!(FirefoxOptions::load_args(&firefox_options));
|
||||
let log = try!(FirefoxOptions::load_log(&firefox_options));
|
||||
let prefs = try!(FirefoxOptions::load_prefs(&firefox_options));
|
||||
"'moz:firefoxOptions' capability is not an object")));
|
||||
|
||||
Ok(FirefoxOptions {
|
||||
binary: binary,
|
||||
profile: profile,
|
||||
args: args,
|
||||
log: log,
|
||||
prefs: prefs,
|
||||
})
|
||||
} else {
|
||||
Ok(Default::default())
|
||||
}
|
||||
}
|
||||
|
||||
fn load_binary(options: &BTreeMap<String, Json>) -> WebDriverResult<Option<PathBuf>> {
|
||||
if let Some(path) = options.get("binary") {
|
||||
Ok(Some(PathBuf::from(try!(path
|
||||
.as_string()
|
||||
.ok_or(WebDriverError::new(
|
||||
ErrorStatus::InvalidArgument,
|
||||
"'binary' capability was not a string"))))))
|
||||
} else {
|
||||
Ok(None)
|
||||
rv.profile = try!(FirefoxOptions::load_profile(&firefox_options));
|
||||
rv.args = try!(FirefoxOptions::load_args(&firefox_options));
|
||||
rv.log = try!(FirefoxOptions::load_log(&firefox_options));
|
||||
rv.prefs = try!(FirefoxOptions::load_prefs(&firefox_options));
|
||||
}
|
||||
Ok(rv)
|
||||
}
|
||||
|
||||
fn load_profile(options: &BTreeMap<String, Json>) -> WebDriverResult<Option<Profile>> {
|
||||
|
@ -70,7 +249,7 @@ impl FirefoxOptions {
|
|||
.as_string()
|
||||
.ok_or(
|
||||
WebDriverError::new(ErrorStatus::UnknownError,
|
||||
"Profile was not a string")));
|
||||
"Profile is not a string")));
|
||||
let profile_zip = &*try!(profile_base64.from_base64());
|
||||
|
||||
// Create an emtpy profile directory
|
||||
|
|
|
@ -6,6 +6,7 @@ extern crate lazy_static;
|
|||
extern crate hyper;
|
||||
extern crate mozprofile;
|
||||
extern crate mozrunner;
|
||||
extern crate mozversion;
|
||||
extern crate regex;
|
||||
extern crate rustc_serialize;
|
||||
#[macro_use]
|
||||
|
|
|
@ -4,7 +4,6 @@ use logging::LogLevel;
|
|||
use mozprofile::preferences::Pref;
|
||||
use mozprofile::profile::Profile;
|
||||
use mozrunner::runner::{Runner, FirefoxRunner};
|
||||
use mozrunner::runner::platform::firefox_default_path;
|
||||
use regex::Captures;
|
||||
use rustc_serialize::json;
|
||||
use rustc_serialize::json::{Json, ToJson};
|
||||
|
@ -19,6 +18,7 @@ use std::net::{TcpListener, TcpStream};
|
|||
use std::sync::Mutex;
|
||||
use std::thread::sleep;
|
||||
use std::time::Duration;
|
||||
use webdriver::capabilities::CapabilitiesMatching;
|
||||
use webdriver::command::{WebDriverCommand, WebDriverMessage, Parameters,
|
||||
WebDriverExtensionCommand};
|
||||
use webdriver::command::WebDriverCommand::{
|
||||
|
@ -49,7 +49,7 @@ use webdriver::error::{ErrorStatus, WebDriverError, WebDriverResult};
|
|||
use webdriver::server::{WebDriverHandler, Session};
|
||||
use webdriver::httpapi::{WebDriverExtensionRoute};
|
||||
|
||||
use capabilities::FirefoxOptions;
|
||||
use capabilities::{FirefoxCapabilities, FirefoxOptions};
|
||||
use prefs;
|
||||
|
||||
const DEFAULT_HOST: &'static str = "localhost";
|
||||
|
@ -268,9 +268,23 @@ impl MarionetteHandler {
|
|||
}
|
||||
}
|
||||
|
||||
fn create_connection(&mut self, session_id: &Option<String>,
|
||||
capabilities: &mut NewSessionParameters) -> WebDriverResult<()> {
|
||||
let options = try!(FirefoxOptions::from_capabilities(capabilities));
|
||||
fn create_connection(&mut self,
|
||||
session_id: &Option<String>,
|
||||
new_session_parameters: &NewSessionParameters)
|
||||
-> WebDriverResult<BTreeMap<String, Json>> {
|
||||
let (options, capabilities) = {
|
||||
let mut fx_capabilities = FirefoxCapabilities::new(self.settings.binary.as_ref());
|
||||
let mut capabilities = try!(
|
||||
try!(new_session_parameters
|
||||
.match_browser(&mut fx_capabilities))
|
||||
.ok_or(WebDriverError::new(
|
||||
ErrorStatus::SessionNotCreated,
|
||||
"Unable to find a matching set of capabilities")));
|
||||
|
||||
let options = try!(FirefoxOptions::from_capabilities(fx_capabilities.chosen_binary,
|
||||
&mut capabilities));
|
||||
(options, capabilities)
|
||||
};
|
||||
|
||||
self.current_log_level = options.log.level.clone().or(self.settings.log_level.clone());
|
||||
logging::init(&self.current_log_level);
|
||||
|
@ -284,11 +298,11 @@ impl MarionetteHandler {
|
|||
try!(connection.connect());
|
||||
self.connection = Mutex::new(Some(connection));
|
||||
|
||||
Ok(())
|
||||
Ok(capabilities)
|
||||
}
|
||||
|
||||
fn start_browser(&mut self, port: u16, mut options: FirefoxOptions) -> WebDriverResult<()> {
|
||||
let binary = try!(self.binary_path(&mut options)
|
||||
let binary = try!(options.binary
|
||||
.ok_or(WebDriverError::new(ErrorStatus::SessionNotCreated,
|
||||
"Expected browser binary location, but unable to find \
|
||||
binary in default location, no \
|
||||
|
@ -322,12 +336,6 @@ impl MarionetteHandler {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn binary_path(&self, options: &mut FirefoxOptions) -> Option<PathBuf> {
|
||||
options.binary.take()
|
||||
.or_else(|| self.settings.binary.as_ref().map(|x| x.clone()))
|
||||
.or_else(|| firefox_default_path())
|
||||
}
|
||||
|
||||
pub fn set_prefs(&self, port: u16, profile: &mut Profile, custom_profile: bool,
|
||||
extra_prefs: Vec<(String, Pref)>)
|
||||
-> WebDriverResult<()> {
|
||||
|
@ -354,9 +362,11 @@ impl MarionetteHandler {
|
|||
}
|
||||
|
||||
impl WebDriverHandler<GeckoExtensionRoute> for MarionetteHandler {
|
||||
fn handle_command(&mut self, _: &Option<Session>, mut msg: WebDriverMessage<GeckoExtensionRoute>) -> WebDriverResult<WebDriverResponse> {
|
||||
fn handle_command(&mut self, _: &Option<Session>,
|
||||
msg: WebDriverMessage<GeckoExtensionRoute>) -> WebDriverResult<WebDriverResponse> {
|
||||
let mut resolved_capabilities = None;
|
||||
{
|
||||
let mut new_capabilities = None;
|
||||
let mut capabilities_options = None;
|
||||
// First handle the status message which doesn't actually require a marionette
|
||||
// connection or message
|
||||
if msg.command == Status {
|
||||
|
@ -375,8 +385,8 @@ impl WebDriverHandler<GeckoExtensionRoute> for MarionetteHandler {
|
|||
Ok(ref connection) => {
|
||||
if connection.is_none() {
|
||||
match msg.command {
|
||||
NewSession(ref mut capabilities) => {
|
||||
new_capabilities = Some(capabilities);
|
||||
NewSession(ref capabilities) => {
|
||||
capabilities_options = Some(capabilities);
|
||||
},
|
||||
_ => {
|
||||
return Err(WebDriverError::new(
|
||||
|
@ -392,15 +402,16 @@ impl WebDriverHandler<GeckoExtensionRoute> for MarionetteHandler {
|
|||
"Failed to aquire Marionette connection"))
|
||||
}
|
||||
}
|
||||
if let Some(capabilities) = new_capabilities {
|
||||
try!(self.create_connection(&msg.session_id, capabilities));
|
||||
if let Some(capabilities) = capabilities_options {
|
||||
resolved_capabilities = Some(try!(
|
||||
self.create_connection(&msg.session_id, &capabilities)));
|
||||
}
|
||||
}
|
||||
|
||||
match self.connection.lock() {
|
||||
Ok(ref mut connection) => {
|
||||
match connection.as_mut() {
|
||||
Some(conn) => conn.send_command(&msg),
|
||||
Some(conn) => conn.send_command(resolved_capabilities, &msg),
|
||||
None => panic!("Connection missing")
|
||||
}
|
||||
},
|
||||
|
@ -811,12 +822,24 @@ impl MarionetteCommand {
|
|||
}
|
||||
}
|
||||
|
||||
fn from_webdriver_message(id: u64, msg: &WebDriverMessage<GeckoExtensionRoute>) -> WebDriverResult<MarionetteCommand> {
|
||||
fn from_webdriver_message(id: u64,
|
||||
capabilities: Option<BTreeMap<String, Json>>,
|
||||
msg: &WebDriverMessage<GeckoExtensionRoute>)
|
||||
-> WebDriverResult<MarionetteCommand> {
|
||||
let (opt_name, opt_parameters) = match msg.command {
|
||||
NewSession(ref x) => {
|
||||
NewSession(_) => {
|
||||
let caps = capabilities.expect("Tried to create new session without processing capabilities");
|
||||
let mut data = BTreeMap::new();
|
||||
data.insert("sessionId".to_string(), Json::Null);
|
||||
data.insert("capabilities".to_string(), x.to_json());
|
||||
let mut capabilites = BTreeMap::new();
|
||||
for (key, value) in caps.iter() {
|
||||
capabilites.insert(key.to_string(), value.to_json());
|
||||
}
|
||||
// Copy into a desiredCapabilities key for legacy compat.
|
||||
capabilites.insert("desiredCapabilities".to_string(),
|
||||
caps.to_json());
|
||||
data.insert("capabilities".to_string(),
|
||||
capabilites.to_json());
|
||||
(Some("newSession"), Some(Ok(data)))
|
||||
},
|
||||
DeleteSession => {
|
||||
|
@ -890,10 +913,7 @@ impl MarionetteCommand {
|
|||
ElementSendKeys(ref e, ref x) => {
|
||||
let mut data = BTreeMap::new();
|
||||
data.insert("id".to_string(), e.id.to_json());
|
||||
let json_value: Vec<String> = x.value.iter().map(|x| {
|
||||
x.to_string()
|
||||
}).collect();
|
||||
data.insert("value".to_string(), json_value.to_json());
|
||||
data.insert("value".to_string(), x.text.to_json());
|
||||
(Some("sendKeysToElement"), Some(Ok(data)))
|
||||
},
|
||||
ExecuteScript(ref x) => (Some("executeScript"), Some(x.to_marionette())),
|
||||
|
@ -911,10 +931,8 @@ impl MarionetteCommand {
|
|||
GetAlertText => (Some("getTextFromDialog"), None),
|
||||
SendAlertText(ref x) => {
|
||||
let mut data = BTreeMap::new();
|
||||
let json_value: Vec<String> = x.value.iter().map(|x| {
|
||||
x.to_string()
|
||||
}).collect();
|
||||
data.insert("value".to_string(), json_value.to_json());
|
||||
|
||||
data.insert("value".to_string(), x.text.to_json());
|
||||
(Some("sendKeysToDialog"), Some(Ok(data)))
|
||||
},
|
||||
TakeScreenshot => {
|
||||
|
@ -1166,10 +1184,11 @@ impl MarionetteConnection {
|
|||
}
|
||||
|
||||
pub fn send_command(&mut self,
|
||||
capabilities: Option<BTreeMap<String, Json>>,
|
||||
msg: &WebDriverMessage<GeckoExtensionRoute>)
|
||||
-> WebDriverResult<WebDriverResponse> {
|
||||
let id = self.session.next_command_id();
|
||||
let command = try!(MarionetteCommand::from_webdriver_message(id, msg));
|
||||
let command = try!(MarionetteCommand::from_webdriver_message(id, capabilities, msg));
|
||||
|
||||
let resp_data = try!(self.send(command.to_json()));
|
||||
let json_data: Json = try!(Json::from_str(&*resp_data));
|
||||
|
|
Загрузка…
Ссылка в новой задаче