Skip to content

Commit f5506e6

Browse files
authored
added a description for the scenario where a second debugger was opened for the same app disconnecting the first one (#162)
1 parent 3d17e0f commit f5506e6

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

front_end/ui/legacy/components/utils/TargetDetachedDialog.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,13 @@ const UIStrings = {
2020
/**
2121
*@description Text on the remote debugging window to indicate the connection to corresponding device was lost
2222
*/
23-
websocketDisconnectedConnectionLost: 'Connection lost to corresponding device'
23+
websocketDisconnectedConnectionLost: 'Connection lost to corresponding device.',
24+
/**
25+
*@description Text on the remote debugging window to indicate a disconnection happened because a second dev tools instance was opened
26+
*/
27+
websocketDisconnectedNewDebuggerOpened: 'Disconnected due to opening a second DevTools window for the same app.'
2428
};
2529

26-
const DisconnectedReasonsUIStrings = {
27-
UREGISTERED_DEVICE: UIStrings.websocketDisconnectedUnregisteredDevice,
28-
CONNECTION_LOST: UIStrings.websocketDisconnectedConnectionLost
29-
}
30-
3130
const str_ = i18n.i18n.registerUIStrings('ui/legacy/components/utils/TargetDetachedDialog.ts', UIStrings);
3231
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
3332
export class TargetDetachedDialog extends SDK.SDKModel.SDKModel<void> implements ProtocolProxyApi.InspectorDispatcher {
@@ -53,11 +52,15 @@ export class TargetDetachedDialog extends SDK.SDKModel.SDKModel<void> implements
5352
}
5453

5554
if (connectionLostDetails.code === "1011" && connectionLostDetails.reason?.includes('[UREGISTERED_DEVICE]')) {
56-
return i18nString(DisconnectedReasonsUIStrings.UREGISTERED_DEVICE);
55+
return i18nString(UIStrings.websocketDisconnectedUnregisteredDevice);
5756
}
5857

5958
if (connectionLostDetails.code === "1000" && connectionLostDetails.reason?.includes('[CONNECTION_LOST]')) {
60-
return i18nString(DisconnectedReasonsUIStrings.CONNECTION_LOST);
59+
return i18nString(UIStrings.websocketDisconnectedConnectionLost);
60+
}
61+
62+
if (connectionLostDetails.code === "1000" && connectionLostDetails.reason?.includes('[NEW_DEBUGGER_OPENED]')) {
63+
return i18nString(UIStrings.websocketDisconnectedNewDebuggerOpened);
6164
}
6265

6366
return null;

0 commit comments

Comments
 (0)