super(debugSession);
}
@Override
public void messageReceived(EventNotification eventMessage) {
final DebugSession debugSession = getDebugSession();
ScriptHandle script = getScriptToLoad(eventMessage,
debugSession.getScriptManager().getContextFilter());
if (script == null) {
return;
}
debugSession.sendMessageAsync(
DebuggerMessageFactory.scripts(
Collections.singletonList(V8ProtocolUtil.getScriptIdFromResponse(script)), true),
true,
new V8CommandCallbackBase() {
@Override
public void success(SuccessCommandResponse successResponse) {
List<ScriptHandle> body;
try {
body = successResponse.body().asScripts();
} catch (JsonProtocolParseException e) {
throw new RuntimeException(e);
}
// body is an array of scripts
if (body.size() == 0) {
return; // The script did not arrive (bad id?)
}
Script newScript = debugSession.getScriptManager().addScript(
body.get(0),
successResponse.refs());
if (newScript != null) {
getDebugSession().getSessionManager().getDebugEventListener().scriptLoaded(newScript);
}