Remote Agent interface needs to specify a Promise as return value for listen() and close()
Categories
(Remote Protocol :: Agent, defect, P3)
Tracking
(Not tracked)
People
(Reporter: whimboo, Unassigned)
References
(Depends on 1 open bug)
Details
As of now the Remote Agent idl interface definition specifies void
as return type for both the listen()
and close()
methods:
https://searchfox.org/mozilla-central/source/remote/nsIRemoteAgent.idl
But those are actually asynchronous and return a Promise:
As result when working with an instance of the Remote Agent like the following, the call to listen()
returns too early, while the HTTPd server hasn't been fully initialized and the primaryHost
and primaryPort
of this.server.identity
hasn't been set yet.
const agent = Cc["@mozilla.org/remote/agent;1"].createInstance(Ci.nsIRemoteAgent);
agent.listen("http://localhost:9222");
agent.debuggerAddress;
Sadly we cannot make use of Promises because they are not yet supported in rust-xpcom bindings (bug 1512319).
As such both host
and port
properties on the Remote Agent interface have to use the private properties on the HTTPServer instead of those from the identity.
The other option would be to kill the Rust code and only having the component implemented in JS. But there we would have to update Puppeteer first to also start Marionette, and retrieve the websocketURL
via the debuggerAddress
capability.
Reporter | ||
Comment 1•1 year ago
|
||
Since bug 1719505 has been fixed the listen()
and close()
methods are no longer available via the nsIRemoteAgent interface.
Description
•