Skip to content

Commit

Permalink
Import of v0.29.0 (#1829)
Browse files Browse the repository at this point in the history
  • Loading branch information
whimboo committed Jan 14, 2021
1 parent 2acb733 commit 8f93764
Show file tree
Hide file tree
Showing 23 changed files with 258 additions and 56 deletions.
34 changes: 30 additions & 4 deletions CHANGES.md
Expand Up @@ -3,6 +3,32 @@ Change log

All notable changes to this program are documented in this file.

0.29.0 (2021-01-14, `cf6956a5ec8e`)
--------------------

### Known problems

- _macOS 10.15 (Catalina):_

Due to the requirement from Apple that all programs must be
notarized, geckodriver will not work on Catalina if you manually
download it through another notarized program, such as Firefox.

Whilst we are working on a repackaging fix for this problem, you can
find more details on how to work around this issue in the [macOS
notarization] section of the documentation.

### Added

- Introduced the new boolean capability `moz:debuggerAddress` that can be used
to opt-in to the experimental Chrome DevTools Protocol (CDP) implementation.
A string capability with the same name will be returned by [`NewSession`],
which contains the `host:port` combination of the HTTP server that can be
used to query for websockets of available targets.

Note: For this experimental feature the site-isolation support of
Firefox aka [Fission] will be not available.

0.28.0 (2020-11-03, `c00d2b6acd3f`)
--------------------

Expand All @@ -21,8 +47,8 @@ All notable changes to this program are documented in this file.
### Added

- The command line flag `--android-storage` has been added, to allow geckodriver
to also control Firefox on root-less Android devices. See the [documentation][Flags]
for available values.
to also control Firefox on root-less Android devices.
See the [documentation][Flags] for available values.

### Fixed

Expand Down Expand Up @@ -1368,10 +1394,10 @@ and greater.
[Browser Toolbox]: https://developer.mozilla.org/en-US/docs/Tools/Browser_Toolbox
[WebDriver conformance]: https://wpt.fyi/results/webdriver/tests?label=experimental
[`moz:firefoxOptions`]: https://developer.mozilla.org/en-US/docs/Web/WebDriver/Capabilities/firefoxOptions
[`moz:debuggerAddress`]: https://firefox-source-docs.mozilla.org/testing/geckodriver/Capabilities.html#moz-debuggeraddress
[Microsoft Visual Studio redistributable runtime]: https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads
[GeckoView]: https://wiki.mozilla.org/Mobile/GeckoView
[Firefox Preview]: https://play.google.com/store/apps/details?id=org.mozilla.fenix
[Firefox Reality]: https://play.google.com/store/apps/details?id=org.mozilla.vrbrowser
[Fission]: https://wiki.mozilla.org/Project_Fission
[Capabilities]: https://firefox-source-docs.mozilla.org/testing/geckodriver/Capabilities.html
[Flags]: https://firefox-source-docs.mozilla.org/testing/geckodriver/Flags.html
[enable remote debugging on the Android device]: https://developers.google.com/web/tools/chrome-devtools/remote-debugging
Expand Down
12 changes: 6 additions & 6 deletions Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "geckodriver"
version = "0.28.0"
version = "0.29.0"
description = "Proxy for using WebDriver clients to interact with Gecko-based browsers."
keywords = ["webdriver", "w3c", "httpd", "mozilla", "firefox"]
repository = "https://hg.mozilla.org/mozilla-central/file/tip/testing/geckodriver"
Expand All @@ -17,17 +17,17 @@ hyper = "0.13"
lazy_static = "1.0"
log = { version = "0.4", features = ["std"] }
marionette = { path = "./marionette" }
mozdevice = "0.3.0"
mozprofile = "0.7.0"
mozrunner = "0.12.0"
mozversion = "0.4.0"
mozdevice = "0.3.1"
mozprofile = "0.7.1"
mozrunner = "0.12.1"
mozversion = "0.4.1"
regex = { version="1.0", default-features = false, features = ["perf", "std"] }
serde = "1.0"
serde_derive = "1.0"
serde_json = "1.0"
serde_yaml = "0.8"
uuid = { version = "0.8", features = ["v4"] }
webdriver = "0.42.0"
webdriver = "0.43.0"
zip = { version = "0.4", default-features = false, features = ["deflate"] }

[[bin]]
Expand Down
14 changes: 8 additions & 6 deletions build.rs
@@ -1,3 +1,7 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

// Writes build information to ${OUT_DIR}/build-info.rs which is included in
// the program during compilation:
//
Expand Down Expand Up @@ -42,13 +46,11 @@ fn get_build_info(dir: &Path) -> Box<dyn BuildInfo> {
Box::new(Hg {})
} else if Path::exists(&dir.join(".git")) {
Box::new(Git {})
} else if let Some(parent) = dir.parent() {
get_build_info(parent)
} else {
if let Some(parent) = dir.parent() {
get_build_info(parent)
} else {
eprintln!("unable to detect vcs");
Box::new(Noop {})
}
eprintln!("unable to detect vcs");
Box::new(Noop {})
}
}

