Skip to content

Commit a0331f5

Browse files
committed
add devtools disconnected reasons
1 parent b61037e commit a0331f5

3 files changed

Lines changed: 33 additions & 12 deletions

File tree

front_end/global_typings/react_native.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ declare global {
1010
var enableReactNativePerfMetrics: boolean|undefined;
1111
var enableReactNativePerfMetricsGlobalPostMessage: boolean|undefined;
1212
var enableReactNativeOpenInExternalEditor: boolean|undefined;
13+
var enableDisplayingFullDisconnectedReason: boolean|undefined;
1314
var reactNativeOpenInEditorButtonImage: string|undefined;
1415
var FB_ONLY__reactNativeFeedbackLink: string|undefined;
1516
var FB_ONLY__enablePerformance: any;

front_end/ui/legacy/RemoteDebuggingTerminatedScreen.ts

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ const UIStrings = {
2525
* (see https://developer.chrome.com/docs/devtools/remote-debugging/).
2626
*/
2727
debuggingConnectionWasClosed: 'Debugging connection was closed. Reason: ',
28+
/**
29+
* @description Text in a dialog box in DevTools providing extra details on why remote debugging has been terminated.
30+
* "Remote debugging" here means that DevTools on a PC is inspecting a website running on an actual mobile device
31+
* (see https://developer.chrome.com/docs/devtools/remote-debugging/).
32+
*/
33+
debuggingConnectionWasClosedDetails: 'Details: ',
2834
/**
2935
* @description Text in a dialog box showing how to reconnect to DevTools when remote debugging has been terminated.
3036
* "Remote debugging" here means that DevTools on a PC is inspecting a website running on an actual mobile device
@@ -68,7 +74,11 @@ const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
6874
const {render, html} = LitHtml;
6975

7076
export class RemoteDebuggingTerminatedScreen extends VBox {
71-
constructor(reason: string, onClose?: () => void) {
77+
constructor(
78+
reason: string,
79+
connectionLostDetails?: {reason?: string, code?: string, errorType?: string},
80+
onClose?: () => void
81+
) {
7282
super(true);
7383
this.registerCSSFiles([remoteDebuggingTerminatedScreenStyles]);
7484

@@ -81,21 +91,28 @@ export class RemoteDebuggingTerminatedScreen extends VBox {
8191
html`
8292
<h1 class="remote-debugging-terminated-title">${i18nString(UIStrings.title)}</h1>
8393
<div class="remote-debugging-terminated-message">
84-
<span>${i18nString(UIStrings.debuggingConnectionWasClosed)}</span>
85-
<br/>
86-
<span class="remote-debugging-terminated-reason">${reason}</span>
94+
<div>${i18nString(UIStrings.debuggingConnectionWasClosed)}</div>
95+
<div class="remote-debugging-terminated-reason">${reason}</div>
96+
${globalThis.enableDisplayingFullDisconnectedReason ?
97+
html`
98+
<div>
99+
${i18nString(UIStrings.debuggingConnectionWasClosedDetails)}
100+
</div>
101+
<div class="remote-debugging-terminated-reason">
102+
<textarea disabled rows="5">${JSON.stringify(connectionLostDetails, null, 2)}</textarea>
103+
</div>
104+
` : ''}
87105
</div>
88106
${feedbackLink !== null && feedbackLink !== undefined ? this.#createFeedbackSection(feedbackLink) : null}
89107
<div class="remote-debugging-terminated-options">
90108
<div class="remote-debugging-terminated-label">
91109
${i18nString(UIStrings.reconnectWhenReadyByReopening)}
92110
</div>
93-
${
94-
createTextButton(
95-
i18nString(UIStrings.reconnectDevtools),
96-
handleReconnect,
97-
{className: 'primary-button', jslogContext: 'reconnect'},
98-
)}
111+
${createTextButton(
112+
i18nString(UIStrings.reconnectDevtools),
113+
handleReconnect,
114+
{className: 'primary-button', jslogContext: 'reconnect'},
115+
)}
99116
<div class="remote-debugging-terminated-label">
100117
${i18nString(UIStrings.closeDialogDetail)}
101118
</div>
@@ -116,7 +133,7 @@ export class RemoteDebuggingTerminatedScreen extends VBox {
116133
const dialog = new Dialog('remote-debnugging-terminated');
117134
dialog.setSizeBehavior(SizeBehavior.MeasureContent);
118135
dialog.setDimmed(true);
119-
new RemoteDebuggingTerminatedScreen(uiMessage, () => dialog.hide()).show(dialog.contentElement);
136+
new RemoteDebuggingTerminatedScreen(uiMessage, connectionLostDetails, () => dialog.hide()).show(dialog.contentElement);
120137
dialog.show();
121138
Host.rnPerfMetrics.remoteDebuggingTerminated(connectionLostDetails);
122139
}

front_end/ui/legacy/remoteDebuggingTerminatedScreen.css

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,11 @@
6161

6262
.remote-debugging-terminated-reason {
6363
--override-reason-color: red;
64-
line-height: 32px;
6564
color: var(--override-reason-color);
65+
margin: 8px;
66+
textarea {
67+
width: 100%;
68+
}
6669
}
6770

6871
.theme-with-dark-background .reason,

0 commit comments

Comments
 (0)