diff --git a/dwds/CHANGELOG.md b/dwds/CHANGELOG.md index 65d0e7b5f..4252e7dfb 100644 --- a/dwds/CHANGELOG.md +++ b/dwds/CHANGELOG.md @@ -1,3 +1,7 @@ +## 26.2.2 + +- Fix issue where isolate pause events were not reported correctly when using the web socket proxy service. + ## 26.2.1 - Add support for DDS APIs and serving Dart DevTools when no Chrome Debugger is available. diff --git a/dwds/lib/src/connections/app_connection.dart b/dwds/lib/src/connections/app_connection.dart index 8268d674d..26f679dd0 100644 --- a/dwds/lib/src/connections/app_connection.dart +++ b/dwds/lib/src/connections/app_connection.dart @@ -20,6 +20,8 @@ class AppConnection { final SocketConnection _connection; final Future _readyToRunMain; + bool get hasStarted => _startedCompleter.isCompleted; + AppConnection(this.request, this._connection, this._readyToRunMain) { safeUnawaited(_connection.sink.done.then((v) => _doneCompleter.complete())); } diff --git a/dwds/lib/src/injected/client.js b/dwds/lib/src/injected/client.js index f89987f57..04799eef8 100644 --- a/dwds/lib/src/injected/client.js +++ b/dwds/lib/src/injected/client.js @@ -1,4 +1,4 @@ -// Generated by dart2js (, csp, intern-composite-values), the Dart to JavaScript compiler version: 3.11.0-88.0.dev. +// Generated by dart2js (, csp, intern-composite-values), the Dart to JavaScript compiler version: 3.11.0-93.0.dev. // The code supports the following hooks: // dartPrint(message): // if this function is defined it is called instead of the Dart [print] diff --git a/dwds/lib/src/services/web_socket/web_socket_proxy_service.dart b/dwds/lib/src/services/web_socket/web_socket_proxy_service.dart index 53b01c49b..32b7ce1d0 100644 --- a/dwds/lib/src/services/web_socket/web_socket_proxy_service.dart +++ b/dwds/lib/src/services/web_socket/web_socket_proxy_service.dart @@ -192,10 +192,6 @@ final class WebSocketProxyService extends ProxyService { return service; } - // Isolate state - vm_service.Event? _currentPauseEvent; - bool _mainHasStarted = false; - /// Creates a new isolate for WebSocket debugging. @override Future createIsolate( @@ -276,7 +272,7 @@ final class WebSocketProxyService extends ProxyService { timestamp: timestamp, isolate: isolateRef, ); - _currentPauseEvent = pauseEvent; + inspector.isolate.pauseEvent = pauseEvent; streamNotify(vm_service.EventStreams.kDebug, pauseEvent); } @@ -383,8 +379,6 @@ final class WebSocketProxyService extends ProxyService { // Reset state inspector = null; - _currentPauseEvent = null; - _mainHasStarted = false; if (initializedCompleter.isCompleted) { initializedCompleter = Completer(); @@ -784,13 +778,13 @@ final class WebSocketProxyService extends ProxyService { value == 'true' && oldValue == false) { // Send pause event for existing isolate if not already paused - if (isIsolateRunning && _currentPauseEvent == null) { + if (isIsolateRunning && inspector.isolate.pauseEvent == null) { final pauseEvent = vm_service.Event( kind: vm_service.EventKind.kPauseStart, timestamp: DateTime.now().millisecondsSinceEpoch, isolate: inspector.isolateRef, ); - _currentPauseEvent = pauseEvent; + inspector.isolate.pauseEvent = pauseEvent; streamNotify(vm_service.EventStreams.kDebug, pauseEvent); } } @@ -812,24 +806,13 @@ final class WebSocketProxyService extends ProxyService { Future _resume(String isolateId) async { if (hasPendingRestart && !resumeAfterRestartEventsController.isClosed) { resumeAfterRestartEventsController.add(isolateId); - } else { - if (!_mainHasStarted) { - try { - appConnection.runMain(); - _mainHasStarted = true; - } catch (e) { - if (e.toString().contains('Main has already started')) { - _mainHasStarted = true; - } else { - rethrow; - } - } - } + } else if (!appConnection.hasStarted) { + appConnection.runMain(); } // Clear pause state and send resume event to notify debugging tools - if (_currentPauseEvent != null) { - _currentPauseEvent = null; + if (inspector.isolate.pauseEvent != null) { + inspector.isolate.pauseEvent = null; final resumeEvent = vm_service.Event( kind: vm_service.EventKind.kResume, timestamp: DateTime.now().millisecondsSinceEpoch, diff --git a/dwds/lib/src/version.dart b/dwds/lib/src/version.dart index c30ea88e3..399a03a9b 100644 --- a/dwds/lib/src/version.dart +++ b/dwds/lib/src/version.dart @@ -1,2 +1,2 @@ // Generated code. Do not modify. -const packageVersion = '26.2.1'; +const packageVersion = '26.2.2'; diff --git a/dwds/pubspec.yaml b/dwds/pubspec.yaml index 2e92a1eb6..f34a9f07c 100644 --- a/dwds/pubspec.yaml +++ b/dwds/pubspec.yaml @@ -1,6 +1,6 @@ name: dwds # Every time this changes you need to run `dart run build_runner build`. -version: 26.2.1 +version: 26.2.2 description: >- A service that proxies between the Chrome debug protocol and the Dart VM