bug 1606818: remote: use nsIHttpServer for unregistering handler r=remote-protocol-reviewers,whimboo

nsIHttpServer.registerPathHandler() is designed to take null as
the second argument to unregister path handlers.  This saves us
from having to modify its internal state, and fixes a minor TODO
in the remote agent initialisation code.

Differential Revision: https://phabricator.services.mozilla.com/D58605

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andreas Tolfsen 2020-01-03 16:19:33 +00:00
parent 4ff0799afe
commit 9444fa34c7

View File

@ -76,9 +76,7 @@ class RemoteAgentClass {
this.server.registerPathHandler(target.path, target);
});
this.targets.on("target-destroyed", (eventName, target) => {
// TODO: removes the entry added by registerPathHandler,
// but we should instead have nsIHttpServer.unregisterPathHandler
delete this.server._handler._overridePaths[target.path];
this.server.registerPathHandler(target.path, null);
});
return this.asyncListen(host, port);