Expand Down
46 changes: 46 additions & 0 deletions doc/Capabilities.md
Expand Up @@ -8,6 +8,52 @@ We additionally have some capabilities that largely are implementation
concerns that normal users should not care about:


`moz:debuggerAddress`
--------------------

A boolean value to indicate if Firefox has to be started with the
[Remote Protocol] enabled, which is a low-level debugging interface that
implements a subset of the [Chrome DevTools Protocol] (CDP).

When enabled the returned `moz:debuggerAddress` capability of the `New Session`
command is the `host:port` combination of a server that supports the following
HTTP endpoints:

### GET /json/version

The browser version metadata:

{
"Browser": "Firefox/84.0a1",
"Protocol-Version": "1.0",
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:84.0) Gecko/20100101 Firefox/84.0",
"V8-Version": "1.0",
"WebKit-Version": "1.0",
"webSocketDebuggerUrl": "ws://localhost:9222/devtools/browser/fe507083-2960-a442-bbd7-7dfe1f111c05"
}

### GET /json/list

A list of all available websocket targets:

[ {
"description": "",
"devtoolsFrontendUrl": null,
"faviconUrl": "",
"id": "ecbf9028-676a-1b40-8596-a5edc0e2875b",
"type": "page",
"url": "https://www.mozilla.org/en-US/",
"browsingContextId": 29,
"webSocketDebuggerUrl": "ws://localhost:9222/devtools/page/ecbf9028-676a-1b40-8596-a5edc0e2875b"
} ]

The contained `webSocketDebuggerUrl` entries can be used to connect to the
websocket and interact with the browser by using the CDP protocol.

[Remote Protocol]: /testing/remote/doc/
[Chrome DevTools Protocol]: https://chromedevtools.github.io/devtools-protocol/


`moz:useNonSpecCompliantPointerOrigin`
--------------------------------------

Expand Down
24 changes: 12 additions & 12 deletions doc/Flags.md
@@ -1,7 +1,7 @@
Flags
=====

#### <code>--android-storage <var>ANDROID_STORAGE</var></code>
#### <code>&#x2D;&#x2D;android-storage <var>ANDROID_STORAGE</var></code>

Selects the test data location on the Android device, eg. the Firefox profile.
By default `auto` is used.
Expand Down Expand Up @@ -47,7 +47,7 @@ By default `auto` is used.
</table>


#### <code>-b <var>BINARY</var></code> / <code>--binary <var>BINARY</var></code>
#### <code>-b <var>BINARY</var></code> / <code>&#x2D;&#x2D;binary <var>BINARY</var></code>

Path to the Firefox binary to use. By default geckodriver tries to
find and use the system installation of Firefox, but that behaviour
Expand All @@ -74,7 +74,7 @@ scanning the Windows registry.
[whereis(1)]: http://www.manpagez.com/man/1/whereis/


#### <code>--connect-existing</code>
#### <code>&#x2D;&#x2D;connect-existing</code>

Connect geckodriver to an existing Firefox instance. This means
geckodriver will abstain from the default of starting a new Firefox
Expand All @@ -85,29 +85,29 @@ To enable the remote protocol in Firefox, you can pass the
`-marionette` flag. Unless the `marionette.port` preference
has been user-set, Marionette will listen on port 2828. So when
using `--connect-existing` it is likely you will also have to use
[`--marionette-port`] to set the correct port.
`--marionette-port` to set the correct port.

[`--marionette-port`]: #marionette-port
[`&#x2D;&#x2D;marionette-port`]: #marionette-port


#### <code>--host <var>HOST</var></code>
#### <code>&#x2D;&#x2D;host <var>HOST</var></code>

Host to use for the WebDriver server. Defaults to 127.0.0.1.


#### <code>--log <var>LEVEL</var></code>
#### <code>&#x2D;&#x2D;log <var>LEVEL</var></code>

Set the Gecko and geckodriver log level. Possible values are `fatal`,
`error`, `warn`, `info`, `config`, `debug`, and `trace`.


#### <code>--marionette-host <var>HOST</var></code>
#### <code>&#x2D;&#x2D;marionette-host <var>HOST</var></code>

Selects the host for geckodriver’s connection to the [Marionette]
remote protocol. Defaults to 127.0.0.1.


#### <code>--marionette-port <var>PORT</var></code>
#### <code>&#x2D;&#x2D;marionette-port <var>PORT</var></code>

