Backed out 4 changesets (bug 1515612) for ESlint error on runtimes.js. CLOSED TREE
authorCosmin Sabou <csabou@mozilla.com>
Wed, 09 Jan 2019 19:58:28 +0200
changeset 510227 5d5c62405e28ac0cc173f556834f68451ec3f6eb
parent 510226 7e107869b00d7ccc5051809d6839be6e98cc4165
child 510228 292cf0b8d5c8b94187f641ea191c8e0067d7353f
push id10547
push userffxbld-merge
push dateMon, 21 Jan 2019 13:03:58 +0000
treeherdermozilla-beta@24ec1916bffe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1515612
milestone66.0a1
backs out5345e8472f29cd844c8218b50051c01f8aa12aee
552427e973d5556a4666f86974f4793af42c97d8
97b28c1b8a8595a7e47dc671432ef3d7b3ea8770
eee3227176bb9078ad72a8009fd8e6ec181d273c
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out 4 changesets (bug 1515612) for ESlint error on runtimes.js. CLOSED TREE Backed out changeset 5345e8472f29 (bug 1515612) Backed out changeset 552427e973d5 (bug 1515612) Backed out changeset 97b28c1b8a85 (bug 1515612) Backed out changeset eee3227176bb (bug 1515612)
devtools/client/aboutdebugging-new/src/actions/runtimes.js
devtools/client/aboutdebugging-new/src/actions/ui.js
devtools/client/aboutdebugging-new/src/components/App.js
devtools/client/aboutdebugging-new/src/constants.js
devtools/client/aboutdebugging-new/src/modules/client-wrapper.js
devtools/client/aboutdebugging-new/src/reducers/ui-state.js
devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_runtime_usbclient_closed.js
devtools/client/aboutdebugging-new/test/browser/mocks/helper-client-wrapper-mock.js
--- a/devtools/client/aboutdebugging-new/src/actions/runtimes.js
+++ b/devtools/client/aboutdebugging-new/src/actions/runtimes.js
@@ -21,17 +21,16 @@ const { remoteClientManager } =
 const {
   CONNECT_RUNTIME_FAILURE,
   CONNECT_RUNTIME_START,
   CONNECT_RUNTIME_SUCCESS,
   DEBUG_TARGETS,
   DISCONNECT_RUNTIME_FAILURE,
   DISCONNECT_RUNTIME_START,
   DISCONNECT_RUNTIME_SUCCESS,
-  PAGE_TYPES,
   REMOTE_RUNTIMES_UPDATED,
   RUNTIME_PREFERENCE,
   RUNTIMES,
   UNWATCH_RUNTIME_FAILURE,
   UNWATCH_RUNTIME_START,
   UNWATCH_RUNTIME_SUCCESS,
   UPDATE_CONNECTION_PROMPT_SETTING_FAILURE,
   UPDATE_CONNECTION_PROMPT_SETTING_START,
@@ -58,19 +57,21 @@ async function getRuntimeInfo(runtime, c
     icon,
     isMultiE10s,
     name,
     type,
     version,
   };
 }
 
