Backed out changeset 37f2f9ef6ef8 (bug 1693993) for containing unreviewed changes.

CLOSED TREE
This commit is contained in:
Alexandru Michis 2021-05-31 15:55:11 +03:00
parent 05322eaf04
commit d30bd50d0f
132 changed files with 73 additions and 122 deletions

View file

@ -155,7 +155,6 @@ python/
# These are (mainly) imported code that we don't want to lint to make imports easier. # These are (mainly) imported code that we don't want to lint to make imports easier.
remote/cdp/Protocol.jsm remote/cdp/Protocol.jsm
remote/cdp/test/browser/chrome-remote-interface.js remote/cdp/test/browser/chrome-remote-interface.js
remote/marionette/atom.js
# services/ exclusions # services/ exclusions
@ -171,6 +170,7 @@ servo/
# Test files that we don't want to lint (preprocessed, minified etc) # Test files that we don't want to lint (preprocessed, minified etc)
testing/condprofile/condprof/tests/profile testing/condprofile/condprof/tests/profile
testing/marionette/atom.js
testing/mozbase/mozprofile/tests/files/prefs_with_comments.js testing/mozbase/mozprofile/tests/files/prefs_with_comments.js
testing/talos/talos/scripts/jszip.min.js testing/talos/talos/scripts/jszip.min.js
testing/talos/talos/startup_test/sessionrestore/profile/sessionstore.js testing/talos/talos/startup_test/sessionrestore/profile/sessionstore.js

View file

