Bug 1699111 - [devtools] Rename DevToolsClient._closed to _transportClosed. r=jdescottes

This better highlight that may only be the transport that is closed and not the whole client.
But at the end, both should follow the same lifecycle and be destroyed altogether.

Differential Revision: https://phabricator.services.mozilla.com/D108813
This commit is contained in:
Alexandre Poirot 2021-04-13 13:44:24 +00:00
parent abc7e431f7
commit f9fa5abc56
4 changed files with 7 additions and 7 deletions

View File

@ -166,7 +166,7 @@ class ClientWrapper {
}
isClosed() {
return this.client._closed;
return this.client._transportClosed;
}
// This method will be mocked to return a dummy URL during mochitests

View File

@ -113,7 +113,7 @@ DevToolsClient.prototype = {
* Resolves after the underlying transport is closed.
*/
close() {
if (this._closed) {
if (this._transportClosed) {
return Promise.resolve();
}
if (this._closePromise) {
@ -213,7 +213,7 @@ DevToolsClient.prototype = {
return onResponse(response) || response;
};
if (this._closed) {
if (this._transportClosed) {
const msg =
"'" +
type +
@ -589,10 +589,10 @@ DevToolsClient.prototype = {
* the stream.
*/
onTransportClosed() {
if (this._closed) {
if (this._transportClosed) {
return;
}
this._closed = true;
this._transportClosed = true;
this.emit("closed");
this.purgeRequests();

View File

@ -48,5 +48,5 @@ add_task(async function() {
const { client } = toolbox.target;
await toolbox.destroy();
ok(client._closed, "The client is closed after closing the toolbox");
ok(client._transportClosed, "The client is closed after closing the toolbox");
});

View File

@ -131,7 +131,7 @@ class RemoteClientManager {
*/
_onClientClosed() {
const closedClientKeys = [...this._clients.keys()].filter(key => {
return this._clients.get(key)._closed;
return this._clients.get(key)._transportClosed;
});
for (const key of closedClientKeys) {