Skip to content

Commit

Permalink
Backed out changeset 37f2f9ef6ef8 (bug 1693993) for containing unrevi…
Browse files Browse the repository at this point in the history
…ewed changes.

CLOSED TREE
  • Loading branch information
Alexandru Michis committed May 31, 2021
1 parent cf0bed1 commit e1f6605
Show file tree
Hide file tree
Showing 132 changed files with 72 additions and 121 deletions.
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ python/
# These are (mainly) imported code that we don't want to lint to make imports easier.
remote/cdp/Protocol.jsm
remote/cdp/test/browser/chrome-remote-interface.js
remote/marionette/atom.js

# services/ exclusions

Expand All @@ -171,6 +170,7 @@ servo/

# Test files that we don't want to lint (preprocessed, minified etc)
testing/condprofile/condprof/tests/profile
testing/marionette/atom.js
testing/mozbase/mozprofile/tests/files/prefs_with_comments.js
testing/talos/talos/scripts/jszip.min.js
testing/talos/talos/startup_test/sessionrestore/profile/sessionstore.js
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
js_source_path = [
"../browser/components/extensions",
"../browser/components/uitour",
"../remote/marionette",
"../testing/marionette",
"../toolkit/components/extensions",
"../toolkit/components/extensions/parent",
"../toolkit/components/featuregates",
Expand Down
10 changes: 0 additions & 10 deletions modules/libpref/init/all.js
Original file line number Diff line number Diff line change
Expand Up @@ -4475,16 +4475,6 @@ pref("services.common.log.logger.tokenserverclient", "Debug");
// Sets recommended automation preferences when Marionette is started.
pref("marionette.prefs.recommended", true);

// Defines the protocols that will be active for the Remote Agent.
// 1: WebDriver BiDi
// 2: CDP (Chrome DevTools Protocol)
// 3: WebDriver BiDi + CDP
#if defined(NIGHTLY_BUILD)
pref("remote.active-protocols", 3);
#else
pref("remote.active-protocols", 2);
#endif

// Limits remote agent to listen on loopback devices,
// e.g. 127.0.0.1, localhost, and ::1.
pref("remote.force-local", true);
Expand Down
74 changes: 24 additions & 50 deletions remote/components/RemoteAgent.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -23,31 +23,13 @@ XPCOMUtils.defineLazyModuleGetters(this, {

XPCOMUtils.defineLazyGetter(this, "logger", () => Log.get());

const PREF_ACTIVE_PROTOCOLS = ["remote.active-protocols"];
const PREF_FORCE_LOCAL = "remote.force-local";

const BIDI_ACTIVE = 0x1;
const CDP_ACTIVE = 0x2;
const FORCE_LOCAL = "remote.force-local";

const LOOPBACKS = ["localhost", "127.0.0.1", "[::1]"];

class RemoteAgentClass {
constructor() {
this.alteredPrefs = new Set();

const protocols = Services.prefs.getIntPref(PREF_ACTIVE_PROTOCOLS);
if (protocols < 1 || protocols > 3) {
throw Error(`Invalid remote protocol identifier: ${protocols}`);
}
this._activeProtocols = protocols;
}

get isBiDiEnabled() {
return (this._activeProtocols & BIDI_ACTIVE) == BIDI_ACTIVE;
}

get isCDPEnabled() {
return (this._activeProtocols & CDP_ACTIVE) == CDP_ACTIVE;
}

get listening() {
Expand Down Expand Up @@ -79,7 +61,7 @@ class RemoteAgentClass {
}

let { host, port } = url;
if (Preferences.get(PREF_FORCE_LOCAL) && !LOOPBACKS.includes(host)) {
if (Preferences.get(FORCE_LOCAL) && !LOOPBACKS.includes(host)) {
throw Components.Exception(
"Restricted to loopback devices",
Cr.NS_ERROR_ILLEGAL_VALUE
Expand All @@ -100,39 +82,33 @@ class RemoteAgentClass {
}

this.server = new HttpServer();
this.server.registerPrefixHandler("/json/", new JSONHandler(this));

if (this.isCDPEnabled) {
this.server.registerPrefixHandler("/json/", new JSONHandler(this));

this.targetList = new TargetList();
this.targetList.on("target-created", (eventName, target) => {
this.server.registerPathHandler(target.path, target);
});
this.targetList.on("target-destroyed", (eventName, target) => {
this.server.registerPathHandler(target.path, null);
});
}
this.targetList = new TargetList();
this.targetList.on("target-created", (eventName, target) => {
this.server.registerPathHandler(target.path, target);
});
this.targetList.on("target-destroyed", (eventName, target) => {
this.server.registerPathHandler(target.path, null);
});

return this.asyncListen(host, port);
}

async asyncListen(host, port) {
try {
this.server._start(port, host);

if (this.isCDPEnabled) {
await this.targetList.watchForTargets();
await this.targetList.watchForTargets();

// Immediatly instantiate the main process target in order
// to be accessible via HTTP endpoint on startup
const mainTarget = this.targetList.getMainProcessTarget();
// Immediatly instantiate the main process target in order
// to be accessible via HTTP endpoint on startup
const mainTarget = this.targetList.getMainProcessTarget();

Services.obs.notifyObservers(
null,
"remote-listening",
`DevTools listening on ${mainTarget.wsDebuggerURL}`
);
}
this.server._start(port, host);
Services.obs.notifyObservers(
null,
"remote-listening",
`DevTools listening on ${mainTarget.wsDebuggerURL}`
);
} catch (e) {
await this.close();
logger.error(`Unable to start remote agent: ${e.message}`, e);
Expand All @@ -147,12 +123,10 @@ class RemoteAgentClass {
}
this.alteredPrefs.clear();

if (this.isCDPEnabled) {
// destroy targetList before stopping server,
// otherwise the HTTP will fail to stop
if (this.targetList) {
this.targetList.destructor();
}
// destroy targetList before stopping server,
// otherwise the HTTP will fail to stop
if (this.targetList) {
this.targetList.destructor();
}

if (this.listening) {
Expand Down
16 changes: 1 addition & 15 deletions remote/components/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,7 @@ DIRS += [
"rust",
]

EXTRA_COMPONENTS += [
"marionette.js",
"marionette.manifest",
]

XPIDL_MODULE = "remote"

XPIDL_SOURCES += [
"nsIMarionette.idl",
"nsIRemoteAgent.idl",
]
XPIDL_SOURCES += ["nsIRemoteAgent.idl"]

XPCOM_MANIFESTS += ["components.conf"]

with Files("marionette.*"):
BUG_COMPONENT = ("Testing", "Marionette")
with Files("nsIMarionette.idl"):
BUG_COMPONENT = ("Testing", "Marionette")
15 changes: 0 additions & 15 deletions remote/marionette/moz.build

This file was deleted.

1 change: 0 additions & 1 deletion remote/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
DIRS += [
"cdp",
"components",
"marionette",
"shared",
]

Expand Down
2 changes: 1 addition & 1 deletion testing/geckodriver/doc/Profiles.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Firefox (1), and a set of recommended preferences set on startup (2).
These can be perused here:

1. [testing/geckodriver/src/prefs.rs](https://searchfox.org/mozilla-central/source/testing/geckodriver/src/prefs.rs)
2. [remote/components/marionette.js](https://searchfox.org/mozilla-central/source/remote/components/marionette.js)
2. [testing/marionette/components/marionette/marionette.js](https://searchfox.org/mozilla-central/source/testing/marionette/components/marionette.js)

As mentioned, these are _recommended_ preferences, and any user-defined
preferences in the [user.js file] or as part of the [`prefs` capability]
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions remote/marionette/README → testing/marionette/README
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ Marionette [ ˌmarɪəˈnɛt] is

Marionette provides interfaces for interacting with both the internal
JavaScript runtime and UI elements of Gecko-based browsers, such
as Firefox on desktop and mobile. It can control both the chrome- and content
as Firefox and Fennec. It can control both the chrome- and content
documents, giving a high level of control and ability to replicate,
or emulate, user interaction.

Head on to the Marionette documentation to find out more:

https://firefox-source-docs.mozilla.org/testing/marionette/
https://firefox-source-docs.mozilla.org/testing/marionette/marionette/
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
11 changes: 11 additions & 0 deletions testing/marionette/components/moz.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# 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/.

EXTRA_COMPONENTS += [
"marionette.js",
"marionette.manifest",
]

XPIDL_MODULE = "remote"
XPIDL_SOURCES += ["nsIMarionette.idl"]
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ For the overall Marionette project, a few rough rules are:

* Code is mutable and not written in stone. Nothing that
is checked in is sacred and we encourage change to make
remote/marionette a pleasant ecosystem to work in.
testing/marionette a pleasant ecosystem to work in.


JavaScript
Expand Down Expand Up @@ -166,14 +166,14 @@ to make this happen!

The practical details of working on the Marionette code is outlined
in [CONTRIBUTING.md], but generally you do not have to re-build
Firefox when changing code. Any change to remote/marionette/*.js
Firefox when changing code. Any change to testing/marionette/*.js
will be picked up on restarting Firefox. The only notable exception
is remote/components/marionette.js, which does require
is testing/marionette/components/marionette.js, which does require
a re-build.

[XPCOM]: https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM
[strict mode]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode
[our own specialisations]: https://searchfox.org/mozilla-central/source/remote/marionette/.eslintrc.js
[our own specialisations]: https://searchfox.org/mozilla-central/source/testing/marionette/.eslintrc.js
[linter]: #linting
[copying header]: https://www.mozilla.org/en-US/MPL/headers/
[public domain]: https://creativecommons.org/publicdomain/zero/1.0/
Expand All @@ -190,7 +190,7 @@ TODO
Documentation
-------------

We keep our documentation in-tree under [remote/marionette/doc]
We keep our documentation in-tree under [testing/marionette/doc]
and [testing/geckodriver/doc]. Updates and minor changes to
documentation should ideally not be scrutinised to the same degree
as code changes to encourage frequent updates so that the documentation
Expand All @@ -207,17 +207,16 @@ These include public functions—or command implementations—on
the `GeckoDriver` class, as well as all exported symbols from
other modules. Documentation for non-exported symbols is not required.

The API documentation can be regenerated to [remote/marionette/doc/internals]
The API documentation can be regenerated to [testing/marionette/doc/api]
so:

The API documentation uses [jsdoc] and is generated to <https://firefox-source-docs.mozilla.org/testing/marionette/internals> on Taskcluster. You may also build the documentation locally:
The API documentation uses [jsdoc] and is generated to <https://firefox-source-docs.mozilla.org/testing/marionette/marionette/internals> on Taskcluster. You may also build the documentation locally:

% ./mach doc

[Mozilla eslint rules]: https://searchfox.org/mozilla-central/source/.eslintrc.js
[remote/marionette/doc]: https://searchfox.org/mozilla-central/source/remote/marionette/doc
[remote/marionette/doc/internals]: https://searchfox.org/mozilla-central/source/remote/marionette/doc/internals
[testing/geckodriver/doc]: https://searchfox.org/mozilla-central/source/testing/geckodriver/doc
[testing/marionette/doc]: https://searchfox.org/mozilla-central/source/testing/marionette/doc
[jsdoc]: http://usejsdoc.org/


Expand All @@ -230,13 +229,13 @@ which harmonises the output from [eslint] and [flake8].

To run the linter with a sensible output:

% ./mach lint -funix remote/marionette
% ./mach lint -funix testing/marionette

For certain classes of style violations the eslint linter has
an automatic mode for fixing and formatting your code. This is
particularly useful to keep to whitespace and indentation rules:

% ./mach eslint --fix remote/marionette
% ./mach eslint --fix testing/marionette

The linter is also run as a try job (shorthand `ES`) which means
any style violations will automatically block a patch from landing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ code in our [code style document], which we highly recommend you read.

[ask questions]: ./index.html#communication
[reach out to us]: ./index.html#communication
[mozilla-central]: https://searchfox.org/mozilla-central/source/remote/marionette/
[mozilla-central]: https://searchfox.org/mozilla-central/source/testing/marionette/
[good first bugs]: https://codetribute.mozilla.org/projects/automation
[code style document]: CodeStyle.html

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ your patches are laid out in [Patches.md](Patches.html).
Resources
---------

* Search Mozilla's code repository with searchfox to find the [code for
Marionette] and the [Marionette client/harness].
* Search Mozilla's code repositories with [searchfox].

* Another [guide for new contributors]. It has not been updated in a long
time but it's a good general resource if you ever get stuck on something.
Expand All @@ -82,8 +81,7 @@ Resources
* If you'd rather use git instead of hg, see [git workflow for
Gecko development] and/or [this blog post by :ato].

[code for Marionette]: https://searchfox.org/mozilla-central/source/remote/marionette/
[Marionette client/harness]: https://searchfox.org/mozilla-central/source/testing/marionette/
[searchfox]: https://searchfox.org/mozilla-central/source/testing/marionette/
[guide for new contributors]: https://ateam-bootcamp.readthedocs.org/en/latest/guide/index.html#new-contributor-guide
[Mercurial for Mozillians]: https://mozilla-version-control-tools.readthedocs.org/en/latest/hgmozilla/index.html
[guide]: https://gist.github.com/mjzffr/d2adef328a416081f543
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ To use one of those atoms Javascript modules will have to import

[Selenium atoms]: https://github.com/SeleniumHQ/selenium/tree/master/javascript/webdriver/atoms
[WebDriver specification]: https://w3c.github.io/webdriver/webdriver-spec.html
[atom.js]: https://searchfox.org/mozilla-central/source/remote/marionette/atom.js
[atom.js]: https://searchfox.org/mozilla-central/source/testing/marionette/atom.js


Update required Selenium atoms
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ xpcshell unit tests
-------------------

Marionette has a set of [xpcshell] unit tests located in
_remote/marionette/test/xpcshell. These can be run this way:
_testing/marionette/test/unit. These can be run this way:

% ./mach test remote/marionette/test/unit
% ./mach test testing/marionette/test/unit

Because tests are run in parallel and xpcshell itself is quite
chatty, it can sometimes be useful to run the tests sequentially:

% ./mach test --sequential remote/marionette/test/xpcshell/test_error.js
% ./mach test --sequential testing/marionette/test/unit/test_error.js

These unit tests run as part of the `X` jobs on Treeherder.

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion remote/marionette/jar.mn → testing/marionette/jar.mn
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ marionette.jar:
content/prefs.js (prefs.js)
content/print.js (print.js)
content/reftest.js (reftest.js)
content/reftest.xhtml (chrome/reftest.xhtml)
content/reftest.xhtml (reftest.xhtml)
content/reftest-content.js (reftest-content.js)
content/server.js (server.js)
content/session.js (session.js)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
9 changes: 9 additions & 0 deletions testing/marionette/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,21 @@
# 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/.

DIRS += ["components"]

JAR_MANIFESTS += ["jar.mn"]

MARIONETTE_UNIT_MANIFESTS += ["harness/marionette_harness/tests/unit/unit-tests.ini"]
XPCSHELL_TESTS_MANIFESTS += ["test/unit/xpcshell.ini"]

with Files("**"):
BUG_COMPONENT = ("Testing", "Marionette")

with Files("harness/**"):
SCHEDULES.exclusive = ["marionette", "firefox-ui"]

SPHINX_TREES["/testing/marionette"] = "doc"
SPHINX_PYTHON_PACKAGE_DIRS += ["client/marionette_driver"]

with Files("doc/**"):
SCHEDULES.exclusive = ["docs"]
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit e1f6605

Please sign in to comment.