Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mozilla/geckodriver.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Tolfsen <ato@sny.no>2017-07-11 15:26:18 +0300
committerAndreas Tolfsen <ato@sny.no>2017-07-11 15:26:41 +0300
commitb84315a7d5a2061d3f4b67ab3bd9b4149782588f (patch)
tree9b41d8168b148518b91beb322a6c0fe1c4dbdc5c
parenta1ff303e87ef6f7ba688b28014af8aaffff062ed (diff)
import from 27bdd6fd88c699807f5d3dec1df3f992e0921350v0.18.0
-rw-r--r--.gitignore1
-rw-r--r--.hgignore1
-rw-r--r--.travis.yml4
-rw-r--r--CHANGES.md16
-rw-r--r--Cargo.lock50
-rw-r--r--Cargo.toml12
-rw-r--r--README.md129
-rw-r--r--build.rs73
-rw-r--r--mach_commands.py86
-rw-r--r--src/main.rs90
-rw-r--r--src/marionette.rs135
11 files changed, 392 insertions, 205 deletions
diff --git a/.gitignore b/.gitignore
index ddfca73..ea8c4bf 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1 @@
/target
-.version
diff --git a/.hgignore b/.hgignore
new file mode 100644
index 0000000..2f7896d
--- /dev/null
+++ b/.hgignore
@@ -0,0 +1 @@
+target/
diff --git a/.travis.yml b/.travis.yml
index ac9c84f..24b43c3 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -4,13 +4,13 @@ cache:
- $HOME/.cargo
- $TRAVIS_BUILD_DIR/target
- $HOME/docker/
-
+
before_install:
- if [[ "$NAME" == "linux32" ]]; then
sudo dpkg --purge build-essential libtool;
sudo apt-get -qq update;
sudo apt-get -yq --force-yes install libstdc++6:i386 libbz2-dev:i386 gcc-4.8:i386 gcc-4.8-multilib:i386 musl-tools:i386 binutils:i386; fi
-
+
matrix:
include:
- os: linux
diff --git a/CHANGES.md b/CHANGES.md
index 9e5654b..e9a4a4a 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -2,6 +2,22 @@
All notable changes to this program is documented in this file.
+## 0.18.0 (2017-07-10)
+
+### Changed
+- [`RectResponse`](https://docs.rs/webdriver/0.27.0/webdriver/response/struct.RectResponse.html) permits returning floats for `width` and `height` fields
+- New type [`CookieResponse`](https://docs.rs/webdriver/0.27.0/webdriver/response/struct.CookieResponse.html) for the [`GetNamedCookie` command](https://docs.rs/webdriver/0.27.0/webdriver/command/enum.WebDriverCommand.html#variant.GetNamedCookie) returns a single cookie, as opposed to an array of a single cookie
+- To pick up a prepared profile from the filesystem, it is now possible to pass `["-profile", "/path/to/profile"]` in the `args` array on `moz:firefoxOptions`
+- geckodriver now recommends Firefox 53 and greater
+- Version information (`--version`) contains the hash from from the commit used to build geckodriver
+- geckodriver version logged on startup
+- [webdriver crate](https://crates.io/crates/webdriver) upgraded to version 0.27.0
+- [mozrunner crate](https://crates.io/crates/mozrunner) upgraded to version 0.4.1
+
+### Fixed
+- The [`SetTimeouts`](https://docs.rs/webdriver/0.27.0/webdriver/command/enum.WebDriverCommand.html#variant.SetTimeouts) command maps to the Marionette `setTimeouts` command, which makes geckodriver compatible with Firefox 56 and greater
+- Linux x86 (i686-unknown-linux-musl) builds are fixed
+
## 0.17.0 (2017-06-09)
### Added
diff --git a/Cargo.lock b/Cargo.lock
index 1fb7f41..19cd5da 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1,6 +1,6 @@
[root]
name = "geckodriver"
-version = "0.17.0"
+version = "0.18.0"
dependencies = [
"chrono 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)",
"clap 2.24.2 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -8,7 +8,7 @@ dependencies = [
"lazy_static 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"mozprofile 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "mozrunner 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "mozrunner 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"mozversion 0.1.2 (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)",
@@ -17,7 +17,7 @@ dependencies = [
"slog-stdlog 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"slog-stream 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"uuid 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
- "webdriver 0.26.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "webdriver 0.27.0 (registry+https://github.com/rust-lang/crates.io-index)",
"zip 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -47,7 +47,7 @@ dependencies = [
"cfg-if 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"dbghelp-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-demangle 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -58,7 +58,7 @@ version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"gcc 0.3.42 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -85,7 +85,7 @@ version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bzip2-sys 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -94,7 +94,7 @@ version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"gcc 0.3.42 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -126,7 +126,7 @@ dependencies = [
[[package]]
name = "cookie"
-version = "0.6.2"
+version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"time 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -151,7 +151,7 @@ name = "flate2"
version = "0.2.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
"miniz-sys 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -200,7 +200,7 @@ version = "0.1.3"
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.20 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -248,7 +248,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "libc"
-version = "0.2.20"
+version = "0.2.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
@@ -266,7 +266,7 @@ name = "memchr"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -283,7 +283,7 @@ version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"gcc 0.3.42 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -296,7 +296,7 @@ dependencies = [
[[package]]
name = "mozrunner"
-version = "0.4.0"
+version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -361,7 +361,7 @@ name = "num_cpus"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -374,7 +374,7 @@ name = "rand"
version = "0.3.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -519,7 +519,7 @@ version = "0.3.0"
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.20 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -529,7 +529,7 @@ version = "3.0.0"
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.20 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -547,7 +547,7 @@ version = "0.1.36"
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.20 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
"redox_syscall 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -636,11 +636,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "webdriver"
-version = "0.26.0"
+version = "0.27.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"backtrace 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "cookie 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "cookie 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.10.10 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -696,7 +696,7 @@ dependencies = [
"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.24.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6b8f69e518f967224e628896b54e41ff6acfb4dcfefc5076325c36525dac900f"
-"checksum cookie 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "30b3493e12a550c2f96be785088d1da8d93189e7237c8a8d0d871bc9070334c3"
+"checksum cookie 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a54aa6d675d62b2f95b56b331b5222a520149a54f23a2d21974dfcc69caf0a9d"
"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.19 (registry+https://github.com/rust-lang/crates.io-index)" = "36df0166e856739905cd3d7e0b210fe818592211a008862599845e012d8d304c"
@@ -711,14 +711,14 @@ dependencies = [
"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.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6abe0ee2e758cd6bc8a2cd56726359007748fbf4128da998b65d0b70f881e19b"
-"checksum libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)" = "684f330624d8c3784fb9558ca46c4ce488073a8d22450415c5eb4f4cfb0d11b5"
+"checksum libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)" = "38f5c2b18a287cf78b4097db62e20f43cace381dc76ae5c0a3073067f78b7ddc"
"checksum log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ab83497bf8bf4ed2a74259c1c802351fcd67a65baa86394b6ba73c36f4838054"
"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.4 (registry+https://github.com/rust-lang/crates.io-index)" = "9d69889cdc6336ed56b174514ce876c4c3dc564cc23dd872e7bca589bb2a36c8"
"checksum miniz-sys 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "28eaee17666671fa872e567547e8428e83308ebe5808cdf6a0e28397dbe2c726"
"checksum mozprofile 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1a17b8bbde1dc0fbf1c8b073192d7c6f89baa932173ece7c1447de5e9cc7cd7e"
-"checksum mozrunner 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a568168329fc285ad6d04dfbe058ea20ff842f4301fe9205c6cbd4ed3be85378"
+"checksum mozrunner 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "68e6a21ef32a737399a34d9a89640b350d8b47ef03457225c0c223842cf2311f"
"checksum mozversion 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9fb3a40135553611560d3eb4a49479beaf0c91c5a93f723338c5b0edddf08f26"
"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"
@@ -763,7 +763,7 @@ dependencies = [
"checksum uuid 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "78c590b5bd79ed10aad8fb75f078a59d8db445af6c743e55c4a53227fc01c13f"
"checksum vec_map 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "887b5b631c2ad01628bbbaa7dd4c869f80d3186688f8d0b6f58774fbe324988c"
"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
-"checksum webdriver 0.26.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3099729d884692d690796454e8529edf3f0ebd87c87840f9c809df8eabb175ed"
+"checksum webdriver 0.27.0 (registry+https://github.com/rust-lang/crates.io-index)" = "26cd8cf65699e3b8d1a21088ba2180cfe4f5d37a414c994976a34b289799e24d"
"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"
diff --git a/Cargo.toml b/Cargo.toml
index 6d06fe8..b20069f 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,13 +1,13 @@
[package]
name = "geckodriver"
-version = "0.17.0"
+version = "0.18.0"
authors = [
"James Graham <james@hoppipolla.co.uk>",
"Andreas Tolfsen <ato@mozilla.com>",
]
description = "Proxy for using WebDriver clients to interact with Gecko-based browsers."
keywords = ["webdriver", "w3c", "httpd", "mozilla", "firefox"]
-repository = "https://github.com/mozilla/geckodriver"
+repository = "https://hg.mozilla.org/mozilla-central/file/tip/testing/geckodriver"
readme = "README.md"
license = "MPL-2.0"
@@ -17,9 +17,9 @@ clap = {version = "^2.19", default-features = false, features = ["suggestions",
hyper = "0.10"
lazy_static = "0.1"
log = "0.3"
-mozprofile = "0.3"
-mozrunner = "0.4"
-mozversion = "0.1"
+mozprofile = "0.3.0"
+mozrunner = "0.4.1"
+mozversion = "0.1.2"
regex = "0.2"
rustc-serialize = "0.3"
slog = "1"
@@ -27,7 +27,7 @@ slog-atomic = "0.4"
slog-stdlog = "1"
slog-stream = "1"
uuid = "0.1.18"
-webdriver = "0.26.0"
+webdriver = "0.27.0"
zip = "0.1"
[[bin]]
diff --git a/README.md b/README.md
index 87d235c..4c99dd5 100644
--- a/README.md
+++ b/README.md
@@ -3,18 +3,30 @@
Proxy for using W3C WebDriver-compatible clients
to interact with Gecko-based browsers.
-This program provides the HTTP API described by
-the [WebDriver protocol](http://w3c.github.io/webdriver/webdriver-spec.html#protocol)
+This program provides the HTTP API described by the [WebDriver protocol]
to communicate with Gecko browsers, such as Firefox.
-It translates calls into
-the [Marionette automation protocol](https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette)
+It translates calls into the [Firefox remote protocol]
by acting as a proxy between the local- and remote ends.
-You can consult the [change log](https://github.com/mozilla/geckodriver/blob/master/CHANGES.md)
-for a record of all notable changes to the program.
-[Releases](https://github.com/mozilla/geckodriver/releases)
-are made available on GitHub
-on [supported platforms](#supported-firefoxen).
+You can consult the [change log] for a record of all notable changes to the program.
+[Releases] are made available on GitHub on [supported platforms].
+
+The canonical source code repository for geckodriver
+now lives in [mozilla-central] under [testing/geckodriver].
+You can read more about [working with Mozilla source code] on MDN.
+This means we do no longer accept pull requests on GitHub.
+Patches should be uploaded to a bug
+in the [Testing :: GeckoDriver] component.
+
+[WebDriver protocol]: http://w3c.github.io/webdriver/webdriver-spec.html#protocol
+[Firefox remote protocol]: https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette
+[change log]: https://github.com/mozilla/geckodriver/blob/master/CHANGES.md
+[Releases]: https://github.com/mozilla/geckodriver/releases
+[supported platforms]: #supported-firefoxen
+[mozilla-central]: https://hg.mozilla.org/mozilla-central/
+[testing/geckodriver]: https://hg.mozilla.org/mozilla-central/file/tip/testing/geckodriver
+[working with Mozilla source code]: https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Source_Code
+[Testing :: geckodriver]: https://bugzilla.mozilla.org/buglist.cgi?product=Testing&component=geckodriver&resolution=---&list_id=13613952
## Supported clients
@@ -25,26 +37,26 @@ Other clients that follow the [W3C WebDriver specification](https://w3c.github.i
## Supported Firefoxen
-Marionette and geckodriver are not yet feature complete.
-This means that they do not yet offer full conformance
+geckodriver is not yet feature complete.
+This means that it does not yet offer full conformance
with the [WebDriver standard](https://w3c.github.io/webdriver/webdriver-spec.html)
or complete compatibility with [Selenium](http://www.seleniumhq.org/).
You can track the [implementation status](https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/WebDriver/status)
of the latest [Firefox Nightly](http://whattrainisitnow.com/) on
[MDN](https://developer.mozilla.org/).
We also keep track of known
-[Marionette](https://github.com/mozilla/geckodriver/issues?q=is%3Aissue+is%3Aopen+label%3Amarionette),
[Selenium](https://github.com/mozilla/geckodriver/issues?q=is%3Aissue+is%3Aopen+label%3Aselenium),
+[remote protocol](https://github.com/mozilla/geckodriver/issues?q=is%3Aissue+is%3Aopen+label%3Amarionette),
and [specification](https://github.com/mozilla/geckodriver/issues?q=is%3Aissue+is%3Aopen+label%3Aspec)
problems in our
[issue tracker](https://github.com/mozilla/geckodriver/issues).
-Support is best in Firefox 52.0.3 and onwards,
+Support is best in Firefox 53 and greater,
although generally the more recent the Firefox version,
the better the experience as they have more bug fixes and features.
Some features will only be available in the most recent Firefox versions,
and we strongly advise using the [latest Firefox Nightly](https://nightly.mozilla.org/) with geckodriver.
-Since Windows XP support in Firefox will be dropped with Firefox 53,
+Since Windows XP support in Firefox was dropped with Firefox 53,
we do not support this platform.
## WebDriver capabilities
@@ -63,7 +75,7 @@ geckodriver supports a number of
<tr>
<td><code>proxy</code>
- <td><a href=#proxy-object><code>proxy</code></a> object
+ <td><a href=#proxy-object><code>proxy</code></a>&nbsp;object
<td>Sets browser proxy settings.
</tr>
@@ -215,7 +227,7 @@ and may contain any of the following fields:
</tr>
</thead>
- <tr>
+ <tr id=capability-binary>
<td><code>binary</code>
<td>string
<td>Absolute path of the Firefox binary,
@@ -227,33 +239,50 @@ and may contain any of the following fields:
on the current system.
</tr>
- <tr>
+ <tr id=capability-args>
<td><code>args</code>
<td>array&nbsp;of&nbsp;strings
- <td>Command line arguments to pass to the Firefox binary.
- These must include the leading <code>--</code> where required
- e.g. <code>["--devtools"]</code>.
+ <td><p>Command line arguments to pass to the Firefox binary.
+ These must include the leading dash (<code>-</code>) where required,
+ e.g. <code>["-devtools"]</code>.
+
+ <p>To have geckodriver pick up an existing profile on the filesystem,
+ you may pass <code>["-profile", "/path/to/profile"]</code>.
</tr>
- <tr>
+ <tr id=capability-profile>
<td><code>profile</code>
<td>string
- <td>Base64-encoded zip of a profile directory
- to use as the profile for the Firefox instance.
- This may be used to e.g. install extensions
- or custom certificates.
- By default, a new profile will be created in the system’s temporary folder.
- The effective profile in use by the WebDriver session
- is returned to the user in the `moz:profile` capability.
+ <td><p>Base64-encoded ZIP of a profile directory to use for the Firefox instance.
+ This may be used to e.g. install extensions or custom certificates,
+ but for setting custom preferences
+ we recommend using the <a href=#capability-prefs><code>prefs</code></a> entry
+ instead of passing a profile.
+
+ <p>Profiles are created in the system’s temporary folder.
+ This is also where the encoded profile is extracted
+ when <code>profile</code> is provided.
+ By default, geckodriver will create a new profile in this location.
+
+ <p>The effective profile in use by the WebDriver session
+ is returned to the user in the <code>moz:profile</code> capability
+ in the new session response.
+
+ <p>To have geckodriver pick up an <em>existing profile</em> on the filesystem,
+ please set the <a href=#capability-args><code>args</code></a> field
+ to <code>{"args": ["-profile", "/path/to/your/profile"]}</code>.
</tr>
- <tr>
+ <tr id=capability-log>
<td><code>log</code>
<td><a href=#log-object><code>log</code></a>&nbsp;object
- <td>Logging options for Gecko.
+ <td>To increase the logging verbosity of geckodriver and Firefox,
+ you may pass a <a href=#log-object><code>log</code> object</a>
+ that may look like <code>{"log": {"level": "trace"}}</code>
+ to include all trace-level logs and above.
</tr>
- <tr>
+ <tr id=capability-prefs>
<td><code>prefs</code>
<td><a href=#prefs-object><code>prefs</code></a>&nbsp;object
<td>Map of preference name to preference value, which can be a
@@ -275,7 +304,7 @@ and may contain any of the following fields:
<tr>
<td><code>level</code>
<td>string
- <td>Set the level of verbosity in Gecko.
+ <td>Set the level of verbosity of geckodriver and Firefox.
Available levels are <code>trace</code>,
<code>debug</code>, <code>config</code>,
<code>info</code>, <code>warn</code>,
@@ -302,12 +331,13 @@ and may contain any of the following fields:
</tr>
</table>
-## Capabilities examples
+## Capabilities example
-To select a specific Firefox binary
-and run it with a specific command-line flag,
-set a preference,
-and enable verbose logging:
+The following example selects a specific Firefox binary
+to run with a prepared profile from the filesystem
+in headless mode (available on certain systems and recent Firefoxen).
+It also increases the number of IPC processes through a preference
+and enables more verbose logging.
```js
{
@@ -315,7 +345,7 @@ and enable verbose logging:
"alwaysMatch": {
"moz:firefoxOptions": {
"binary": "/usr/local/firefox/bin/firefox",
- "args": ["--no-remote"],
+ "args": ["-headless", "-profile", "/path/to/my/profile"],
"prefs": {
"dom.ipc.processCount": 8
},
@@ -336,7 +366,7 @@ but how you invoke geckodriver largely depends on your use case.
### Selenium
If you are using geckodriver through [Selenium](http://seleniumhq.org/),
-you must ensure that you have version 3.3.1 or greater.
+you must ensure that you have version 3.4 and greater.
Because geckodriver implements the [W3C WebDriver standard](https://w3c.github.io/webdriver/webdriver-spec.html)
and not the same Selenium wire protocol older drivers are using,
you may experience incompatibilities and migration problems
@@ -494,7 +524,7 @@ Port to use for the WebDriver server.
Defaults to 4444.
A helpful trick is that it is possible to bind to 0
-to get the system to assign a free port.
+to get the system to atomically assign a free port.
#### <code>-v<var>[v]</var></code>
@@ -511,17 +541,15 @@ geckodriver translates WebDriver [commands], [responses], and [errors]
to the [Marionette protocol],
and acts as a proxy between [WebDriver] and [Marionette].
-In order to build this program, you will need the [Rust compiler toolchain].
-
-To build the project for release,
-ensure you compile with optimisations
-to get the best performance:
-
- % cargo build --release
+geckodriver is built in the [Firefox CI] by default
+but _not_ if you build Firefox locally.
+To enable building of geckodriver locally,
+ensure you put this in your [mozconfig]:
-Or if you want a non-optimised binary for debugging:
+ ac_add_options --enable-geckodriver
- % cargo build
+The _geckodriver_ binary will appear in `${objdir}/dist/bin/geckodriver`
+alongside _firefox-bin_.
[Rust]: https://www.rust-lang.org/
[Mozilla]: https://www.mozilla.org/en-US/
@@ -532,4 +560,5 @@ Or if you want a non-optimised binary for debugging:
[Marionette protocol]: https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/Protocol
[WebDriver]: https://w3c.github.io/webdriver/webdriver-spec.html
[Marionette]: http://searchfox.org/mozilla-central/source/testing/marionette/README
-[Rust compiler toolchain]: https://rustup.rs/
+[Firefox CI]: https://treeherder.mozilla.org/
+[mozconfig]: https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Build_Instructions/Configuring_Build_Options
diff --git a/build.rs b/build.rs
new file mode 100644
index 0000000..a65d19d
--- /dev/null
+++ b/build.rs
@@ -0,0 +1,73 @@
+/// Writes build information to ${OUT_DIR}/build-info.rs which is included in
+/// the program during compilation:
+///
+/// ```no_run
+/// const COMMIT_HASH: Option<&'static str> = Some("c31a366");
+/// const COMMIT_DATE: Option<&'static str> = Some("1988-05-10");
+/// ```
+///
+/// The values are `None` if running hg failed, e.g. if it is not installed or
+/// if we are not in an hg repo.
+
+use std::env;
+use std::ffi::OsStr;
+use std::fs::File;
+use std::io::Write;
+use std::path::PathBuf;
+use std::process::Command;
+
+fn main() {
+ let out_dir = PathBuf::from(env::var_os("OUT_DIR").unwrap());
+ let mut fh = File::create(out_dir.join("build-info.rs")).unwrap();
+ writeln!(
+ fh,
+ "const COMMIT_HASH: Option<&'static str> = {:?};",
+ commit_hash()
+ ).unwrap();
+ writeln!(
+ fh,
+ "const COMMIT_DATE: Option<&'static str> = {:?};",
+ commit_date()
+ ).unwrap();
+}
+
+fn commit_hash() -> Option<String> {
+ exec(&"hg", &["log", "-r.", "-T '{node|short}'"]).or_else(
+ || {
+ exec(&"git", &["rev-parse", "HEAD"]).and_then(hg2git_sha)
+ },
+ )
+}
+
+fn commit_date() -> Option<String> {
+ exec(&"hg", &["log", "-r.", "-T '{date|isodate}'"]).or_else(|| {
+ exec(
+ &"git",
+ &["log", "-1", "--date=short", "--pretty=format:%cd"],
+ )
+ })
+}
+
+fn exec<S, I>(program: S, args: I) -> Option<String>
+where
+ S: AsRef<OsStr>,
+ I: IntoIterator<Item = S>,
+{
+ let mut cmd = Command::new(program);
+ for arg in args {
+ cmd.arg(arg.as_ref());
+ }
+ cmd.output()
+ .ok()
+ .and_then(|r| if r.status.success() {
+ Some(r.stdout)
+ } else {
+ None
+ })
+ .and_then(|o| String::from_utf8(o).ok())
+ .map(|s| s.trim_right().into())
+}
+
+fn hg2git_sha(hg_sha: String) -> Option<String> {
+ exec(&"git", &["cinnabar", "git2hg", &hg_sha])
+}
diff --git a/mach_commands.py b/mach_commands.py
new file mode 100644
index 0000000..7867ae1
--- /dev/null
+++ b/mach_commands.py
@@ -0,0 +1,86 @@
+import argparse
+import os
+
+from mozbuild.base import (
+ MachCommandBase
+)
+
+from mach.decorators import (
+ CommandArgument,
+ CommandArgumentGroup,
+ CommandProvider,
+ Command,
+)
+
+
+@CommandProvider
+class RunGeckodriver(MachCommandBase):
+ """Run the compiled program."""
+
+ @Command('geckodriver', category='post-build',
+ description='Run the geckodriver WebDriver implementation')
+ @CommandArgument('--binary', type=str,
+ help='Firefox binary (defaults to the local build).')
+ @CommandArgument('params', nargs='...',
+ help='Command-line arguments to be passed through to the program.')
+
+ @CommandArgumentGroup('debugging')
+ @CommandArgument('--debug', action='store_true', group='debugging',
+ help='Enable the debugger. Not specifying a --debugger option will result in the default debugger being used.')
+ @CommandArgument('--debugger', default=None, type=str, group='debugging',
+ help='Name of debugger to use.')
+ @CommandArgument('--debugger-args', default=None, metavar='params', type=str,
+ group='debugging',
+ help='Command-line arguments to pass to the debugger itself; split as the Bourne shell would.')
+ def run(self, binary, params, debug, debugger, debugger_args):
+ try:
+ binpath = self.get_binary_path('geckodriver')
+ except Exception as e:
+ print("It looks like geckodriver isn't built. "
+ "Add ac_add_options --enable-geckodrver to your mozconfig ",
+ "and run |mach build| to build it.")
+ print(e)
+ return 1
+
+ args = [binpath]
+
+ if params:
+ args.extend(params)
+
+ if binary is None:
+ binary = self.get_binary_path('app')
+
+ args.extend(["--binary", binary])
+
+ if debug or debugger or debugger_args:
+ if 'INSIDE_EMACS' in os.environ:
+ self.log_manager.terminal_handler.setLevel(logging.WARNING)
+
+ import mozdebug
+ if not debugger:
+ # No debugger name was provided. Look for the default ones on
+ # current OS.
+ debugger = mozdebug.get_default_debugger_name(mozdebug.DebuggerSearch.KeepLooking)
+
+ if debugger:
+ self.debuggerInfo = mozdebug.get_debugger_info(debugger, debugger_args)
+ if not self.debuggerInfo:
+ print("Could not find a suitable debugger in your PATH.")
+ return 1
+
+ # Parameters come from the CLI. We need to convert them before
+ # their use.
+ if debugger_args:
+ from mozbuild import shellutil
+ try:
+ debugger_args = shellutil.split(debugger_args)
+ except shellutil.MetaCharacterException as e:
+ print("The --debugger-args you passed require a real shell to parse them.")
+ print("(We can't handle the %r character.)" % e.char)
+ return 1
+
+ # Prepend the debugger args.
+ args = [self.debuggerInfo.path] + self.debuggerInfo.args + args
+
+ return self.run_process(args=args, ensure_exit_code=False,
+ pass_thru=True)
diff --git a/src/main.rs b/src/main.rs
index 518b50e..6ecb9ad 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -20,9 +20,9 @@ extern crate webdriver;
#[macro_use]
extern crate log;
-use std::borrow::ToOwned;
+use std::fmt;
use std::io::Write;
-use std::net::{SocketAddr, IpAddr};
+use std::net::{IpAddr, SocketAddr};
use std::path::PathBuf;
use std::str::FromStr;
@@ -45,6 +45,8 @@ mod capabilities;
use logging::LogLevel;
use marionette::{MarionetteHandler, MarionetteSettings, extension_routes};
+include!(concat!(env!("OUT_DIR"), "/build-info.rs"));
+
type ProgramResult = std::result::Result<(), (ExitCode, String)>;
enum ExitCode {
@@ -53,6 +55,43 @@ enum ExitCode {
Unavailable = 69,
}
+struct BuildInfo;
+impl BuildInfo {
+ pub fn version() -> &'static str {
+ crate_version!()
+ }
+
+ pub fn hash() -> Option<&'static str> {
+ COMMIT_HASH
+ }
+
+ pub fn date() -> Option<&'static str> {
+ COMMIT_DATE
+ }
+}
+
+impl fmt::Display for BuildInfo {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ write!(f, "{}", BuildInfo::version())?;
+ match (BuildInfo::hash(), BuildInfo::date()) {
+ (Some(hash), Some(date)) => write!(f, " ({} {})", hash, date)?,
+ (Some(hash), None) => write!(f, " ({})", hash)?,
+ _ => {}
+ }
+ Ok(())
+ }
+}
+
+fn print_version() {
+ println!("geckodriver {}", BuildInfo);
+ println!("");
+ println!("The source code of this program is available from");
+ println!("testing/geckodriver in https://hg.mozilla.org/mozilla-central.");
+ println!("");
+ println!("This program is subject to the terms of the Mozilla Public License 2.0.");
+ println!("You can obtain a copy of the license at https://mozilla.org/MPL/2.0/.");
+}
+
fn app<'a, 'b>() -> App<'a, 'b> {
App::new(format!("geckodriver {}", crate_version!()))
.about("WebDriver implementation for Firefox.")
@@ -104,40 +143,37 @@ fn run() -> ProgramResult {
let matches = app().get_matches();
if matches.is_present("version") {
- println!("geckodriver {}\n\n{}", crate_version!(),
-"The source code of this program is available at
-https://github.com/mozilla/geckodriver.
-
-This program is subject to the terms of the Mozilla Public License 2.0.
-You can obtain a copy of the license at https://mozilla.org/MPL/2.0/.");
- return Ok(())
+ print_version();
+ return Ok(());
}
let host = matches.value_of("webdriver_host").unwrap_or("127.0.0.1");
- let port = match u16::from_str(matches.value_of("webdriver_port")
- .or(matches.value_of("webdriver_port_alias"))
- .unwrap_or("4444")) {
+ let port = match u16::from_str(
+ matches
+ .value_of("webdriver_port")
+ .or(matches.value_of("webdriver_port_alias"))
+ .unwrap_or("4444"),
+ ) {
Ok(x) => x,
- Err(_) => return Err((ExitCode::Usage, "invalid WebDriver port".to_owned())),
+ Err(_) => return Err((ExitCode::Usage, "invalid WebDriver port".into())),
};
let addr = match IpAddr::from_str(host) {
Ok(addr) => SocketAddr::new(addr, port),
- Err(_) => return Err((ExitCode::Usage, "invalid host address".to_owned())),
+ Err(_) => return Err((ExitCode::Usage, "invalid host address".into())),
};
let binary = matches.value_of("binary").map(|x| PathBuf::from(x));
let marionette_port = match matches.value_of("marionette_port") {
- Some(x) => match u16::from_str(x) {
- Ok(x) => Some(x),
- Err(_) => return Err((ExitCode::Usage, "invalid Marionette port".to_owned())),
- },
- None => None
+ Some(x) => {
+ match u16::from_str(x) {
+ Ok(x) => Some(x),
+ Err(_) => return Err((ExitCode::Usage, "invalid Marionette port".into())),
+ }
+ }
+ None => None,
};
- // overrides defaults in Gecko
- // which are info for optimised builds
- // and debug for debug builds
let log_level = if matches.is_present("log_level") {
LogLevel::from_str(matches.value_of("log_level").unwrap()).ok()
} else {
@@ -149,17 +185,19 @@ You can obtain a copy of the license at https://mozilla.org/MPL/2.0/.");
};
logging::init(&log_level);
+ info!("geckodriver {}", BuildInfo);
+
let settings = MarionetteSettings {
port: marionette_port,
binary: binary,
connect_existing: matches.is_present("connect_existing"),
log_level: log_level,
};
-
let handler = MarionetteHandler::new(settings);
- let listening = try!(webdriver::server::start(addr, handler, &extension_routes()[..])
- .map_err(|err| (ExitCode::Unavailable, err.to_string())));
+ let listening = webdriver::server::start(addr, handler, &extension_routes()[..])
+ .map_err(|err| (ExitCode::Unavailable, err.to_string()))?;
info!("Listening on {}", listening.socket);
+
Ok(())
}
@@ -169,7 +207,7 @@ fn main() {
Err((exit_code, reason)) => {
error!("{}", reason);
exit_code
- },
+ }
};
std::io::stdout().flush().unwrap();
diff --git a/src/marionette.rs b/src/marionette.rs
index b5ff181..270e0c0 100644
--- a/src/marionette.rs
+++ b/src/marionette.rs
@@ -40,11 +40,10 @@ use webdriver::command::{
SwitchToFrameParameters, LocatorParameters, JavascriptCommandParameters,
GetNamedCookieParameters, AddCookieParameters, TimeoutsParameters,
ActionsParameters, TakeScreenshotParameters};
-use webdriver::response::{CloseWindowResponse, Cookie, CookieResponse, ElementRectResponse,
- NewSessionResponse, TimeoutsResponse, ValueResponse, WebDriverResponse,
- WindowRectResponse};
-use webdriver::common::{
- Date, Nullable, WebElement, FrameId, ELEMENT_KEY};
+use webdriver::response::{CloseWindowResponse, Cookie, CookieResponse, CookiesResponse,
+ NewSessionResponse, RectResponse, TimeoutsResponse, ValueResponse,
+ WebDriverResponse};
+use webdriver::common::{Date, ELEMENT_KEY, FrameId, Nullable, WebElement};
use webdriver::error::{ErrorStatus, WebDriverError, WebDriverResult};
use webdriver::server::{WebDriverHandler, Session};
use webdriver::httpapi::{WebDriverExtensionRoute};
@@ -637,7 +636,7 @@ impl MarionetteSession {
Ok(match msg.command {
// Everything that doesn't have a response value
Get(_) | GoBack | GoForward | Refresh | SetTimeouts(_) |
- MaximizeWindow | SwitchToWindow(_) | SwitchToFrame(_) |
+ SwitchToWindow(_) | SwitchToFrame(_) |
SwitchToParentFrame | AddCookie(_) | DeleteCookies | DeleteCookie(_) |
DismissAlert | AcceptAlert | SendAlertText(_) | ElementClick(_) |
ElementTap(_) | ElementClear(_) | ElementSendKeys(_, _) |
@@ -704,40 +703,6 @@ impl MarionetteSession {
})
.collect());
WebDriverResponse::CloseWindow(CloseWindowResponse { window_handles: handles })
- }
- GetWindowRect => {
- let width = try_opt!(
- try_opt!(resp.result.find("width"),
- ErrorStatus::UnknownError,
- "Failed to find width field").as_u64(),
- ErrorStatus::UnknownError,
- "Failed to interpret width as integer");
-
- let height = try_opt!(
- try_opt!(resp.result.find("height"),
- ErrorStatus::UnknownError,
- "Failed to find height field").as_u64(),
- ErrorStatus::UnknownError,
- "Failed to interpret width as integer");
-
- let x = try_opt!(
- try_opt!(resp.result.find("x"),
- ErrorStatus::UnknownError,
- "Failed to find x field").as_i64(),
- ErrorStatus::UnknownError,
- "Failed to interpret x as integer");
-
- let y = try_opt!(
- try_opt!(resp.result.find("y"),
- ErrorStatus::UnknownError,
- "Failed to find y field").as_i64(),
- ErrorStatus::UnknownError,
- "Failed to interpret y as integer");
-
- WebDriverResponse::WindowRect(WindowRectResponse {x: x,
- y: y,
- width: width,
- height: height})
},
GetElementRect(_) => {
let x = try_opt!(
@@ -768,23 +733,10 @@ impl MarionetteSession {
ErrorStatus::UnknownError,
"Failed to interpret width as float");
- WebDriverResponse::ElementRect(ElementRectResponse::new(x, y, width, height))
+ WebDriverResponse::ElementRect(RectResponse::new(x, y, width, height))
},
+ FullscreenWindow | MaximizeWindow | GetWindowRect |
SetWindowRect(_) => {
- let x = try_opt!(
- try_opt!(resp.result.find("x"),
- ErrorStatus::UnknownError,
- "Failed to find x field").as_f64(),
- ErrorStatus::UnknownError,
- "Failed to interpret x as float");
-
- let y = try_opt!(
- try_opt!(resp.result.find("y"),
- ErrorStatus::UnknownError,
- "Failed to find y field").as_f64(),
- ErrorStatus::UnknownError,
- "Failed to interpret y as float");
-
let width = try_opt!(
try_opt!(resp.result.find("width"),
ErrorStatus::UnknownError,
@@ -797,52 +749,35 @@ impl MarionetteSession {
ErrorStatus::UnknownError,
"Failed to find height field").as_f64(),
ErrorStatus::UnknownError,
- "Failed to interpret width as float");
-
- WebDriverResponse::ElementRect(ElementRectResponse::new(x, y, width, height))
- },
- FullscreenWindow => {
- let width = try_opt!(
- try_opt!(resp.result.find("width"),
- ErrorStatus::UnknownError,
- "Failed to find width field").as_u64(),
- ErrorStatus::UnknownError,
- "Failed to interpret width as integer");
-
- let height = try_opt!(
- try_opt!(resp.result.find("height"),
- ErrorStatus::UnknownError,
- "Failed to find height field").as_u64(),
- ErrorStatus::UnknownError,
- "Failed to interpret height as integer");
+ "Failed to interpret height as float");
let x = try_opt!(
try_opt!(resp.result.find("x"),
ErrorStatus::UnknownError,
- "Failed to find x field").as_i64(),
+ "Failed to find x field").as_f64(),
ErrorStatus::UnknownError,
- "Failed to interpret x as integer");
+ "Failed to interpret x as float");
let y = try_opt!(
try_opt!(resp.result.find("y"),
ErrorStatus::UnknownError,
- "Failed to find y field").as_i64(),
+ "Failed to find y field").as_f64(),
ErrorStatus::UnknownError,
- "Failed to interpret y as integer");
+ "Failed to interpret y as float");
- WebDriverResponse::WindowRect(WindowRectResponse {x: x,
- y: y,
- width: width,
- height: height})
+ WebDriverResponse::WindowRect(RectResponse::new(x, y, width, height))
},
GetCookies => {
let cookies = try!(self.process_cookies(&resp.result));
- WebDriverResponse::Cookie(CookieResponse::new(cookies))
+ WebDriverResponse::Cookies(CookiesResponse { value: cookies })
},
GetNamedCookie(ref name) => {
let mut cookies = try!(self.process_cookies(&resp.result));
cookies.retain(|x| x.name == *name);
- WebDriverResponse::Cookie(CookieResponse::new(cookies))
+ let cookie = try_opt!(cookies.pop(),
+ ErrorStatus::NoSuchCookie,
+ format!("No cookie with name {}", name));
+ WebDriverResponse::Cookie(CookieResponse { value: cookie })
}
FindElement(_) | FindElementElement(_, _) => {
let element = try!(self.to_web_element(
@@ -936,28 +871,28 @@ impl MarionetteSession {
let name = try_opt!(
try_opt!(x.find("name"),
ErrorStatus::UnknownError,
- "Failed to find name field").as_string(),
+ "Cookie must have a name field").as_string(),
ErrorStatus::UnknownError,
- "Failed to interpret name as string").to_string();
+ "Cookie must have string name").to_string();
let value = try_opt!(
try_opt!(x.find("value"),
ErrorStatus::UnknownError,
- "Failed to find value field").as_string(),
+ "Cookie must have a value field").as_string(),
ErrorStatus::UnknownError,
- "Failed to interpret value as string").to_string();
+ "Cookie must have a string value").to_string();
let path = try!(
Nullable::from_json(x.find("path").unwrap_or(&Json::Null),
|x| {
Ok((try_opt!(x.as_string(),
ErrorStatus::UnknownError,
- "Failed to interpret path as String")).to_string())
+ "Cookie path must be string")).to_string())
}));
let domain = try!(
Nullable::from_json(x.find("domain").unwrap_or(&Json::Null),
|x| {
Ok((try_opt!(x.as_string(),
ErrorStatus::UnknownError,
- "Failed to interpret domain as String")).to_string())
+ "Cookie domain must be string")).to_string())
}));
let expiry = try!(
Nullable::from_json(x.find("expiry").unwrap_or(&Json::Null),
@@ -965,17 +900,27 @@ impl MarionetteSession {
Ok(Date::new((try_opt!(
x.as_u64(),
ErrorStatus::UnknownError,
- "Failed to interpret expiry as u64"))))
+ "Cookie expiry must be a positive integer"))))
}));
let secure = try_opt!(
x.find("secure").map_or(Some(false), |x| x.as_boolean()),
ErrorStatus::UnknownError,
- "Failed to interpret secure as boolean");
+ "Cookie secure flag must be boolean");
let http_only = try_opt!(
x.find("httpOnly").map_or(Some(false), |x| x.as_boolean()),
ErrorStatus::UnknownError,
- "Failed to interpret httpOnly as boolean");
- Ok(Cookie::new(name, value, path, domain, expiry, secure, http_only))
+ "Cookie httpOnly flag must be boolean");
+
+ let new_cookie = Cookie {
+ name: name,
+ value: value,
+ path: path,
+ domain: domain,
+ expiry: expiry,
+ secure: secure,
+ httpOnly: http_only,
+ };
+ Ok(new_cookie)
}).collect::<Result<Vec<_>, _>>()
}
@@ -1050,7 +995,7 @@ impl MarionetteCommand {
DeleteSession => {
let mut body = BTreeMap::new();
body.insert("flags".to_owned(), vec!["eForceQuit".to_json()].to_json());
- (Some("quitApplication"), Some(Ok(body)))
+ (Some("quit"), Some(Ok(body)))
},
Status => panic!("Got status command that should already have been handled"),
Get(ref x) => (Some("get"), Some(x.to_marionette())),
@@ -1064,7 +1009,7 @@ impl MarionetteCommand {
GetWindowHandles => (Some("getWindowHandles"), None),
CloseWindow => (Some("close"), None),
GetTimeouts => (Some("getTimeouts"), None),
- SetTimeouts(ref x) => (Some("timeouts"), Some(x.to_marionette())),
+ SetTimeouts(ref x) => (Some("setTimeouts"), Some(x.to_marionette())),
SetWindowRect(ref x) => (Some("setWindowRect"), Some(x.to_marionette())),
GetWindowRect => (Some("getWindowRect"), None),
MaximizeWindow => (Some("maximizeWindow"), None),