Skip to content
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