Closed Bug 1675471 Opened 4 years ago Closed 1 year ago

Remote Agent interface needs to specify a Promise as return value for listen() and close()

Categories

(Remote Protocol :: Agent, defect, P3)

defect

Tracking

(Not tracked)

RESOLVED INVALID

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:

https://searchfox.org/mozilla-central/rev/c938c7416c633639a5c8ce4412be586eefb48005/remote/RemoteAgent.jsm#34-130

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.

Blocks: 1691081

Since bug 1719505 has been fixed the listen() and close() methods are no longer available via the nsIRemoteAgent interface.

Status: NEW → RESOLVED
Closed: 1 year ago
Resolution: --- → INVALID
See Also: → 1719505
You need to log in before you can comment on or make changes to this bug.