зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1497457 - Remove transportDetails from runtimeDetails;r=daisuke,ladybenko
Depends on D12095. Now that we pass a remoteId to open about:devtools-toolbox, we actually don't need transportDetails Differential Revision: https://phabricator.services.mozilla.com/D12097 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
f4b238c47e
Коммит
61a987ed24
|
@ -71,7 +71,7 @@ function connectRuntime(id) {
|
|||
dispatch({ type: CONNECT_RUNTIME_START });
|
||||
try {
|
||||
const runtime = findRuntimeById(id, getState().runtimes);
|
||||
const { clientWrapper, transportDetails } = await createClientForRuntime(runtime);
|
||||
const clientWrapper = await createClientForRuntime(runtime);
|
||||
const info = await getRuntimeInfo(runtime, clientWrapper);
|
||||
|
||||
const promptPrefName = RUNTIME_PREFERENCE.CONNECTION_PROMPT;
|
||||
|
@ -80,7 +80,6 @@ function connectRuntime(id) {
|
|||
clientWrapper,
|
||||
connectionPromptEnabled,
|
||||
info,
|
||||
transportDetails,
|
||||
};
|
||||
|
||||
if (runtime.type === RUNTIMES.USB) {
|
||||
|
|
|
@ -18,15 +18,14 @@ async function createLocalClient() {
|
|||
DebuggerServer.registerAllActors();
|
||||
const client = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
await client.connect();
|
||||
return { clientWrapper: new ClientWrapper(client) };
|
||||
return new ClientWrapper(client);
|
||||
}
|
||||
|
||||
async function createNetworkClient(host, port) {
|
||||
const transportDetails = { host, port };
|
||||
const transport = await DebuggerClient.socketConnect(transportDetails);
|
||||
const transport = await DebuggerClient.socketConnect({ host, port });
|
||||
const client = new DebuggerClient(transport);
|
||||
await client.connect();
|
||||
return { clientWrapper: new ClientWrapper(client), transportDetails };
|
||||
return new ClientWrapper(client);
|
||||
}
|
||||
|
||||
async function createUSBClient(socketPath) {
|
||||
|
@ -40,8 +39,8 @@ async function createClientForRuntime(runtime) {
|
|||
if (type === RUNTIMES.THIS_FIREFOX) {
|
||||
return createLocalClient();
|
||||
} else if (remoteClientManager.hasClient(id, type)) {
|
||||
const { client, transportDetails } = remoteClientManager.getClient(id, type);
|
||||
return { clientWrapper: new ClientWrapper(client), transportDetails };
|
||||
const client = remoteClientManager.getClient(id, type);
|
||||
return new ClientWrapper(client);
|
||||
} else if (type === RUNTIMES.NETWORK) {
|
||||
const { host, port } = extra.connectionParameters;
|
||||
return createNetworkClient(host, port);
|
||||
|
|
|
@ -74,10 +74,7 @@ function runtimesReducer(state = RuntimesState(), action) {
|
|||
switch (action.type) {
|
||||
case CONNECT_RUNTIME_SUCCESS: {
|
||||
const { id, runtimeDetails, type } = action.runtime;
|
||||
remoteClientManager.setClient(id, type, {
|
||||
client: runtimeDetails.clientWrapper.client,
|
||||
transportDetails: runtimeDetails.transportDetails,
|
||||
});
|
||||
remoteClientManager.setClient(id, type, runtimeDetails.clientWrapper.client);
|
||||
return _updateRuntimeById(id, { runtimeDetails }, state);
|
||||
}
|
||||
|
||||
|
|
|
@ -22,14 +22,6 @@ const runtimeInfo = {
|
|||
version: PropTypes.string.isRequired,
|
||||
};
|
||||
|
||||
const runtimeTransportDetails = {
|
||||
// host name of tcp connection to debugger server
|
||||
host: PropTypes.string.isRequired,
|
||||
|
||||
// port number of tcp connection to debugger server
|
||||
port: PropTypes.number.isRequired,
|
||||
};
|
||||
|
||||
const runtimeDetails = {
|
||||
// ClientWrapper built using a DebuggerClient for the runtime
|
||||
clientWrapper: PropTypes.instanceOf(ClientWrapper).isRequired,
|
||||
|
@ -39,10 +31,6 @@ const runtimeDetails = {
|
|||
|
||||
// runtime information
|
||||
info: PropTypes.shape(runtimeInfo).isRequired,
|
||||
|
||||
// tcp connection information,
|
||||
// unavailable on this-firefox runtime
|
||||
transportDetails: PropTypes.shape(runtimeTransportDetails),
|
||||
};
|
||||
|
||||
const networkRuntimeConnectionParameter = {
|
||||
|
|
|
@ -59,7 +59,7 @@ function setupThisFirefoxMock() {
|
|||
runtimeClientFactoryMock.createClientForRuntime = runtime => {
|
||||
const { RUNTIMES } = require("devtools/client/aboutdebugging-new/src/constants");
|
||||
if (runtime.id === RUNTIMES.THIS_FIREFOX) {
|
||||
return { clientWrapper: thisFirefoxClient };
|
||||
return thisFirefoxClient;
|
||||
}
|
||||
throw new Error("Unexpected runtime id " + runtime.id);
|
||||
};
|
||||
|
|
|
@ -23,7 +23,7 @@ add_task(async function() {
|
|||
runtimeClientFactoryMock.createClientForRuntime = runtime => {
|
||||
const { RUNTIMES } = require("devtools/client/aboutdebugging-new/src/constants");
|
||||
if (runtime.id === RUNTIMES.THIS_FIREFOX) {
|
||||
return { clientWrapper: thisFirefoxClient };
|
||||
return thisFirefoxClient;
|
||||
}
|
||||
throw new Error("Unexpected runtime id " + runtime.id);
|
||||
};
|
||||
|
|
|
@ -41,7 +41,7 @@ class UsbMocks {
|
|||
this.runtimeClientFactoryMock = createRuntimeClientFactoryMock();
|
||||
this._clients = {};
|
||||
this.runtimeClientFactoryMock.createClientForRuntime = runtime => {
|
||||
return { clientWrapper: this._clients[runtime.id] };
|
||||
return this._clients[runtime.id];
|
||||
};
|
||||
|
||||
// Add a client for THIS_FIREFOX, since about:debugging will start on the This Firefox
|
||||
|
|
|
@ -138,7 +138,7 @@ async function clientFromURL(url) {
|
|||
// If a remote id was provided we should already have a connected client available.
|
||||
const remoteId = params.get("remoteId");
|
||||
if (remoteId) {
|
||||
return remoteClientManager.getClientByRemoteId(remoteId).client;
|
||||
return remoteClientManager.getClientByRemoteId(remoteId);
|
||||
}
|
||||
|
||||
const host = params.get("host");
|
||||
|
|
|
@ -21,14 +21,11 @@ class RemoteClientManager {
|
|||
* Remote runtime id (see devtools/client/aboutdebugging-new/src/types).
|
||||
* @param {String} type
|
||||
* Remote runtime type (see devtools/client/aboutdebugging-new/src/types).
|
||||
* @param {Object}
|
||||
* - client: {DebuggerClient}
|
||||
* - transportDetails: {Object} typically a host object ({hostname, port}) that
|
||||
* allows consumers to easily find the connection information for this client.
|
||||
* @param {DebuggerClient} client
|
||||
*/
|
||||
setClient(id, type, { client, transportDetails }) {
|
||||
setClient(id, type, client) {
|
||||
const key = this._getKey(id, type);
|
||||
this._clients.set(key, { client, transportDetails });
|
||||
this._clients.set(key, client);
|
||||
client.addOneTimeListener("closed", this._onClientClosed);
|
||||
}
|
||||
|
||||
|
@ -76,7 +73,7 @@ class RemoteClientManager {
|
|||
}
|
||||
|
||||
_removeClientByKey(key) {
|
||||
const client = this._clients.get(key).client;
|
||||
const client = this._clients.get(key);
|
||||
if (client) {
|
||||
client.removeListener("closed", this._onClientClosed);
|
||||
this._clients.delete(key);
|
||||
|
@ -88,8 +85,7 @@ class RemoteClientManager {
|
|||
*/
|
||||
_onClientClosed() {
|
||||
const closedClientKeys = [...this._clients.keys()].filter(key => {
|
||||
const clientInfo = this._clients.get(key);
|
||||
return clientInfo.client._closed;
|
||||
return this._clients.get(key)._closed;
|
||||
});
|
||||
|
||||
for (const key of closedClientKeys) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче