Skip to content

Commit e112af7

Browse files
authored
Preparation for hotfix release 19.0.1+1 (#2186)
1 parent 91cbd18 commit e112af7

File tree

9 files changed

+89
-71
lines changed

9 files changed

+89
-71
lines changed

dwds/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 19.0.1+1
2+
3+
- Fix for Flutter crash when resuming and app is not paused. - [#132160](https://github.com/flutter/flutter/issues/132160)
4+
15
## 19.0.1
26

37
- Do not show async frame errors on evaluation. - [#2073](https://github.com/dart-lang/webdev/pull/2073)

dwds/lib/src/debugging/debugger.dart

Lines changed: 37 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -121,32 +121,45 @@ class Debugger extends Domain {
121121
/// Note that stepping will automatically continue until Chrome is paused at
122122
/// a location for which we have source information.
123123
Future<Success> resume({String? step, int? frameIndex}) async {
124-
if (frameIndex != null) {
125-
throw ArgumentError('FrameIndex is currently unsupported.');
126-
}
127-
WipResponse? result;
128-
if (step != null) {
129-
_isStepping = true;
130-
switch (step) {
131-
case 'Over':
132-
result = await _remoteDebugger.stepOver();
133-
break;
134-
case 'Out':
135-
result = await _remoteDebugger.stepOut();
136-
break;
137-
case 'Into':
138-
result = await _remoteDebugger.stepInto();
139-
break;
140-
default:
141-
throwInvalidParam('resume', 'Unexpected value for step: $step');
124+
try {
125+
if (frameIndex != null) {
126+
throw ArgumentError('FrameIndex is currently unsupported.');
142127
}
143-
} else {
144-
_isStepping = false;
145-
_previousSteppingLocation = null;
146-
result = await _remoteDebugger.resume();
128+
WipResponse? result;
129+
if (step != null) {
130+
_isStepping = true;
131+
switch (step) {
132+
case 'Over':
133+
result = await _remoteDebugger.stepOver();
134+
break;
135+
case 'Out':
136+
result = await _remoteDebugger.stepOut();
137+
break;
138+
case 'Into':
139+
result = await _remoteDebugger.stepInto();
140+
break;
141+
default:
142+
throwInvalidParam('resume', 'Unexpected value for step: $step');
143+
}
144+
} else {
145+
_isStepping = false;
146+
_previousSteppingLocation = null;
147+
result = await _remoteDebugger.resume();
148+
}
149+
handleErrorIfPresent(result);
150+
return Success();
151+
} on WipError catch (e) {
152+
final errorMessage = e.message;
153+
if (errorMessage != null &&
154+
errorMessage.contains('Can only perform operation while paused')) {
155+
throw RPCError(
156+
'resume',
157+
RPCErrorKind.kIsolateMustBePaused.code,
158+
errorMessage,
159+
);
160+
}
161+
rethrow;
147162
}
148-
handleErrorIfPresent(result);
149-
return Success();
150163
}
151164

152165
/// Returns the current Dart stack for the paused debugger.

dwds/lib/src/services/chrome_proxy_service.dart

Lines changed: 14 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1088,33 +1088,20 @@ ${globalLoadStrategy.loadModuleSnippet}("dart_sdk").developer.invokeExtension(
10881088
String? step,
10891089
int? frameIndex,
10901090
}) async {
1091-
try {
1092-
if (inspector.appConnection.isStarted) {
1093-
return captureElapsedTime(
1094-
() async {
1095-
await isInitialized;
1096-
await isStarted;
1097-
_checkIsolate('resume', isolateId);
1098-
return await (await debuggerFuture)
1099-
.resume(step: step, frameIndex: frameIndex);
1100-
},
1101-
(result) => DwdsEvent.resume(step),
1102-
);
1103-
} else {
1104-
inspector.appConnection.runMain();
1105-
return Success();
1106-
}
1107-
} on WipError catch (e) {
1108-
final errorMessage = e.message;
1109-
if (errorMessage != null &&
1110-
errorMessage.contains('Can only perform operation while paused')) {
1111-
throw RPCError(
1112-
'resume',
1113-
RPCErrorKind.kIsolateMustBePaused.code,
1114-
errorMessage,
1115-
);
1116-
}
1117-
rethrow;
1091+
if (inspector.appConnection.isStarted) {
1092+
return captureElapsedTime(
1093+
() async {
1094+
await isInitialized;
1095+
await isStarted;
1096+
_checkIsolate('resume', isolateId);
1097+
return await (await debuggerFuture)
1098+
.resume(step: step, frameIndex: frameIndex);
1099+
},
1100+
(result) => DwdsEvent.resume(step),
1101+
);
1102+
} else {
1103+
inspector.appConnection.runMain();
1104+
return Success();
11181105
}
11191106
}
11201107

dwds/lib/src/version.dart

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dwds/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: dwds
22
# Every time this changes you need to run `dart run build_runner build`.
3-
version: 19.0.1
3+
version: 19.0.1+1
44
description: >-
55
A service that proxies between the Chrome debug protocol and the Dart VM
66
service protocol.

dwds/test/chrome_proxy_service_test.dart

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1368,12 +1368,18 @@ void main() {
13681368
expect(pauseBreakpoints, hasLength(1));
13691369
expect(pauseBreakpoints.first.id, bp.id);
13701370
await service.removeBreakpoint(isolateId!, bp.id!);
1371-
});
13721371

1373-
tearDown(() async {
13741372
// Resume execution to not impact other tests.
13751373
await service.resume(isolateId!);
13761374
});
1375+
1376+
test('resuming throws kIsolateMustBePaused error if not paused',
1377+
() async {
1378+
await expectLater(
1379+
service.resume(isolateId!),
1380+
throwsRPCErrorWithCode(RPCErrorKind.kIsolateMustBePaused.code),
1381+
);
1382+
});
13771383
});
13781384

13791385
group('Step', () {

dwds/test/devtools_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ void main() {
9595
final devToolsWindow =
9696
windows.firstWhere((window) => window != newAppWindow);
9797
await devToolsWindow.setAsActive();
98-
expect(await context.webDriver.title, equals('Dart DevTools'));
98+
expect(await context.webDriver.pageSource, contains('DevTools'));
9999
});
100100

101101
test(

dwds/test/events_test.dart

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -143,21 +143,25 @@ void main() {
143143
await context.tearDown();
144144
});
145145

146-
test('emits DEBUGGER_READY and DEVTOOLS_LOAD events', () async {
147-
await expectEventsDuring(
148-
[
149-
matchesEvent(DwdsEventKind.debuggerReady, {
150-
'elapsedMilliseconds': isNotNull,
151-
'screen': equals('debugger'),
152-
}),
153-
matchesEvent(DwdsEventKind.devToolsLoad, {
154-
'elapsedMilliseconds': isNotNull,
155-
'screen': equals('debugger'),
156-
}),
157-
],
158-
() => keyboard.sendChord([Keyboard.alt, 'd']),
159-
);
160-
});
146+
test(
147+
'emits DEBUGGER_READY and DEVTOOLS_LOAD events',
148+
() async {
149+
await expectEventsDuring(
150+
[
151+
matchesEvent(DwdsEventKind.debuggerReady, {
152+
'elapsedMilliseconds': isNotNull,
153+
'screen': equals('debugger'),
154+
}),
155+
matchesEvent(DwdsEventKind.devToolsLoad, {
156+
'elapsedMilliseconds': isNotNull,
157+
'screen': equals('debugger'),
158+
}),
159+
],
160+
() => keyboard.sendChord([Keyboard.alt, 'd']),
161+
);
162+
},
163+
skip: 'https://github.com/dart-lang/webdev/issues/2181',
164+
);
161165

162166
test('emits DEVTOOLS_LAUNCH event', () async {
163167
await expectEventDuring(

dwds/test/fixtures/context.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ Matcher isRPCErrorWithMessage(String message) =>
5555
Matcher throwsRPCErrorWithMessage(String message) =>
5656
throwsA(isRPCErrorWithMessage(message));
5757

58+
Matcher isRPCErrorWithCode(int code) =>
59+
isA<RPCError>().having((e) => e.code, 'code', equals(code));
60+
Matcher throwsRPCErrorWithCode(int code) => throwsA(isRPCErrorWithCode(code));
61+
5862
enum CompilationMode { buildDaemon, frontendServer }
5963

6064
class TestContext {

0 commit comments

Comments
 (0)