Selects the port for geckodriver’s connection to the [Marionette]
remote protocol.
Expand All @@ -116,21 +116,21 @@ In the default mode where geckodriver starts and manages the Firefox
process, it will pick a free port assigned by the system and set the
`marionette.port` preference in the profile.

When [`--connect-existing`] is used and the Firefox process is not
When `--connect-existing` is used and the Firefox process is not
under geckodriver’s control, it will simply connect to <var>PORT</var>.

[`--connect-existing`]: #connect-existing


#### <code>-p <var>PORT</var></code> / <code>--port <var>PORT</var></code>
#### <code>-p <var>PORT</var></code> / <code>&#x2D;&#x2D;port <var>PORT</var></code>

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 atomically assign a free port.


#### <code>--jsdebugger</code>
#### <code>&#x2D;&#x2D;jsdebugger</code>

Attach [browser toolbox] debugger when Firefox starts. This is
useful for debugging [Marionette] internals.
Expand Down
5 changes: 5 additions & 0 deletions doc/Support.md
Expand Up @@ -23,6 +23,11 @@ and required versions of Selenium and Firefox:
</tr>
</thead>

<tr>
<td>0.29.0
<td>≥ 3.11 (3.14 Python)
<td>60
<td>n/a
<tr>
<td>0.28.0
<td>≥ 3.11 (3.14 Python)
Expand Down
5 changes: 3 additions & 2 deletions doc/Testing.md
Expand Up @@ -14,9 +14,10 @@ tell mach to build these by adding the following line to your [mozconfig]:

ac_add_options --enable-rust-tests

Tests can then be run like this:
Tests can then be run by using `cargo test` in the specific source folder:

% ./mach test testing/geckodriver
% cd testing/geckodriver/src
% cargo test

To run the more extensive WPT tests you can use mach, but first
make sure you have built Firefox:
Expand Down
26 changes: 0 additions & 26 deletions mach_commands.py
Expand Up @@ -125,29 +125,3 @@ def run(self, binary, params, debug, debugger, debugger_args):
args = [self.debuggerInfo.path] + self.debuggerInfo.args + args

return self.run_process(args=args, ensure_exit_code=False, pass_thru=True)


@CommandProvider
class GeckoDriverTest(MachCommandBase):
@Command(
"geckodriver-test",
category="post-build",
description="Run geckodriver unit tests.",
)
@CommandArgument(
"-v",
"--verbose",
action="store_true",
help="Verbose output for what" " commands the build is running.",
)
def test(self, verbose=False, **kwargs):
from mozbuild.controller.building import BuildDriver

self.log_manager.enable_all_structured_loggers()

driver = self._spawn(BuildDriver)
return driver.build(
what=["testing/geckodriver/check"],
verbose=verbose,
mach_context=self._mach_context,
)
4 changes: 4 additions & 0 deletions marionette/src/common.rs
@@ -1,3 +1,7 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

use serde::ser::SerializeMap;
use serde::{de, Deserialize, Deserializer, Serialize, Serializer};
use serde_json::Value;
Expand Down
4 changes: 4 additions & 0 deletions marionette/src/error.rs
@@ -1,3 +1,7 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

use std::error;
use std::fmt;

Expand Down
4 changes: 4 additions & 0 deletions marionette/src/lib.rs
@@ -1,3 +1,7 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

pub mod error;

pub mod common;
Expand Down
4 changes: 4 additions & 0 deletions marionette/src/marionette.rs
@@ -1,3 +1,7 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

use serde::{Deserialize, Serialize};

use crate::common::BoolValue;
Expand Down
4 changes: 4 additions & 0 deletions marionette/src/message.rs
@@ -1,3 +1,7 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

use serde::de::{self, SeqAccess, Unexpected, Visitor};
use serde::{Deserialize, Deserializer, Serialize, Serializer};
use serde_json::{Map, Value};
Expand Down
4 changes: 4 additions & 0 deletions marionette/src/result.rs
@@ -1,3 +1,7 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

use serde::de;
use serde::{Deserialize, Deserializer, Serialize, Serializer};
use serde_json::Value;
Expand Down
4 changes: 4 additions & 0 deletions marionette/src/test.rs
@@ -1,3 +1,7 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

pub static ELEMENT_KEY: &'static str = "element-6066-11e4-a52e-4f735466cecf";

pub fn assert_ser_de<T>(data: &T, json: serde_json::Value)
Expand Down
4 changes: 4 additions & 0 deletions marionette/src/webdriver.rs
@@ -1,3 +1,7 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

use serde::{Deserialize, Serialize};
use serde_json::Value;

Expand Down
4 changes: 4 additions & 0 deletions src/build.rs
@@ -1,3 +1,7 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

use serde_json::Value;
use std::fmt;

Expand Down

0 comments on commit 8f93764

Please sign in to comment.