-function onRemoteDebuggerClientClosed() {
-  window.AboutDebugging.onNetworkLocationsUpdated();
-  window.AboutDebugging.onUSBRuntimesUpdated();
+function onUSBDebuggerClientClosed() {
+  // After scanUSBRuntimes action, updateUSBRuntimes action is called.
+  // The closed runtime will be unwatched and disconnected explicitly in the action
+  // if needed.
+  window.AboutDebugging.store.dispatch(Actions.scanUSBRuntimes());
 }
 
 function onMultiE10sUpdated() {
   window.AboutDebugging.store.dispatch(updateMultiE10s());
 }
 
 function connectRuntime(id) {
   return async (dispatch, getState) => {
@@ -93,20 +94,20 @@ function connectRuntime(id) {
 
       clientWrapper.addListener("closed", onUSBDebuggerClientClosed);
 
       const deviceFront = await clientWrapper.getFront("device");
       if (deviceFront) {
         deviceFront.on("multi-e10s-updated", onMultiE10sUpdated);
       }
 
-      if (runtime.type !== RUNTIMES.THIS_FIREFOX) {
+      if (runtime.type === RUNTIMES.USB) {
         // `closed` event will be emitted when disabling remote debugging
-        // on the connected remote runtime.
-        clientWrapper.addOneTimeListener("closed", onRemoteDebuggerClientClosed);
+        // on the connected USB runtime.
+        clientWrapper.addOneTimeListener("closed", onUSBDebuggerClientClosed);
       }
 
       dispatch({
         type: CONNECT_RUNTIME_SUCCESS,
         runtime: {
           id,
           runtimeDetails,
           type: runtime.type,
@@ -125,18 +126,18 @@ function disconnectRuntime(id) {
       const runtime = findRuntimeById(id, getState().runtimes);
       const { clientWrapper } = runtime.runtimeDetails;
 
       const deviceFront = await clientWrapper.getFront("device");
       if (deviceFront) {
         deviceFront.off("multi-e10s-updated", onMultiE10sUpdated);
       }
 
-      if (runtime.type !== RUNTIMES.THIS_FIREFOX) {
-        clientWrapper.removeListener("closed", onRemoteDebuggerClientClosed);
+      if (runtime.type === RUNTIMES.USB) {
+        clientWrapper.removeListener("closed", onUSBDebuggerClientClosed);
       }
 
       await clientWrapper.close();
 
       dispatch({
         type: DISCONNECT_RUNTIME_SUCCESS,
         runtime: {
           id,
@@ -265,99 +266,84 @@ function updateUSBRuntimes(adbRuntimes) 
       isUnknown: adbRuntime.isUnknown(),
       name: adbRuntime.shortName,
       type: RUNTIMES.USB,
     };
   });
   return updateRemoteRuntimes(runtimes, RUNTIMES.USB);
 }
 
-/**
- * Check that a given runtime can still be found in the provided array of runtimes, and
- * that the connection of the associated DebuggerClient is still valid.
- * Note that this check is only valid for runtimes which match the type of the runtimes
- * in the array.
- */
-function _isRuntimeValid(runtime, runtimes) {
-  const isRuntimeAvailable = runtimes.some(r => r.id === runtime.id);
-  const isConnectionValid = runtime.runtimeDetails &&
-    !runtime.runtimeDetails.clientWrapper.isClosed();
-  return isRuntimeAvailable && isConnectionValid;
-}
-
 function updateRemoteRuntimes(runtimes, type) {
   return async (dispatch, getState) => {
     const currentRuntime = getCurrentRuntime(getState().runtimes);
 
-    // Check if the updated remote runtimes should trigger a navigation out of the current
-    // runtime page.
-    if (currentRuntime && currentRuntime.type === type &&
-      !_isRuntimeValid(currentRuntime, runtimes)) {
-      // Since current remote runtime is invalid, move to this firefox page.
+    if (currentRuntime &&
+        currentRuntime.type === type &&
+        !runtimes.find(runtime => currentRuntime.id === runtime.id)) {
+      // Since current USB runtime was invalid, move to this firefox page.
       // This case is considered as followings and so on:
       // * Remove ADB addon
       // * (Physically) Disconnect USB runtime
       //
-      // The reason we call selectPage before REMOTE_RUNTIMES_UPDATED is fired is below.
-      // Current runtime can not be retrieved after REMOTE_RUNTIMES_UPDATED action, since
-      // that updates runtime state. So, before that we fire selectPage action to execute
-      // `unwatchRuntime` correctly.
-      await dispatch(Actions.selectPage(PAGE_TYPES.RUNTIME, RUNTIMES.THIS_FIREFOX));
+      // The reason why we call selectPage before USB_RUNTIMES_UPDATED was fired is below.
+      // Current runtime can not be retrieved after USB_RUNTIMES_UPDATED action, since
+      // that updates runtime state. So, before that we fire selectPage action so that to
+      // transact unwatchRuntime correctly.
+
+      await dispatch(Actions.selectPage(RUNTIMES.THIS_FIREFOX, RUNTIMES.THIS_FIREFOX));
     }
 
     // Retrieve runtimeDetails from existing runtimes.
     runtimes.forEach(runtime => {
       const existingRuntime = findRuntimeById(runtime.id, getState().runtimes);
-      const isConnectionValid = existingRuntime && existingRuntime.runtimeDetails &&
-        !existingRuntime.runtimeDetails.clientWrapper.isClosed();
-      runtime.runtimeDetails = isConnectionValid ? existingRuntime.runtimeDetails : null;
+      runtime.runtimeDetails = existingRuntime ? existingRuntime.runtimeDetails : null;
     });
 
+    // Disconnect runtimes that were no longer valid
+    const validIds = runtimes.map(r => r.id);
     const existingRuntimes = getAllRuntimes(getState().runtimes);
-    for (const runtime of existingRuntimes) {
-      // Runtime was connected before.
-      const isConnected = runtime.runtimeDetails;
-      // Runtime is of the same type as the updated runtimes array, so we should check it.
-      const isSameType = runtime.type === type;
-      if (isConnected && isSameType && !_isRuntimeValid(runtime, runtimes)) {
-        // Disconnect runtimes that were no longer valid.
-        await dispatch(disconnectRuntime(runtime.id));
+    const invalidRuntimes = existingRuntimes.filter(r => {
+      return r.type === type && !validIds.includes(r.id);
+    });
+
+    for (const invalidRuntime of invalidRuntimes) {
+      const isConnected = !!invalidRuntime.runtimeDetails;
+      if (isConnected) {
+        await dispatch(disconnectRuntime(invalidRuntime.id));
       }
     }
 
     dispatch({ type: REMOTE_RUNTIMES_UPDATED, runtimes, runtimeType: type });
 
     for (const runtime of getAllRuntimes(getState().runtimes)) {
       if (runtime.type !== type) {
         continue;
       }
 
-      // Reconnect clients already available in the RemoteClientManager.
       const isConnected = !!runtime.runtimeDetails;
       const hasConnectedClient = remoteClientManager.hasClient(runtime.id, runtime.type);
       if (!isConnected && hasConnectedClient) {
         await dispatch(connectRuntime(runtime.id));
       }
     }
   };
 }
 
 /**
  * Remove all the listeners added on client objects. Since those objects are persisted
  * regardless of the about:debugging lifecycle, all the added events should be removed
  * before leaving about:debugging.
  */
 function removeRuntimeListeners() {
   return (dispatch, getState) => {
-    const allRuntimes = getAllRuntimes(getState().runtimes);
-    const remoteRuntimes = allRuntimes.filter(r => r.type !== RUNTIMES.THIS_FIREFOX);
-    for (const runtime of remoteRuntimes) {
+    const { usbRuntimes } = getState().runtimes;
+    for (const runtime of usbRuntimes) {
       if (runtime.runtimeDetails) {
         const { clientWrapper } = runtime.runtimeDetails;
-        clientWrapper.removeListener("closed", onRemoteDebuggerClientClosed);
+        clientWrapper.removeListener("closed", onUSBDebuggerClientClosed);
       }
     }
   };
 }
 
 module.exports = {
   connectRuntime,
   disconnectRuntime,
--- a/devtools/client/aboutdebugging-new/src/actions/ui.js
+++ b/devtools/client/aboutdebugging-new/src/actions/ui.js
@@ -9,65 +9,57 @@ const {
   ADB_ADDON_INSTALL_SUCCESS,
   ADB_ADDON_INSTALL_FAILURE,
   ADB_ADDON_UNINSTALL_START,
   ADB_ADDON_UNINSTALL_SUCCESS,
   ADB_ADDON_UNINSTALL_FAILURE,
   ADB_ADDON_STATUS_UPDATED,
   DEBUG_TARGET_COLLAPSIBILITY_UPDATED,
   NETWORK_LOCATIONS_UPDATED,
+  PAGE_SELECTED,
   PAGE_TYPES,
-  SELECT_PAGE_FAILURE,
-  SELECT_PAGE_START,
-  SELECT_PAGE_SUCCESS,
   USB_RUNTIMES_SCAN_START,
   USB_RUNTIMES_SCAN_SUCCESS,
 } = require("../constants");
 
 const NetworkLocationsModule = require("../modules/network-locations");
 const { adbAddon } = require("devtools/shared/adb/adb-addon");
 const { refreshUSBRuntimes } = require("../modules/usb-runtimes");
 
 const Actions = require("./index");
 
 function selectPage(page, runtimeId) {
   return async (dispatch, getState) => {
-    dispatch({ type: SELECT_PAGE_START });
-
-    try {
-      const isSamePage = (oldPage, newPage) => {
-        if (newPage === PAGE_TYPES.RUNTIME && oldPage === PAGE_TYPES.RUNTIME) {
-          return runtimeId === getState().runtimes.selectedRuntimeId;
-        }
-        return newPage === oldPage;
-      };
-
-      const currentPage = getState().ui.selectedPage;
-      // Nothing to dispatch if the page is the same as the current page, or
-      // if we are not providing any page.
-      // TODO: we should dispatch SELECT_PAGE_FAILURE if page is missing. See Bug 1518559.
-      if (!page || isSamePage(currentPage, page)) {
-        return;
+    const isSamePage = (oldPage, newPage) => {
+      if (newPage === PAGE_TYPES.RUNTIME && oldPage === PAGE_TYPES.RUNTIME) {
+        return runtimeId === getState().runtimes.selectedRuntimeId;
       }
+      return newPage === oldPage;
+    };
 
-      // Stop watching current runtime, if currently on a RUNTIME page.
-      if (currentPage === PAGE_TYPES.RUNTIME) {
-        const currentRuntimeId = getState().runtimes.selectedRuntimeId;
-        await dispatch(Actions.unwatchRuntime(currentRuntimeId));
-      }
+    const currentPage = getState().ui.selectedPage;
+    // Nothing to dispatch if the page is the same as the current page, or
+    // if we are not providing any page.
+    // Note: maybe we should have a PAGE_SELECTED_FAILURE action for proper logging
+    if (!page || isSamePage(currentPage, page)) {
+      return;
+    }
 
-      // Start watching current runtime, if moving to a RUNTIME page.
-      if (page === PAGE_TYPES.RUNTIME) {
-        await dispatch(Actions.watchRuntime(runtimeId));
-      }
+    // Stop watching current runtime, if currently on a RUNTIME page.
+    if (currentPage === PAGE_TYPES.RUNTIME) {
+      const currentRuntimeId = getState().runtimes.selectedRuntimeId;
+      await dispatch(Actions.unwatchRuntime(currentRuntimeId));
+    }
 
-      dispatch({ type: SELECT_PAGE_SUCCESS, page, runtimeId });
-    } catch (e) {
-      dispatch({ type: SELECT_PAGE_FAILURE, error: e });
+    // Start watching current runtime, if moving to a RUNTIME page.
+    if (page === PAGE_TYPES.RUNTIME) {
+      await dispatch(Actions.watchRuntime(runtimeId));
     }
+
+    dispatch({ type: PAGE_SELECTED, page, runtimeId });
   };
 }
 
 function updateDebugTargetCollapsibility(key, isCollapsed) {
   return { type: DEBUG_TARGET_COLLAPSIBILITY_UPDATED, key, isCollapsed };
 }
 
 function addNetworkLocation(location) {
--- a/devtools/client/aboutdebugging-new/src/components/App.js
+++ b/devtools/client/aboutdebugging-new/src/components/App.js
@@ -66,31 +66,30 @@ class App extends PureComponent {
   // We are using it to read the route path.
   // See react-router docs:
   // https://github.com/ReactTraining/react-router/blob/master/packages/react-router/docs/api/match.md
   renderRuntime({ match }) {
     // Redirect to This Firefox in these cases:
     // - If the runtimepage for a device is the first page shown (since we can't
     //   keep connections open between page reloads).
     // - If no runtimeId is given.
-    // - If runtime is not in the runtimes list or disconnected (this is handled later)
+    // - If runtime is not found in the runtimes list (this is handled later)
     const isDeviceFirstPage =
       !this.props.selectedPage &&
       match.params.runtimeId !== RUNTIMES.THIS_FIREFOX;
     if (!match.params.runtimeId || isDeviceFirstPage) {
       return Redirect({ to: `/runtime/${RUNTIMES.THIS_FIREFOX}` });
     }
 
     const isRuntimeAvailable = id => {
       const runtimes = [
         ...this.props.networkRuntimes,
         ...this.props.usbRuntimes,
       ];
-      const runtime = runtimes.find(x => x.id === id);
-      return runtime && runtime.runtimeDetails;
+      return !!runtimes.find(x => x.id === id);
     };
 
     const { dispatch } = this.props;
 
     let runtimeId = match.params.runtimeId || RUNTIMES.THIS_FIREFOX;
     if (match.params.runtimeId !== RUNTIMES.THIS_FIREFOX) {
       const rawId = decodeURIComponent(match.params.runtimeId);
       if (isRuntimeAvailable(rawId)) {
--- a/devtools/client/aboutdebugging-new/src/constants.js
+++ b/devtools/client/aboutdebugging-new/src/constants.js
@@ -15,29 +15,27 @@ const actionTypes = {
   CONNECT_RUNTIME_FAILURE: "CONNECT_RUNTIME_FAILURE",
   CONNECT_RUNTIME_START: "CONNECT_RUNTIME_START",
   CONNECT_RUNTIME_SUCCESS: "CONNECT_RUNTIME_SUCCESS",
   DEBUG_TARGET_COLLAPSIBILITY_UPDATED: "DEBUG_TARGET_COLLAPSIBILITY_UPDATED",
   DISCONNECT_RUNTIME_FAILURE: "DISCONNECT_RUNTIME_FAILURE",
   DISCONNECT_RUNTIME_START: "DISCONNECT_RUNTIME_START",
   DISCONNECT_RUNTIME_SUCCESS: "DISCONNECT_RUNTIME_SUCCESS",
   NETWORK_LOCATIONS_UPDATED: "NETWORK_LOCATIONS_UPDATED",
+  PAGE_SELECTED: "PAGE_SELECTED",
   REMOTE_RUNTIMES_UPDATED: "REMOTE_RUNTIMES_UPDATED",
   REQUEST_EXTENSIONS_FAILURE: "REQUEST_EXTENSIONS_FAILURE",
   REQUEST_EXTENSIONS_START: "REQUEST_EXTENSIONS_START",
   REQUEST_EXTENSIONS_SUCCESS: "REQUEST_EXTENSIONS_SUCCESS",
   REQUEST_TABS_FAILURE: "REQUEST_TABS_FAILURE",
   REQUEST_TABS_START: "REQUEST_TABS_START",
   REQUEST_TABS_SUCCESS: "REQUEST_TABS_SUCCESS",
   REQUEST_WORKERS_FAILURE: "REQUEST_WORKERS_FAILURE",
   REQUEST_WORKERS_START: "REQUEST_WORKERS_START",
   REQUEST_WORKERS_SUCCESS: "REQUEST_WORKERS_SUCCESS",
-  SELECT_PAGE_FAILURE: "SELECT_PAGE_FAILURE",
-  SELECT_PAGE_START: "SELECT_PAGE_START",
-  SELECT_PAGE_SUCCESS: "SELECT_PAGE_SUCCESS",
   TEMPORARY_EXTENSION_INSTALL_FAILURE: "TEMPORARY_EXTENSION_INSTALL_FAILURE",
   TEMPORARY_EXTENSION_INSTALL_START: "TEMPORARY_EXTENSION_INSTALL_START",
   TEMPORARY_EXTENSION_INSTALL_SUCCESS: "TEMPORARY_EXTENSION_INSTALL_SUCCESS",
   UNWATCH_RUNTIME_FAILURE: "UNWATCH_RUNTIME_FAILURE",
   UNWATCH_RUNTIME_START: "UNWATCH_RUNTIME_START",
   UNWATCH_RUNTIME_SUCCESS: "UNWATCH_RUNTIME_SUCCESS",
   UPDATE_CONNECTION_PROMPT_SETTING_FAILURE: "UPDATE_CONNECTION_PROMPT_SETTING_FAILURE",
   UPDATE_CONNECTION_PROMPT_SETTING_START: "UPDATE_CONNECTION_PROMPT_SETTING_START",
--- a/devtools/client/aboutdebugging-new/src/modules/client-wrapper.js
+++ b/devtools/client/aboutdebugging-new/src/modules/client-wrapper.js
@@ -133,15 +133,11 @@ class ClientWrapper {
 
   async request(options) {
     return this.client.request(options);
   }
 
   async close() {
     return this.client.close();
   }
-
-  isClosed() {
-    return this.client._closed;
-  }
 }
 
 exports.ClientWrapper = ClientWrapper;
--- a/devtools/client/aboutdebugging-new/src/reducers/ui-state.js
+++ b/devtools/client/aboutdebugging-new/src/reducers/ui-state.js
@@ -3,17 +3,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 const {
   ADB_ADDON_STATUS_UPDATED,
   DEBUG_TARGET_COLLAPSIBILITY_UPDATED,
   NETWORK_LOCATIONS_UPDATED,
-  SELECT_PAGE_SUCCESS,
+  PAGE_SELECTED,
   TEMPORARY_EXTENSION_INSTALL_FAILURE,
   TEMPORARY_EXTENSION_INSTALL_SUCCESS,
   USB_RUNTIMES_SCAN_START,
   USB_RUNTIMES_SCAN_SUCCESS,
 } = require("../constants");
 
 function UiState(locations = [], debugTargetCollapsibilities = {},
                  networkEnabled = false, wifiEnabled = false,
@@ -46,17 +46,17 @@ function uiReducer(state = UiState(), ac
       return Object.assign({}, state, { debugTargetCollapsibilities });
     }
 
     case NETWORK_LOCATIONS_UPDATED: {
       const { locations } = action;
       return Object.assign({}, state, { networkLocations: locations });
     }
 
-    case SELECT_PAGE_SUCCESS: {
+    case PAGE_SELECTED: {
       const { page, runtimeId } = action;
       return Object.assign({}, state,
         { selectedPage: page, selectedRuntime: runtimeId });
     }
 
     case USB_RUNTIMES_SCAN_START: {
       return Object.assign({}, state, { isScanningUsb: true });
     }
--- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_runtime_usbclient_closed.js
+++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_runtime_usbclient_closed.js
@@ -1,102 +1,41 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 /* import-globals-from helper-mocks.js */
 Services.scriptloader.loadSubScript(CHROME_URL_ROOT + "helper-mocks.js", this);
 
-const NETWORK_RUNTIME_HOST = "localhost:6080";
-const NETWORK_RUNTIME_APP_NAME = "TestNetworkApp";
-const USB_RUNTIME_ID = "test-runtime-id";
-const USB_DEVICE_NAME = "test device name";
-const USB_APP_NAME = "TestApp";
+const RUNTIME_DEVICE_ID = "1234";
+const RUNTIME_DEVICE_NAME = "A device";
+const RUNTIME_NAME = "Test application";
 
-// Test that about:debugging navigates back to the default page when a USB device is
-// unplugged.
-add_task(async function testUsbDeviceUnplugged() {
+// Test that about:debugging navigates back to the default page when the server for the
+// current USB runtime is closed.
+add_task(async function() {
   const mocks = new Mocks();
+
   const { document, tab } = await openAboutDebugging();
 
-  mocks.createUSBRuntime(USB_RUNTIME_ID, {
-    deviceName: USB_DEVICE_NAME,
-    name: USB_APP_NAME,
+  const usbClient = mocks.createUSBRuntime(RUNTIME_DEVICE_ID, {
+    deviceName: RUNTIME_DEVICE_NAME,
+    name: RUNTIME_NAME,
   });
   mocks.emitUSBUpdate();
 
   info("Connect to and select the USB device");
-  await connectToRuntime(USB_DEVICE_NAME, document);
-  await selectRuntime(USB_DEVICE_NAME, USB_APP_NAME, document);
+  await connectToRuntime(RUNTIME_DEVICE_NAME, document);
+  await selectRuntime(RUNTIME_DEVICE_NAME, RUNTIME_NAME, document);
 
-  info("Simulate a device unplugged");
-  mocks.removeUSBRuntime(USB_RUNTIME_ID);
-  mocks.emitUSBUpdate();
+  info("Simulate a client disconnection");
+  mocks.removeUSBRuntime(RUNTIME_DEVICE_ID);
+  usbClient._eventEmitter.emit("closed");
 
   info("Wait until the sidebar item for this runtime disappears");
-  await waitUntil(() => !findSidebarItemByText(USB_DEVICE_NAME, document));
+  await waitUntil(() => !findSidebarItemByText(RUNTIME_DEVICE_NAME, document));
 
   is(document.location.hash, `#/runtime/this-firefox`,
     "Redirection to the default page (this-firefox)");
 
   await removeTab(tab);
 });
-
-// Test that about:debugging navigates back to the default page when the server for the
-// current USB runtime is closed.
-add_task(async function testUsbClientDisconnected() {
-  const mocks = new Mocks();
-  const { document, tab } = await openAboutDebugging();
-
-  const usbClient = mocks.createUSBRuntime(USB_RUNTIME_ID, {
-    deviceName: USB_DEVICE_NAME,
-    name: USB_APP_NAME,
-  });
-  mocks.emitUSBUpdate();
-
-  info("Connect to and select the USB device");
-  await connectToRuntime(USB_DEVICE_NAME, document);
-  await selectRuntime(USB_DEVICE_NAME, USB_APP_NAME, document);
-
-  info("Simulate a client disconnection");
-  usbClient.isClosed = () => true;
-  usbClient._eventEmitter.emit("closed");
-
-  info("Wait until the connect button for this runtime appears");
-  await waitUntil(() => {
-    const item = findSidebarItemByText(USB_DEVICE_NAME, document);
-    return item && item.querySelector(".js-connect-button");
-  });
-
-  is(document.location.hash, `#/runtime/this-firefox`,
-    "Redirection to the default page (this-firefox)");
-  await removeTab(tab);
-});
-
-// Test that about:debugging navigates back to the default page when the server for the
-// current network runtime is closed.
-add_task(async function testNetworkClientDisconnected() {
-  const mocks = new Mocks();
-  const { document, tab } = await openAboutDebugging();
-
-  const networkClient = mocks.createNetworkRuntime(NETWORK_RUNTIME_HOST, {
-    name: NETWORK_RUNTIME_APP_NAME,
-  });
-
-  info("Connect to and select the network runtime");
-  await connectToRuntime(NETWORK_RUNTIME_HOST, document);
-  await selectRuntime(NETWORK_RUNTIME_HOST, NETWORK_RUNTIME_APP_NAME, document);
-
-  info("Simulate a client disconnection");
-  networkClient.isClosed = () => true;
-  networkClient._eventEmitter.emit("closed");
-
-  info("Wait until the connect button for this runtime appears");
-  await waitUntil(() => {
-    const item = findSidebarItemByText(NETWORK_RUNTIME_HOST, document);
-    return item && item.querySelector(".js-connect-button");
-  });
-
-  is(document.location.hash, `#/runtime/this-firefox`,
-    "Redirection to the default page (this-firefox)");
-  await removeTab(tab);
-});
--- a/devtools/client/aboutdebugging-new/test/browser/mocks/helper-client-wrapper-mock.js
+++ b/devtools/client/aboutdebugging-new/test/browser/mocks/helper-client-wrapper-mock.js
@@ -43,20 +43,19 @@ function createClientMock() {
       },
       addListener: (evt, listener) => {
         eventEmitter.on(evt, listener);
       },
       removeListener: (evt, listener) => {
         eventEmitter.off(evt, listener);
       },
     },
+
     // no-op
     close: () => {},
-    // client is not closed
-    isClosed: () => false,
     // no-op
     connect: () => {},
     // no-op
     getDeviceDescription: () => {},
     // Return default preference value or null if no match.
     getPreference: function(prefName) {
       if (prefName in this._preferences) {
         return this._preferences[prefName];