Skip to content

Adds the setIsolatePauseMode method to Chrome Proxy Service #1631

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 1, 2022
Merged
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion dwds/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
## 14.0.3-dev
- Make data types null safe
- Make data types null safe.
- Update `package:vm_service` to 8.3.0.
- Convert JavaScript stack traces in uncaught exceptions to Dart stack traces.
- Fix failure to set breakpoints on windows with a base change in index.html.
- Add the setIsolatePauseMode method to Chrome Proxy Service.

## 14.0.2
- Update the min SDK constraint to 2.17.0.
Expand Down
8 changes: 8 additions & 0 deletions dwds/lib/src/services/chrome_proxy_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,14 @@ ${globalLoadStrategy.loadModuleSnippet}("dart_sdk").developer.invokeExtension(
}
}

@override
Future<Success> setIsolatePauseMode(String isolateId,
{String exceptionPauseMode, bool shouldPauseOnExit}) async {
// TODO(elliette): Is there a way to respect the shouldPauseOnExit parameter
// in Chrome?
return setExceptionPauseMode(isolateId, exceptionPauseMode);
}

@override
Future<Success> setExceptionPauseMode(String isolateId, String mode) async {
await isInitialized;
Expand Down
20 changes: 19 additions & 1 deletion dwds/test/chrome_proxy_service_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1121,7 +1121,7 @@ void main() {
expect(stack.truncated, isFalse);
});

test('break on exceptions', () async {
test('break on exceptions with legacy setExceptionPauseMode', () async {
final oldPauseMode =
(await service.getIsolate(isolateId)).exceptionPauseMode;
await service.setExceptionPauseMode(isolateId, ExceptionPauseMode.kAll);
Expand All @@ -1139,6 +1139,24 @@ void main() {
await service.resume(isolateId);
});

test('break on exceptions with setIsolatePauseMode', () async {
final oldPauseMode =
(await service.getIsolate(isolateId)).exceptionPauseMode;
await service.setIsolatePauseMode(isolateId,
exceptionPauseMode: ExceptionPauseMode.kAll);
// Wait for pausing to actually propagate.
var event = await stream
.firstWhere((event) => event.kind == EventKind.kPauseException);
expect(event.exception, isNotNull);

var stack = await service.getStack(isolateId);
expect(stack, isNotNull);

await service.setIsolatePauseMode(isolateId,
exceptionPauseMode: oldPauseMode);
await service.resume(isolateId);
});

test('returns non-empty stack when paused', () async {
await service.pause(isolateId);
// Wait for pausing to actually propagate.
Expand Down