From 24f7b88ad46acfadcd642b250897ab7b76e7b5a0 Mon Sep 17 00:00:00 2001 From: Andreas Tolfsen Date: Tue, 19 Nov 2019 12:32:48 +0000 Subject: [PATCH] bug 1543115: remote: introduce nsIRemoteAgent XPIDL interface; r=remote-protocol-reviewers,maja_zf 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 --- remote/RemoteAgent.jsm | 5 ++++- remote/moz.build | 3 +++ remote/nsIRemoteAgent.idl | 44 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 remote/nsIRemoteAgent.idl diff --git a/remote/RemoteAgent.jsm b/remote/RemoteAgent.jsm index 7694984b34e5..46ef5aa1c62a 100644 --- a/remote/RemoteAgent.jsm +++ b/remote/RemoteAgent.jsm @@ -218,7 +218,10 @@ class RemoteAgentClass { // XPCOM get QueryInterface() { - return ChromeUtils.generateQI([Ci.nsICommandLineHandler]); + return ChromeUtils.generateQI([ + Ci.nsICommandLineHandler, + Ci.nsIRemoteAgent, + ]); } } diff --git a/remote/moz.build b/remote/moz.build index 35de24b09bef..b37adad2c6db 100644 --- a/remote/moz.build +++ b/remote/moz.build @@ -9,6 +9,9 @@ DIRS += [ XPCOM_MANIFESTS += ["components.conf"] JAR_MANIFESTS += ["jar.mn"] +XPIDL_MODULE = "remote" +XPIDL_SOURCES += ["nsIRemoteAgent.idl"] + with Files("**"): BUG_COMPONENT = ("Remote Protocol", "Agent") with Files("domains/**/Emulation.jsm"): diff --git a/remote/nsIRemoteAgent.idl b/remote/nsIRemoteAgent.idl new file mode 100644 index 000000000000..7e26ea959a54 --- /dev/null +++ b/remote/nsIRemoteAgent.idl @@ -0,0 +1,44 @@ +/* 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/. */ + +#include "nsISupports.idl" + +/** + * The Gecko remote agent is an RPC subsystem that exposes + * browser-internal interfaces and services to the surrounding + * system. + * + * Consumers, whether remote or browser-local, can interface with + * the browser through an assorted set of services ranging from + * document introspection and script evaluation, to instrumentation, + * user interaction simulation, and event subscription. + */ +[scriptable, uuid(8f685a9d-8181-46d6-a71d-869289099c6d)] +interface nsIRemoteAgent : nsISupports +{ + /** + * Whether the remote agent is currently listening for new, + * incoming connections. + */ + readonly attribute boolean listening; + + /** + * Asynchronously starts the remote agent, and listens for new + * connections. + * + * The address must be a fully qualified URL that uses the "http://" + * scheme, and can optionally include a desired port. If no port + * is chosen, the default port 9222 is used. + * + * If the requested port is 0, the system will atomically allocate + * a port. + * + * A "remote-listening" system observer notification with the URL + * of the main target's WebSocket will be emitted once listening. + */ + void listen(in AString aURL); + + /** Stops listening and drops existing connections. */ + void close(); +};