From 9575e17555be7709ff6ab44d1c6d45a65d56eb64 Mon Sep 17 00:00:00 2001 From: Vitali Zaidman Date: Tue, 13 May 2025 17:12:02 +0100 Subject: [PATCH] added a description for the scenario where a second debugger was opened for the same app disconnecting the first one --- .../components/utils/TargetDetachedDialog.ts | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/front_end/ui/legacy/components/utils/TargetDetachedDialog.ts b/front_end/ui/legacy/components/utils/TargetDetachedDialog.ts index ab66d6949b70..56e8993ddd4f 100644 --- a/front_end/ui/legacy/components/utils/TargetDetachedDialog.ts +++ b/front_end/ui/legacy/components/utils/TargetDetachedDialog.ts @@ -20,14 +20,13 @@ const UIStrings = { /** *@description Text on the remote debugging window to indicate the connection to corresponding device was lost */ - websocketDisconnectedConnectionLost: 'Connection lost to corresponding device' + websocketDisconnectedConnectionLost: 'Connection lost to corresponding device.', + /** + *@description Text on the remote debugging window to indicate a disconnection happened because a second dev tools instance was opened + */ + websocketDisconnectedNewDebuggerOpened: 'Disconnected due to opening a second DevTools window for the same app.' }; -const DisconnectedReasonsUIStrings = { - UREGISTERED_DEVICE: UIStrings.websocketDisconnectedUnregisteredDevice, - CONNECTION_LOST: UIStrings.websocketDisconnectedConnectionLost -} - const str_ = i18n.i18n.registerUIStrings('ui/legacy/components/utils/TargetDetachedDialog.ts', UIStrings); const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_); export class TargetDetachedDialog extends SDK.SDKModel.SDKModel implements ProtocolProxyApi.InspectorDispatcher { @@ -53,11 +52,15 @@ export class TargetDetachedDialog extends SDK.SDKModel.SDKModel implements } if (connectionLostDetails.code === "1011" && connectionLostDetails.reason?.includes('[UREGISTERED_DEVICE]')) { - return i18nString(DisconnectedReasonsUIStrings.UREGISTERED_DEVICE); + return i18nString(UIStrings.websocketDisconnectedUnregisteredDevice); } if (connectionLostDetails.code === "1000" && connectionLostDetails.reason?.includes('[CONNECTION_LOST]')) { - return i18nString(DisconnectedReasonsUIStrings.CONNECTION_LOST); + return i18nString(UIStrings.websocketDisconnectedConnectionLost); + } + + if (connectionLostDetails.code === "1000" && connectionLostDetails.reason?.includes('[NEW_DEBUGGER_OPENED]')) { + return i18nString(UIStrings.websocketDisconnectedNewDebuggerOpened); } return null;