Change forwarder to not send paused events unless a breakpoint event has been sent or it had been explicitly told to do so.
This is useful when using the multiplexor to debug a web app while running a webdriver test against it, as chromedriver will automatically resume if a paused event is received.
Change bin/multiplex model_dom option to false by default.
diff --git a/bin/multiplex.dart b/bin/multiplex.dart
index 5c3dcc5..05c3b67 100644
--- a/bin/multiplex.dart
+++ b/bin/multiplex.dart
@@ -15,7 +15,7 @@
main(List<String> argv) async {
var args = (new ArgParser()
..addFlag('verbose', abbr: 'v', defaultsTo: false, negatable: false)
- ..addFlag('model_dom', defaultsTo: true, negatable: true)
+ ..addFlag('model_dom', defaultsTo: false, negatable: true)
..addOption('chrome_host', defaultsTo: 'localhost')
..addOption('chrome_port', defaultsTo: '9222')
..addOption('listen_port', defaultsTo: '9223')).parse(argv);
diff --git a/lib/forwarder.dart b/lib/forwarder.dart
index cb165b6..7dc5822 100644
--- a/lib/forwarder.dart
+++ b/lib/forwarder.dart
@@ -28,6 +28,10 @@
final StreamSink _out;
final WipConnection _debugger;
final WipDom domModel;
+ /// If false, no Debugger.paused events will be forwarded back to the
+ /// client. This gets automatically set to true if a breakpoint is set
+ /// by the client.
+ bool forwardPausedEvents = false;
final _subscriptions = <StreamSubscription>[];
@@ -57,6 +61,10 @@
Map<String, dynamic> params = json['params'];
bool processed = false;
+ if (method.contains('reakpoint')) {
+ forwardPausedEvents = true;
+ }
+
if (domModel != null) {
switch (method) {
case 'DOM.getDocument':
@@ -97,7 +105,12 @@
}
void _onDebuggerDataHandler(WipEvent event) {
+ if (event.method == 'Debugger.paused' && !forwardPausedEvents) {
+ _log.info('not forwarding event: $event');
+ return;
+ }
_log.info('forwarding event: $event');
+
var json = {'method': event.method};
if (event.params != null) {
json['params'] = event.params;
diff --git a/pubspec.yaml b/pubspec.yaml
index 6e9db90..58b9f9f 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,5 +1,5 @@
name: webkit_inspection_protocol
-version: 0.1.1+1
+version: 0.1.2
description: A client for the Webkit Inspection Protocol (WIP).
homepage: https://github.com/google/webkit_inspection_protocol.dart
@@ -8,10 +8,10 @@
environment:
sdk: '>=1.10.0 <2.0.0'
dependencies:
- args: '^0.13.0'
- logging: '^0.11.0'
- shelf: '^0.6.1+2'
+ args: '^0.13.2'
+ logging: '^0.11.1'
+ shelf: '^0.6.2'
shelf_web_socket: '^0.0.1+2'
dev_dependencies:
shelf_static: '^0.2.2'
- test: '^0.12.3+2'
+ test: '^0.12.3+5'