|
@@ -168,7 +168,8 @@ public class RequestHandler extends MagicController {
|
|
return afterCompletion(requestEntity, value);
|
|
return afterCompletion(requestEntity, value);
|
|
}
|
|
}
|
|
if (requestedFromTest) {
|
|
if (requestedFromTest) {
|
|
- String sessionAndScriptId = requestEntity.getRequestedClientId() + requestEntity.getRequestedScriptId();
|
|
+ DebugRequest debugRequest = requestEntity.getDebugRequest();
|
|
|
|
+ String sessionAndScriptId = debugRequest.getRequestedClientId() + debugRequest.getRequestedScriptId();
|
|
try {
|
|
try {
|
|
if (context instanceof MagicScriptDebugContext) {
|
|
if (context instanceof MagicScriptDebugContext) {
|
|
WebSocketSessionManager.addMagicScriptContext(sessionAndScriptId, (MagicScriptDebugContext) context);
|
|
WebSocketSessionManager.addMagicScriptContext(sessionAndScriptId, (MagicScriptDebugContext) context);
|
|
@@ -358,8 +359,8 @@ public class RequestHandler extends MagicController {
|
|
} while ((parent = parent.getCause()) != null);
|
|
} while ((parent = parent.getCause()) != null);
|
|
if (se != null && requestEntity.isRequestedFromTest()) {
|
|
if (se != null && requestEntity.isRequestedFromTest()) {
|
|
Span.Line line = se.getLine();
|
|
Span.Line line = se.getLine();
|
|
- WebSocketSessionManager.sendByClientId(requestEntity.getRequestedClientId(), EXCEPTION, Arrays.asList(
|
|
+ WebSocketSessionManager.sendByClientId(requestEntity.getDebugRequest().getRequestedClientId(), EXCEPTION, Arrays.asList(
|
|
- requestEntity.getRequestedScriptId(),
|
|
+ requestEntity.getDebugRequest().getRequestedScriptId(),
|
|
se.getSimpleMessage(),
|
|
se.getSimpleMessage(),
|
|
line == null ? null : Arrays.asList(line.getLineNumber(), line.getEndLineNumber(), line.getStartCol(), line.getEndCol())
|
|
line == null ? null : Arrays.asList(line.getLineNumber(), line.getEndLineNumber(), line.getStartCol(), line.getEndCol())
|
|
));
|
|
));
|
|
@@ -395,24 +396,13 @@ public class RequestHandler extends MagicController {
|
|
* 构建 MagicScriptContext
|
|
* 构建 MagicScriptContext
|
|
*/
|
|
*/
|
|
private MagicScriptContext createMagicScriptContext(String scriptName, RequestEntity requestEntity) {
|
|
private MagicScriptContext createMagicScriptContext(String scriptName, RequestEntity requestEntity) {
|
|
- List<Integer> breakpoints = requestEntity.getRequestedBreakpoints();
|
|
+ DebugRequest debugRequest = requestEntity.getDebugRequest();
|
|
|
|
+ List<Integer> breakpoints = debugRequest.getRequestedBreakpoints();
|
|
|
|
|
|
MagicScriptContext context;
|
|
MagicScriptContext context;
|
|
|
|
|
|
if (requestEntity.isRequestedFromDebug() && breakpoints.size() > 0) {
|
|
if (requestEntity.isRequestedFromDebug() && breakpoints.size() > 0) {
|
|
- MagicScriptDebugContext debugContext = new MagicScriptDebugContext(requestEntity.getRequestedBreakpoints());
|
|
+ context = debugRequest.createMagicScriptContext(configuration.getDebugTimeout());
|
|
- String scriptId = requestEntity.getRequestedScriptId();
|
|
|
|
- String clientId = requestEntity.getRequestedClientId();
|
|
|
|
- debugContext.setTimeout(configuration.getDebugTimeout());
|
|
|
|
- debugContext.setId(scriptId);
|
|
|
|
- debugContext.setCallback(variables -> {
|
|
|
|
- List<Map<String, Object>> varList = (List<Map<String, Object>>) variables.get("variables");
|
|
|
|
- varList.stream().filter(it -> it.containsKey("value")).forEach(variable -> {
|
|
|
|
- variable.put("value", JsonUtils.toJsonStringWithoutLog(variable.get("value")));
|
|
|
|
- });
|
|
|
|
- WebSocketSessionManager.sendByClientId(clientId, BREAKPOINT, scriptId, variables);
|
|
|
|
- });
|
|
|
|
- context = debugContext;
|
|
|
|
} else {
|
|
} else {
|
|
context = new MagicScriptContext();
|
|
context = new MagicScriptContext();
|
|
}
|
|
}
|