Skip to content

Commit b339a50

Browse files
authored
Send connection response to Cider (#2302)
1 parent c26b8c8 commit b339a50

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

dwds/debug_extension_mv3/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: mv3_extension
22
publish_to: none
3-
version: 2.1.0
3+
version: 2.1.1
44
homepage: https://github.com/dart-lang/webdev
55
description: >-
66
A Chrome extension for Dart debugging.

dwds/debug_extension_mv3/web/cider_connection.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ const _ciderDartMessageKey = 'CIDER_DART';
2626
/// The types must match those defined by ChromeExtensionMessageType in the
2727
/// Cider extension.
2828
enum CiderMessageType {
29+
connected,
2930
error,
3031
inspectorUrlResponse,
3132
inspectorUrlRequest,
@@ -54,11 +55,14 @@ Port? _ciderPort;
5455
/// URIs for Cider are set in the externally_connectable field in the manifest.
5556
void handleCiderConnectRequest(Port port) {
5657
if (port.name == _ciderPortName) {
58+
debugLog('Received connect request from Cider', verbose: true);
5759
_ciderPort = port;
5860

5961
port.onMessage.addListener(
6062
allowInterop(_handleMessageFromCider),
6163
);
64+
65+
sendMessageToCider(messageType: CiderMessageType.connected);
6266
}
6367
}
6468

@@ -130,6 +134,7 @@ Future<void> _startDebugging({String? appId}) async {
130134
final tabId = _tabId(appId);
131135
// TODO(https://github.com/dart-lang/webdev/issues/2198): When debugging
132136
// with Cider, disable debugging with DevTools.
137+
debugLog('Attach debugger to Cider', verbose: true);
133138
await attachDebugger(tabId, trigger: Trigger.cider);
134139
}
135140

dwds/debug_extension_mv3/web/debug_session.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ Future<void> attachDebugger(
115115
forwardErrorsToCider: trigger == Trigger.cider,
116116
);
117117
if (!tabIsDebuggable) return;
118-
118+
debugLog('Attaching to tab $dartAppTabId', verbose: true);
119119
_tabIdToTrigger[dartAppTabId] = trigger;
120120
_registerDebugEventListeners();
121121
chrome.debugger.attach(
@@ -357,6 +357,7 @@ Future<bool> _connectToDwds({
357357
? WebSocketClient(WebSocketChannel.connect(uri))
358358
: SseSocketClient(SseClient(uri.toString(), debugKey: 'DebugExtension'));
359359
final trigger = _tabIdToTrigger[dartAppTabId];
360+
debugLog('Connecting to DWDS...', verbose: true);
360361
final debugSession = _DebugSession(
361362
client: client,
362363
appTabId: dartAppTabId,
@@ -418,6 +419,7 @@ void _routeDwdsEvent(String eventData, SocketClient client, int tabId) {
418419
}
419420
}
420421
if (message.method == 'dwds.debugUri') {
422+
debugLog('Sending debug URI to Cider ${message.params}', verbose: true);
421423
sendMessageToCider(
422424
messageType: CiderMessageType.startDebugResponse,
423425
messageBody: message.params,

dwds/debug_extension_mv3/web/manifest_mv3.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Dart Debug Extension",
3-
"version": "2.1",
3+
"version": "2.1.1",
44
"manifest_version": 3,
55
"devtools_page": "static_assets/devtools.html",
66
"action": {

0 commit comments

Comments
 (0)