@ -55,7 +55,7 @@ extensions = [
js_source_path = [ js_source_path = [
"../browser/components/extensions", "../browser/components/extensions",
"../browser/components/uitour", "../browser/components/uitour",
"../remote/marionette", "../testing/marionette",
"../toolkit/components/extensions", "../toolkit/components/extensions",
"../toolkit/components/extensions/parent", "../toolkit/components/extensions/parent",
"../toolkit/components/featuregates", "../toolkit/components/featuregates",

View file

@ -4475,16 +4475,6 @@ pref("services.common.log.logger.tokenserverclient", "Debug");
// Sets recommended automation preferences when Marionette is started. // Sets recommended automation preferences when Marionette is started.
pref("marionette.prefs.recommended", true); 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, // Limits remote agent to listen on loopback devices,
// e.g. 127.0.0.1, localhost, and ::1. // e.g. 127.0.0.1, localhost, and ::1.
pref("remote.force-local", true); pref("remote.force-local", true);

View file

@ -23,31 +23,13 @@ XPCOMUtils.defineLazyModuleGetters(this, {
XPCOMUtils.defineLazyGetter(this, "logger", () => Log.get()); XPCOMUtils.defineLazyGetter(this, "logger", () => Log.get());
const PREF_ACTIVE_PROTOCOLS = ["remote.active-protocols"]; const FORCE_LOCAL = "remote.force-local";
const PREF_FORCE_LOCAL = "remote.force-local";
const BIDI_ACTIVE = 0x1;
const CDP_ACTIVE = 0x2;
const LOOPBACKS = ["localhost", "127.0.0.1", "[::1]"]; const LOOPBACKS = ["localhost", "127.0.0.1", "[::1]"];
class RemoteAgentClass { class RemoteAgentClass {
constructor() { constructor() {
this.alteredPrefs = new Set(); 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() { get listening() {
@ -79,7 +61,7 @@ class RemoteAgentClass {
} }
let { host, port } = url; let { host, port } = url;
if (Preferences.get(PREF_FORCE_LOCAL) && !LOOPBACKS.includes(host)) { if (Preferences.get(FORCE_LOCAL) && !LOOPBACKS.includes(host)) {
throw Components.Exception( throw Components.Exception(
"Restricted to loopback devices", "Restricted to loopback devices",
Cr.NS_ERROR_ILLEGAL_VALUE Cr.NS_ERROR_ILLEGAL_VALUE
@ -100,39 +82,33 @@ class RemoteAgentClass {
} }
this.server = new HttpServer(); this.server = new HttpServer();
this.server.registerPrefixHandler("/json/", new JSONHandler(this));
if (this.isCDPEnabled) { this.targetList = new TargetList();
this.server.registerPrefixHandler("/json/", new JSONHandler(this)); this.targetList.on("target-created", (eventName, target) => {
this.server.registerPathHandler(target.path, target);
this.targetList = new TargetList(); });
this.targetList.on("target-created", (eventName, target) => { this.targetList.on("target-destroyed", (eventName, target) => {
this.server.registerPathHandler(target.path, target); this.server.registerPathHandler(target.path, null);
}); });
this.targetList.on("target-destroyed", (eventName, target) => {
this.server.registerPathHandler(target.path, null);
});
}
return this.asyncListen(host, port); return this.asyncListen(host, port);
} }
async asyncListen(host, port) { async asyncListen(host, port) {
try { try {
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();
this.server._start(port, host); this.server._start(port, host);
Services.obs.notifyObservers(
if (this.isCDPEnabled) { null,
await this.targetList.watchForTargets(); "remote-listening",
`DevTools listening on ${mainTarget.wsDebuggerURL}`
// 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}`
);
}
} catch (e) { } catch (e) {
await this.close(); await this.close();
logger.error(`Unable to start remote agent: ${e.message}`, e); logger.error(`Unable to start remote agent: ${e.message}`, e);
@ -147,12 +123,10 @@ class RemoteAgentClass {
} }
this.alteredPrefs.clear(); this.alteredPrefs.clear();
if (this.isCDPEnabled) { // destroy targetList before stopping server,
// destroy targetList before stopping server, // otherwise the HTTP will fail to stop
// otherwise the HTTP will fail to stop if (this.targetList) {
if (this.targetList) { this.targetList.destructor();
this.targetList.destructor();
}
} }
if (this.listening) { if (this.listening) {

View file

@ -6,21 +6,7 @@ DIRS += [
"rust", "rust",
] ]
EXTRA_COMPONENTS += [
"marionette.js",
"marionette.manifest",
]
XPIDL_MODULE = "remote" XPIDL_MODULE = "remote"
XPIDL_SOURCES += ["nsIRemoteAgent.idl"]
XPIDL_SOURCES += [
"nsIMarionette.idl",
"nsIRemoteAgent.idl",
]
XPCOM_MANIFESTS += ["components.conf"] XPCOM_MANIFESTS += ["components.conf"]
with Files("marionette.*"):
BUG_COMPONENT = ("Testing", "Marionette")
with Files("nsIMarionette.idl"):
BUG_COMPONENT = ("Testing", "Marionette")

View file

@ -1,15 +0,0 @@
# 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/.
JAR_MANIFESTS += ["jar.mn"]
XPCSHELL_TESTS_MANIFESTS += ["test/xpcshell/xpcshell.ini"]
with Files("**"):
BUG_COMPONENT = ("Testing", "Marionette")
SPHINX_TREES["/testing/marionette"] = "doc"
with Files("doc/**"):
SCHEDULES.exclusive = ["docs"]

View file

@ -5,7 +5,6 @@
DIRS += [ DIRS += [
"cdp", "cdp",
"components", "components",
"marionette",
"shared", "shared",
] ]

View file

@ -75,7 +75,7 @@ Firefox (1), and a set of recommended preferences set on startup (2).
These can be perused here: These can be perused here:
1. [testing/geckodriver/src/prefs.rs](https://searchfox.org/mozilla-central/source/testing/geckodriver/src/prefs.rs) 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 As mentioned, these are _recommended_ preferences, and any user-defined
preferences in the [user.js file] or as part of the [`prefs` capability] preferences in the [user.js file] or as part of the [`prefs` capability]

View file

@ -11,10 +11,10 @@ Marionette [ ˌmarɪəˈnɛt] is
Marionette provides interfaces for interacting with both the internal Marionette provides interfaces for interacting with both the internal
JavaScript runtime and UI elements of Gecko-based browsers, such 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, documents, giving a high level of control and ability to replicate,
or emulate, user interaction. or emulate, user interaction.
Head on to the Marionette documentation to find out more: 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/

View file

@ -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"]

View file

@ -14,7 +14,7 @@ For the overall Marionette project, a few rough rules are:
* Code is mutable and not written in stone. Nothing that * Code is mutable and not written in stone. Nothing that
is checked in is sacred and we encourage change to make 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 JavaScript
@ -166,14 +166,14 @@ to make this happen!
The practical details of working on the Marionette code is outlined The practical details of working on the Marionette code is outlined
in [CONTRIBUTING.md], but generally you do not have to re-build 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 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. a re-build.
[XPCOM]: https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM [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 [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 [linter]: #linting
[copying header]: https://www.mozilla.org/en-US/MPL/headers/ [copying header]: https://www.mozilla.org/en-US/MPL/headers/
[public domain]: https://creativecommons.org/publicdomain/zero/1.0/ [public domain]: https://creativecommons.org/publicdomain/zero/1.0/
@ -190,7 +190,7 @@ TODO
Documentation 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 and [testing/geckodriver/doc]. Updates and minor changes to
documentation should ideally not be scrutinised to the same degree documentation should ideally not be scrutinised to the same degree
as code changes to encourage frequent updates so that the documentation as code changes to encourage frequent updates so that the documentation
@ -207,17 +207,16 @@ These include public functions—or command implementations—on
the `GeckoDriver` class, as well as all exported symbols from the `GeckoDriver` class, as well as all exported symbols from
other modules. Documentation for non-exported symbols is not required. 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: 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 % ./mach doc
[Mozilla eslint rules]: https://searchfox.org/mozilla-central/source/.eslintrc.js [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/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/ [jsdoc]: http://usejsdoc.org/
@ -230,13 +229,13 @@ which harmonises the output from [eslint] and [flake8].
To run the linter with a sensible output: 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 For certain classes of style violations the eslint linter has
an automatic mode for fixing and formatting your code. This is an automatic mode for fixing and formatting your code. This is
particularly useful to keep to whitespace and indentation rules: 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 The linter is also run as a try job (shorthand `ES`) which means
any style violations will automatically block a patch from landing any style violations will automatically block a patch from landing

View file

@ -56,7 +56,7 @@ code in our [code style document], which we highly recommend you read.
[ask questions]: ./index.html#communication [ask questions]: ./index.html#communication
[reach out to us]: ./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 [good first bugs]: https://codetribute.mozilla.org/projects/automation
[code style document]: CodeStyle.html [code style document]: CodeStyle.html

View file

@ -64,8 +64,7 @@ your patches are laid out in [Patches.md](Patches.html).
Resources Resources
--------- ---------
* Search Mozilla's code repository with searchfox to find the [code for * Search Mozilla's code repositories with [searchfox].
Marionette] and the [Marionette client/harness].
* Another [guide for new contributors]. It has not been updated in a long * 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. time but it's a good general resource if you ever get stuck on something.
@ -82,8 +81,7 @@ Resources
* If you'd rather use git instead of hg, see [git workflow for * If you'd rather use git instead of hg, see [git workflow for
Gecko development] and/or [this blog post by :ato]. Gecko development] and/or [this blog post by :ato].
[code for Marionette]: https://searchfox.org/mozilla-central/source/remote/marionette/ [searchfox]: https://searchfox.org/mozilla-central/source/testing/marionette/
[Marionette client/harness]: 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 [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 [Mercurial for Mozillians]: https://mozilla-version-control-tools.readthedocs.org/en/latest/hgmozilla/index.html
[guide]: https://gist.github.com/mjzffr/d2adef328a416081f543 [guide]: https://gist.github.com/mjzffr/d2adef328a416081f543

View file

@ -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 [Selenium atoms]: https://github.com/SeleniumHQ/selenium/tree/master/javascript/webdriver/atoms
[WebDriver specification]: https://w3c.github.io/webdriver/webdriver-spec.html [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 Update required Selenium atoms

View file

@ -23,14 +23,14 @@ xpcshell unit tests
------------------- -------------------
Marionette has a set of [xpcshell] unit tests located in 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 Because tests are run in parallel and xpcshell itself is quite
chatty, it can sometimes be useful to run the tests sequentially: 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. These unit tests run as part of the `X` jobs on Treeherder.

View file

@ -39,7 +39,7 @@ marionette.jar:
content/prefs.js (prefs.js) content/prefs.js (prefs.js)
content/print.js (print.js) content/print.js (print.js)
content/reftest.js (reftest.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/reftest-content.js (reftest-content.js)
content/server.js (server.js) content/server.js (server.js)
content/session.js (session.js) content/session.js (session.js)

View file

@ -2,7 +2,12 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this # 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/. # 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"] MARIONETTE_UNIT_MANIFESTS += ["harness/marionette_harness/tests/unit/unit-tests.ini"]
XPCSHELL_TESTS_MANIFESTS += ["test/unit/xpcshell.ini"]
with Files("**"): with Files("**"):
BUG_COMPONENT = ("Testing", "Marionette") BUG_COMPONENT = ("Testing", "Marionette")
@ -10,4 +15,8 @@ with Files("**"):
with Files("harness/**"): with Files("harness/**"):
SCHEDULES.exclusive = ["marionette", "firefox-ui"] SCHEDULES.exclusive = ["marionette", "firefox-ui"]
SPHINX_TREES["/testing/marionette"] = "doc"
SPHINX_PYTHON_PACKAGE_DIRS += ["client/marionette_driver"] SPHINX_PYTHON_PACKAGE_DIRS += ["client/marionette_driver"]
with Files("doc/**"):
SCHEDULES.exclusive = ["docs"]

Some files were not shown because too many files have changed in this diff Show more