mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
bug 1543115: remote: make RemoteAgent.listen() accept strings; r=remote-protocol-reviewers,maja_zf
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
This commit is contained in:
parent
e29e510bb0
commit
e02175a9ab
@ -36,7 +36,7 @@ class RemoteAgentClass {
|
||||
return !!this.server && !this.server.isStopped();
|
||||
}
|
||||
|
||||
async listen(address) {
|
||||
async listen(url) {
|
||||
if (!Preferences.get(ENABLED, false)) {
|
||||
throw new Error("Remote agent is disabled by preference");
|
||||
}
|
||||
@ -46,11 +46,11 @@ class RemoteAgentClass {
|
||||
);
|
||||
}
|
||||
|
||||
if (!(address instanceof Ci.nsIURI)) {
|
||||
throw new TypeError(`Expected nsIURI: ${address}`);
|
||||
if (!(url instanceof Ci.nsIURI)) {
|
||||
url = Services.io.newURI(url);
|
||||
}
|
||||
|
||||
let { host, port } = address;
|
||||
let { host, port } = url;
|
||||
if (Preferences.get(FORCE_LOCAL) && !LOOPBACKS.includes(host)) {
|
||||
throw new Error("Restricted to loopback devices");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user