@@ -61,9 +61,14 @@ class V8Messenger(v8: V8): V8InspectorDelegate {
61
61
// Check for messages to send to Chrome DevTools
62
62
if (chromeMessageQueue.any()) {
63
63
val networkPeerManager = NetworkPeerManager .getInstanceOrNull()
64
- for ((k, v) in chromeMessageQueue) {
65
- logger.d(TAG , " Sending chrome $k with $v " )
66
- networkPeerManager?.sendNotificationToPeers(k, v)
64
+ if (networkPeerManager?.hasRegisteredPeers() != true ){
65
+ // We can't send messages to chrome if it's not attached (networkPeerManager null) so resume debugger
66
+ dispatchMessage(Protocol .Debugger .Resume )
67
+ } else {
68
+ for ((k, v) in chromeMessageQueue) {
69
+ logger.d(TAG , " Sending chrome $k with $v " )
70
+ networkPeerManager.sendNotificationToPeers(k, v)
71
+ }
67
72
}
68
73
chromeMessageQueue.clear()
69
74
}
@@ -119,17 +124,19 @@ class V8Messenger(v8: V8): V8InspectorDelegate {
119
124
* to the Chrome DevTools scriptId before passing it through
120
125
*/
121
126
private fun handleBreakpointResolvedEvent (responseParams : JSONObject ? , responseMethod : String? ) {
122
- val breakpointResolvedEvent = dtoMapper.convertValue(responseParams, BreakpointResolvedEvent ::class .java)
127
+ val breakpointResolvedEvent =
128
+ dtoMapper.convertValue(responseParams, BreakpointResolvedEvent ::class .java)
123
129
val location = breakpointResolvedEvent.location
124
- val response = BreakpointResolvedEvent ().also {
125
- it .breakpointId = breakpointResolvedEvent.breakpointId
126
- it .location = LocationResponse ().also {
127
- it .scriptId = v8ScriptMap[location?.scriptId]
128
- it .lineNumber = location?.lineNumber
129
- it .columnNumber = location?.columnNumber
130
+ val response = BreakpointResolvedEvent ().also { resolvedEvent ->
131
+ resolvedEvent .breakpointId = breakpointResolvedEvent.breakpointId
132
+ resolvedEvent .location = LocationResponse ().also { locationResponse ->
133
+ locationResponse .scriptId = v8ScriptMap[location?.scriptId]
134
+ locationResponse .lineNumber = location?.lineNumber
135
+ locationResponse .columnNumber = location?.columnNumber
130
136
}
131
137
}
132
- chromeMessageQueue[responseMethod] = dtoMapper.convertValue(response, JSONObject ::class .java)
138
+ chromeMessageQueue[responseMethod] =
139
+ dtoMapper.convertValue(response, JSONObject ::class .java)
133
140
}
134
141
135
142
/* *
0 commit comments