nsIHttpServer.registerPathHandler() is designed to take null as
the second argument to unregister path handlers. This saves us
from having to modify its internal state, and fixes a minor TODO
in the remote agent initialisation code.
Differential Revision: https://phabricator.services.mozilla.com/D58605
--HG--
extra : moz-landing-system : lando
The nsIRemoteAgent interface introduced with bug 1543115 did
not change the exceptions thrown internally by the class. To ensure
better interaction with consumers over XPIDL we should ensure the
JS implementation throws NS exceptions.
Differential Revision: https://phabricator.services.mozilla.com/D55177
--HG--
extra : moz-landing-system : lando
As nsIHttpServer.registerPathHandler now checks that the path is
not empty we can drop our pre-check when target-created is handled.
If target.path does happen to be empty an error is printed to the console.
Differential Revision: https://phabricator.services.mozilla.com/D55161
--HG--
extra : moz-landing-system : lando
Interfaces exposed over XPIDL cannot be marked async, otherwise their
return values get lost. This patch makes nsIRemoteAgent.listen()
synchronous by removing the use of async/await.
Unfortunately Rust does not yet support deserialising promises sent across
XPIDL, documented in https://bugzilla.mozilla.org/show_bug.cgi?id=1512319.
In an effort to retain the original API internally the function
now returns a promise. This means the function can be awaited in
JS only, which we make use of in remote/test/browser/head.js.
Differential Revision: https://phabricator.services.mozilla.com/D55173
--HG--
extra : moz-landing-system : lando
Interfaces exposed over XPIDL cannot be marked async, otherwise their
return values get lost. This patch makes nsIRemoteAgent.close()
synchronous by removing the use of async/await.
Unfortunately Rust does not yet support deserialising promises sent
across XPIDL, so in an effort to retain the original API internally
the function now returns a promise. This means the function can be
awaited in JS only, which we make use of in remote/test/browser/head.js.
Differential Revision: https://phabricator.services.mozilla.com/D55172
--HG--
extra : moz-landing-system : lando
This bootstraps the remote agent from Rust so that we have access
to write to stderr using the eprintln!() macro. There is a future
intention to expand Rust usage in the remote agent by delegating
CDP and WebDriver Bi-Di protocol schema validation to serde.
The Rust port is faithful to the JS version in terms of functionality,
and in some places improves on the original design by enforcing
a strict division between flag handling code on one hand, and the
remote agent server on the other.
Differential Revision: https://phabricator.services.mozilla.com/D50289
--HG--
extra : moz-landing-system : lando
Adds an XPIDL interface for the remote agent which we will later use to
initialise and start it from a new command-line handler written in Rust.
Differential Revision: https://phabricator.services.mozilla.com/D50287
--HG--
extra : moz-landing-system : lando
Crafting nsIURIs in Rust is complicated. Allow RemoteAgent.listen()
to accept both strings and nsIURIs when called in JavaScript.
Differential Revision: https://phabricator.services.mozilla.com/D50286
--HG--
extra : moz-landing-system : lando
When calling RemoteAgent.listen() across XPIDL the function is run
asynchronously. In order to find out when the remote agent has started
listening we introduce a "remote-listening" system observer notification.
Differential Revision: https://phabricator.services.mozilla.com/D50285
--HG--
extra : moz-landing-system : lando
Although it currently makes no difference, we should ensure the
required preferences are set sooner, in case any of the internal
remote agent features depend on it.
Because we also cannot control when the nsICommandLineHandler for
the remote agent is invoked, setting it sooner rather than later,
seems a lot safer.
Differential Revision: https://phabricator.services.mozilla.com/D50283
--HG--
extra : moz-landing-system : lando
close() is meant to be failsafe in the sense that it should be
possible to call without side-effects.
We are currently setting up a lot of state in listen() that is not
cleaned up if the server eventually fails to start. Calling close()
when this happens will ensure any state listen() has accrued is reset.
Differential Revision: https://phabricator.services.mozilla.com/D50282
--HG--
extra : moz-landing-system : lando
Having init() as a separate function leads to inconsistencies about
how the required state is checked.
init() prevents the remote agent from being loaded when the
remote.enabled preference is false or it is attempted loaded into a
child process, but listen() already manipulates state before these
checks are run. This is probably not the intention, but an easy
mistake to make when the code flow is not crystal clear.
Since we never have a need to call init() independently, this patch
merges init() into listen().
Differential Revision: https://phabricator.services.mozilla.com/D50281
--HG--
extra : moz-landing-system : lando
This bootstraps the remote agent from Rust so that we have access
to write to stderr using the eprintln!() macro. There is a future
intention to expand Rust usage in the remote agent by delegating
CDP and WebDriver Bi-Di protocol schema validation to serde.
The Rust port is faithful to the JS version in terms of functionality,
and in some places improves on the original design by enforcing
a strict division between flag handling code on one hand, and the
remote agent server on the other.
Differential Revision: https://phabricator.services.mozilla.com/D50289
--HG--
extra : moz-landing-system : lando
Adds an XPIDL interface for the remote agent which we will later use to
initialise and start it from a new command-line handler written in Rust.
Differential Revision: https://phabricator.services.mozilla.com/D50287
--HG--
extra : moz-landing-system : lando
Crafting nsIURIs in Rust is complicated. Allow RemoteAgent.listen()
to accept both strings and nsIURIs when called in JavaScript.
Differential Revision: https://phabricator.services.mozilla.com/D50286
--HG--
extra : moz-landing-system : lando
When calling RemoteAgent.listen() across XPIDL the function is run
asynchronously. In order to find out when the remote agent has started
listening we introduce a "remote-listening" system observer notification.
Differential Revision: https://phabricator.services.mozilla.com/D50285
--HG--
extra : moz-landing-system : lando
Although it currently makes no difference, we should ensure the
required preferences are set sooner, in case any of the internal
remote agent features depend on it.
Because we also cannot control when the nsICommandLineHandler for
the remote agent is invoked, setting it sooner rather than later,
seems a lot safer.
Differential Revision: https://phabricator.services.mozilla.com/D50283
--HG--
extra : moz-landing-system : lando
close() is meant to be failsafe in the sense that it should be
possible to call without side-effects.
We are currently setting up a lot of state in listen() that is not
cleaned up if the server eventually fails to start. Calling close()
when this happens will ensure any state listen() has accrued is reset.
Differential Revision: https://phabricator.services.mozilla.com/D50282
--HG--
extra : moz-landing-system : lando
Having init() as a separate function leads to inconsistencies about
how the required state is checked.
init() prevents the remote agent from being loaded when the
remote.enabled preference is false or it is attempted loaded into a
child process, but listen() already manipulates state before these
checks are run. This is probably not the intention, but an easy
mistake to make when the code flow is not crystal clear.
Since we never have a need to call init() independently, this patch
merges init() into listen().
Differential Revision: https://phabricator.services.mozilla.com/D50281
--HG--
extra : moz-landing-system : lando
* TabObserver is rather an helper class of Targets rather than RemoteAgent.
Targets is the class which holds all the targets and reports about their
creation and destructor. It feels legitimate to have it directly integrate
with TabObserver.
* To better sort of the files. i.e. avoid having "random files" in /remote/
I'm renaming and moving TabObserver according to its usage.
* We were emitting "connect" and "disconnect" event when a target was created
or destroyed. But this is misleading as there is no connection to anything
being made. Only later, a CDP client might connect to a target HTTP endpoint
and initiate a connection. These events are making this hard to understand
that the connection actually happens when Target.handle is called.
Differential Revision: https://phabricator.services.mozilla.com/D37043
--HG--
rename : remote/WindowManager.jsm => remote/targets/TabObserver.jsm
extra : moz-landing-system : lando
Connect and disconnect in misleading here as a target aren't connected/disconnected,
but instead, being unregistered and destroyed. The fact that they are "disconnected"
is a side effect of this destruction. Also note that a Target is never "connected",
it is only a Connection and its related sessions which really are connected to a remote client.
Differential Revision: https://phabricator.services.mozilla.com/D37042
--HG--
extra : moz-landing-system : lando
Puppeteer parses stderr looking for the regular expression
^DevTools listening on (ws:\/\/.*)$. For Puppeteer to be able
to connect to Firefox, we need to change the line we print slightly
to conform with this expression.
The remote agent also uses Log.jsm to print it, but we cannot rely
on logging always being enabled, e.g. if remote.log.level is set
to Warn or above. For this reason we should use dump().
The patch also instantiates the main target before starting the HTTPD.
Differential Revision: https://phabricator.services.mozilla.com/D30913
--HG--
extra : moz-landing-system : lando
Start the `TabObserver` from `RemoteAgent.listen` in order to prevent
having the tests to manually start it.
Start it from `listen` instead of `init` as we do stop the `TabObserver` from
`stop` and `stop` is the reverse of `listen`, not the reverse of `init`.
Differential Revision: https://phabricator.services.mozilla.com/D29412
--HG--
extra : moz-landing-system : lando
This will later help register the component statically in bug 1536862.
And already ease using the remote agent from other JSM files.
Differential Revision: https://phabricator.services.mozilla.com/D24227
--HG--
rename : remote/RemoteAgent.js => remote/RemoteAgent.jsm
extra : moz-landing-system : lando