Created
September 30, 2019 14:23
-
-
Save andreastt/96629f383c853cf8d61d89aa7ca8cf76 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/remote/RemoteAgent.jsm b/remote/RemoteAgent.jsm | |
index a87000c6c644..a9d561958b1e 100644 | |
--- a/remote/RemoteAgent.jsm | |
+++ b/remote/RemoteAgent.jsm | |
@@ -223,7 +223,10 @@ class RemoteAgentClass { | |
// XPCOM | |
get QueryInterface() { | |
- return ChromeUtils.generateQI([Ci.nsICommandLineHandler]); | |
+ return ChromeUtils.generateQI([ | |
+ Ci.nsICommandLineHandler, | |
+ Ci.nsIRemoteAgent, | |
+ ]); | |
} | |
} | |
diff --git a/remote/RemoteAgent.conf b/remote/components.conf | |
similarity index 90% | |
rename from remote/RemoteAgent.conf | |
rename to remote/components.conf | |
index d4dbc1dd5a68..8e9c7f8213c4 100644 | |
--- a/remote/RemoteAgent.conf | |
+++ b/remote/components.conf | |
@@ -6,7 +6,7 @@ | |
Classes = [ | |
{ | |
- 'cid': '{8f685a9d-8181-46d6-a71d-869289099c6d}', | |
+ 'cid': '{799bce21-98ab-45f5-92f4-d93e1298285b}', | |
'contract_ids': ['@mozilla.org/remote/agent'], | |
'jsm': 'chrome://remote/content/RemoteAgent.jsm', | |
'constructor': 'RemoteAgentFactory', | |
diff --git a/remote/moz.build b/remote/moz.build | |
index 7e0fcbf39980..b37adad2c6db 100644 | |
--- a/remote/moz.build | |
+++ b/remote/moz.build | |
@@ -6,12 +6,12 @@ DIRS += [ | |
"test", | |
] | |
-XPCOM_MANIFESTS += [ | |
- "RemoteAgent.conf", | |
-] | |
- | |
+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..59ab7daa977a | |
--- /dev/null | |
+++ b/remote/nsIRemoteAgent.idl | |
@@ -0,0 +1,51 @@ | |
+/* 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" | |
+ | |
+interface nsIURI; | |
+ | |
+%{C++ | |
+#define NS_REMOTEAGENT_CONTRACTID "@mozilla.org/remote/agent" | |
+%} | |
+ | |
+[scriptable, uuid(799bce21-98ab-45f5-92f4-d93e1298285b)] | |
+interface nsIRemoteAgent : nsISupports | |
+{ | |
+ /** | |
+ * Whether the remote agent is currently listening for new, | |
+ * incoming connections. | |
+ */ | |
+ readonly attribute boolean listening; | |
+ | |
+ /** | |
+ * Starts the remote agent, and listens for new connections. | |
+ * | |
+ * The address must use "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 which can later be read back using nsIRemoteAgent.port. | |
+ */ | |
+ void listen(in nsIURI aAddress); | |
+ | |
+ /** Stops listening and drops existing connections. */ | |
+ void close(); | |
+ | |
+ /** The network scheme used by the current connection. */ | |
+ readonly attribute AString scheme; | |
+ | |
+ /** The hostname the listener is currently bound to. */ | |
+ readonly attribute AString host; | |
+ | |
+ /** The port the listener is currently listening on. */ | |
+ readonly attribute long port; | |
+}; | |
+ | |
+/* | |
+#define NS_REMOTE_AGENT_CID \ | |
+ { 0x799bce21, 0x98ab, 0x45f5, \ | |
+ { 0x92, 0xf4, 0xd9, 0x3e, 0x12, 0x98, 0x28, 0x5b } } | |
+*/ | |
diff --git a/xpcom/build/Services.py b/xpcom/build/Services.py | |
index 9e5f0abaf67c..1ede4717a2ee 100644 | |
--- a/xpcom/build/Services.py | |
+++ b/xpcom/build/Services.py | |
@@ -55,6 +55,8 @@ service('Bits', 'nsIBits', | |
# NB: this should also expose nsIXULAppInfo, as does Services.jsm. | |
service('AppInfoService', 'nsIXULRuntime', | |
"@mozilla.org/xre/app-info;1") | |
+service('RemoteAgent', 'nsIRemoteAgent', | |
+ "@mozilla.org/remote/agent") | |
# The definition file needs access to the definitions of the particular | |
# interfaces. If you add a new interface here, make sure the necessary includes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment