diff --git a/devtools/client/aboutdebugging-new/src/actions/debug-targets.js b/devtools/client/aboutdebugging-new/src/actions/debug-targets.js index e758916297ae..6e6cd6664971 100644 --- a/devtools/client/aboutdebugging-new/src/actions/debug-targets.js +++ b/devtools/client/aboutdebugging-new/src/actions/debug-targets.js @@ -36,13 +36,13 @@ const { function inspectDebugTarget(type, id) { return async (_, getState) => { const runtime = getCurrentRuntime(getState().runtimes); - const { connection, type: runtimeType } = runtime; + const { runtimeDetails, type: runtimeType } = runtime; switch (type) { case DEBUG_TARGETS.TAB: { // Open tab debugger in new window. if (runtimeType === RUNTIMES.NETWORK || runtimeType === RUNTIMES.USB) { - const { host, port } = connection.transportDetails; + const { host, port } = runtimeDetails.transportDetails; window.open(`about:devtools-toolbox?type=tab&id=${id}` + `&host=${host}&port=${port}`); } else if (runtimeType === RUNTIMES.THIS_FIREFOX) { @@ -52,7 +52,7 @@ function inspectDebugTarget(type, id) { } case DEBUG_TARGETS.EXTENSION: { if (runtimeType === RUNTIMES.NETWORK) { - await debugRemoteAddon(id, connection.client); + await debugRemoteAddon(id, runtimeDetails.client); } else if (runtimeType === RUNTIMES.THIS_FIREFOX) { debugLocalAddon(id); } @@ -60,7 +60,7 @@ function inspectDebugTarget(type, id) { } case DEBUG_TARGETS.WORKER: { // Open worker toolbox in new window. - gDevToolsBrowser.openWorkerToolbox(connection.client, id); + gDevToolsBrowser.openWorkerToolbox(runtimeDetails.client, id); break; } diff --git a/devtools/client/aboutdebugging-new/src/actions/runtimes.js b/devtools/client/aboutdebugging-new/src/actions/runtimes.js index 8c020a103006..f1e3323af284 100644 --- a/devtools/client/aboutdebugging-new/src/actions/runtimes.js +++ b/devtools/client/aboutdebugging-new/src/actions/runtimes.js @@ -103,13 +103,13 @@ function connectRuntime(id) { const preferenceFront = await client.mainRoot.getFront("preference"); const connectionPromptEnabled = await preferenceFront.getBoolPref(RUNTIME_PREFERENCE.CONNECTION_PROMPT); - const connection = { connectionPromptEnabled, client, info, transportDetails }; + const runtimeDetails = { connectionPromptEnabled, client, info, transportDetails }; dispatch({ type: CONNECT_RUNTIME_SUCCESS, runtime: { id, - connection, + runtimeDetails, type: runtime.type, }, }); @@ -124,7 +124,7 @@ function disconnectRuntime(id) { dispatch({ type: DISCONNECT_RUNTIME_START }); try { const runtime = findRuntimeById(id, getState().runtimes); - const client = runtime.connection.client; + const client = runtime.runtimeDetails.client; await client.close(); DebuggerServer.destroy(); @@ -147,7 +147,7 @@ function updateConnectionPromptSetting(connectionPromptEnabled) { dispatch({ type: UPDATE_CONNECTION_PROMPT_SETTING_START }); try { const runtime = getCurrentRuntime(getState().runtimes); - const client = runtime.connection.client; + const client = runtime.runtimeDetails.client; const preferenceFront = await client.mainRoot.getFront("preference"); await preferenceFront.setBoolPref(RUNTIME_PREFERENCE.CONNECTION_PROMPT, connectionPromptEnabled); diff --git a/devtools/client/aboutdebugging-new/src/components/sidebar/Sidebar.js b/devtools/client/aboutdebugging-new/src/components/sidebar/Sidebar.js index 07138e0ca89d..55edcd2eabce 100644 --- a/devtools/client/aboutdebugging-new/src/components/sidebar/Sidebar.js +++ b/devtools/client/aboutdebugging-new/src/components/sidebar/Sidebar.js @@ -76,14 +76,14 @@ class Sidebar extends PureComponent { return runtimes.map(runtime => { const pageId = runtime.type + "-" + runtime.id; - const runtimeHasConnection = !!runtime.connection; + const runtimeHasDetails = !!runtime.runtimeDetails; return SidebarRuntimeItem({ id: pageId, deviceName: runtime.extra.deviceName, dispatch, icon, - isConnected: runtimeHasConnection, + isConnected: runtimeHasDetails, isSelected: selectedPage === pageId, key: pageId, name: runtime.name, diff --git a/devtools/client/aboutdebugging-new/src/middleware/debug-target-listener.js b/devtools/client/aboutdebugging-new/src/middleware/debug-target-listener.js index 82192e39505b..04b0762943c0 100644 --- a/devtools/client/aboutdebugging-new/src/middleware/debug-target-listener.js +++ b/devtools/client/aboutdebugging-new/src/middleware/debug-target-listener.js @@ -54,7 +54,7 @@ function debugTargetListenerMiddleware(store) { return next => action => { switch (action.type) { case WATCH_RUNTIME_SUCCESS: { - const { client } = action.runtime.connection; + const { client } = action.runtime.runtimeDetails; client.addListener("tabListChanged", onTabsUpdated); AddonManager.addAddonListener(extensionsListener); client.addListener("workerListChanged", onWorkersUpdated); @@ -65,7 +65,7 @@ function debugTargetListenerMiddleware(store) { break; } case UNWATCH_RUNTIME_START: { - const { client } = action.runtime.connection; + const { client } = action.runtime.runtimeDetails; client.removeListener("tabListChanged", onTabsUpdated); AddonManager.removeAddonListener(extensionsListener); client.removeListener("workerListChanged", onWorkersUpdated); diff --git a/devtools/client/aboutdebugging-new/src/modules/runtimes-state-helper.js b/devtools/client/aboutdebugging-new/src/modules/runtimes-state-helper.js index adfe2a4e1c07..b2e49143fe6e 100644 --- a/devtools/client/aboutdebugging-new/src/modules/runtimes-state-helper.js +++ b/devtools/client/aboutdebugging-new/src/modules/runtimes-state-helper.js @@ -11,20 +11,20 @@ function getCurrentRuntime(runtimesState) { exports.getCurrentRuntime = getCurrentRuntime; function getCurrentClient(runtimesState) { - const connection = getCurrentConnection(runtimesState); - return connection ? connection.client : null; + const runtimeDetails = getCurrentRuntimeDetails(runtimesState); + return runtimeDetails ? runtimeDetails.client : null; } exports.getCurrentClient = getCurrentClient; function getCurrentRuntimeInfo(runtimesState) { - const connection = getCurrentConnection(runtimesState); - return connection ? connection.info : null; + const runtimeDetails = getCurrentRuntimeDetails(runtimesState); + return runtimeDetails ? runtimeDetails.info : null; } exports.getCurrentRuntimeInfo = getCurrentRuntimeInfo; function getCurrentConnectionPromptSetting(runtimesState) { - const connection = getCurrentConnection(runtimesState); - return connection ? connection.connectionPromptEnabled : false; + const runtimeDetails = getCurrentRuntimeDetails(runtimesState); + return runtimeDetails ? runtimeDetails.connectionPromptEnabled : false; } exports.getCurrentConnectionPromptSetting = getCurrentConnectionPromptSetting; @@ -38,7 +38,7 @@ function findRuntimeById(id, runtimesState) { } exports.findRuntimeById = findRuntimeById; -function getCurrentConnection(runtimesState) { +function getCurrentRuntimeDetails(runtimesState) { const runtime = getCurrentRuntime(runtimesState); - return runtime ? runtime.connection : null; + return runtime ? runtime.runtimeDetails : null; } diff --git a/devtools/client/aboutdebugging-new/src/reducers/runtimes-state.js b/devtools/client/aboutdebugging-new/src/reducers/runtimes-state.js index 61c91b5f6747..4d7eed1e04a7 100644 --- a/devtools/client/aboutdebugging-new/src/reducers/runtimes-state.js +++ b/devtools/client/aboutdebugging-new/src/reducers/runtimes-state.js @@ -70,13 +70,13 @@ function _updateRuntimeById(runtimeId, updatedRuntime, state) { function runtimesReducer(state = RuntimesState(), action) { switch (action.type) { case CONNECT_RUNTIME_SUCCESS: { - const { id, connection } = action.runtime; - return _updateRuntimeById(id, { connection }, state); + const { id, runtimeDetails } = action.runtime; + return _updateRuntimeById(id, { runtimeDetails }, state); } case DISCONNECT_RUNTIME_SUCCESS: { const { id } = action.runtime; - return _updateRuntimeById(id, { connection: null }, state); + return _updateRuntimeById(id, { runtimeDetails: null }, state); } case NETWORK_LOCATIONS_UPDATED: { @@ -103,9 +103,9 @@ function runtimesReducer(state = RuntimesState(), action) { const { connectionPromptEnabled } = action; const { id: runtimeId } = action.runtime; const runtime = findRuntimeById(runtimeId, state); - const connection = - Object.assign({}, runtime.connection, { connectionPromptEnabled }); - return _updateRuntimeById(runtimeId, { connection }, state); + const runtimeDetails = + Object.assign({}, runtime.runtimeDetails, { connectionPromptEnabled }); + return _updateRuntimeById(runtimeId, { runtimeDetails }, state); } case USB_RUNTIMES_UPDATED: { diff --git a/devtools/client/aboutdebugging-new/src/types.js b/devtools/client/aboutdebugging-new/src/types.js index 60b555a5a80f..b845ad67bc90 100644 --- a/devtools/client/aboutdebugging-new/src/types.js +++ b/devtools/client/aboutdebugging-new/src/types.js @@ -29,7 +29,7 @@ const runtimeTransportDetails = { port: PropTypes.number.isRequired, }; -const runtimeConnection = { +const runtimeDetails = { // debugger client instance client: PropTypes.object.isRequired, @@ -73,7 +73,7 @@ const runtime = { id: PropTypes.string.isRequired, // available after the connection to the runtime is established - connection: PropTypes.shape(runtimeConnection), + runtimeDetails: PropTypes.shape(runtimeDetails), // object containing non standard properties that depend on the runtime type, // unavailable on this-firefox runtime