Skip to content

added a description for the scenario where a second debugger was opened for the same app disconnecting the first one #162

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 14, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions front_end/ui/legacy/components/utils/TargetDetachedDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> implements ProtocolProxyApi.InspectorDispatcher {
Expand All @@ -53,11 +52,15 @@ export class TargetDetachedDialog extends SDK.SDKModel.SDKModel<void> 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;
Expand Down
Loading