Skip to content

Commit

Permalink
expose more fields related to async frames (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
devoncarew authored May 20, 2020
1 parent 702aa38 commit f451a79
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 9 deletions.
8 changes: 6 additions & 2 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# webkit_inspection_protocol.dart

## 0.7.1
- Exposed `Debugger.setAsyncCallStackDepth`
- Exposed `StackTrace.parent`

## 0.7.0
- Normalized all objects to expose a `json` field for raw access to the protocol information.
- Exposed Runtime.getProperties, Runtime.getHeapUsage, and Runtime.getIsolateId
- Normalized all objects to expose a `json` field for raw access to the protocol information
- Exposed `Runtime.getProperties`, `Runtime.getHeapUsage`, and `Runtime.getIsolateId`
- Exposed `DebuggerPausedEvent.hitBreakpoints` and `DebuggerPausedEvent.asyncStackTrace`
- Exposed `WipCallFrame.returnValue`
- Removed `WrappedWipEvent` (in favor of just using `WipEvent`)
Expand Down
13 changes: 13 additions & 0 deletions lib/src/debugger.dart
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,16 @@ class WipDebugger extends WipDomain {
}
}

/// Enables or disables async call stacks tracking.
///
/// maxDepth - Maximum depth of async call stacks. Setting to 0 will
/// effectively disable collecting async call stacks (default).
Future<WipResponse> setAsyncCallStackDepth(int maxDepth) {
return sendCommand('Debugger.setAsyncCallStackDepth', params: {
'maxDepth': maxDepth,
});
}

Stream<DebuggerPausedEvent> get onPaused => eventStream('Debugger.paused',
(WipEvent event) => new DebuggerPausedEvent(event.json));

Expand Down Expand Up @@ -224,6 +234,9 @@ class DebuggerPausedEvent extends WipEvent {
String toString() => 'paused: ${reason}';
}

/// A debugger call frame.
///
/// This class is for the 'debugger' domain.
class WipCallFrame {
final Map<String, dynamic> json;

Expand Down
18 changes: 12 additions & 6 deletions lib/src/runtime.dart
Original file line number Diff line number Diff line change
Expand Up @@ -266,17 +266,21 @@ class StackTrace {

StackTrace(this.json);

List<CallFrame> get callFrames => (json['callFrames'] as List)
.map((m) => new CallFrame(m as Map<String, dynamic>))
.toList();

/// String label of this stack trace. For async traces this may be a name of
/// the function that initiated the async call.
@optional
String get description => json['description'] as String;

List<CallFrame> get callFrames => (json['callFrames'] as List)
.map((m) => new CallFrame(m as Map<String, dynamic>))
.toList();

// TODO: parent, StackTrace, Asynchronous JavaScript stack trace that preceded
// this stack, if available.
/// Asynchronous JavaScript stack trace that preceded this stack, if
/// available.
@optional
StackTrace get parent {
return json['callFrames'] == null ? null : StackTrace(json['callFrames']);
}

List<String> printFrames() {
List<CallFrame> frames = callFrames;
Expand All @@ -295,6 +299,8 @@ class StackTrace {
}

/// Stack entry for runtime errors and assertions.
///
/// This class is for the 'runtime' domain.
class CallFrame {
final Map<String, dynamic> json;

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: webkit_inspection_protocol
version: 0.7.0
version: 0.7.1
description: A client for the Chrome DevTools Protocol (previously called the Webkit Inspection Protocol).
homepage: https://github.com/google/webkit_inspection_protocol.dart

Expand Down

0 comments on commit f451a79

Please sign in to comment.