Skip to content

Commit 07816d3

Browse files
author
ci_lynx
committed
[BugFix][Debugger] Fix Debugger.skipAllPauses issue.
Synchronize the values of breakpoints_is_active_before and exception_breakpoint_before with breakpoints_is_active and exception_breakpoint, instead of assigning them only when receiving Debugger.skipAllPauses messages with the skip parameter set to true. Otherwise, if only Debugger.skipAllPauses messages with the skip parameter set to false are received, it will cause a state error.
1 parent 14f74db commit 07816d3

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

src/inspector/debugger/debugger.cc

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1542,7 +1542,7 @@ void HandleEnable(DebuggerParams *debugger_options) {
15421542

15431543
bool is_already_enabled = false;
15441544
bool is_paused = false;
1545-
info->breakpoints_is_active = 1;
1545+
info->breakpoints_is_active_before = info->breakpoints_is_active = 1;
15461546
if (view_id != -1) {
15471547
// get if session is enabled and if session is paused
15481548
GetSessionState(ctx, view_id, &is_already_enabled, &is_paused);
@@ -1590,8 +1590,6 @@ void HandleSkipAllPauses(DebuggerParams *debugger_options) {
15901590
int32_t is_skip = LEPUS_VALUE_GET_BOOL(params_skip);
15911591
if (!ctx->rt->gc_enable) LEPUS_FreeValue(ctx, params);
15921592
if (is_skip) {
1593-
info->breakpoints_is_active_before = info->breakpoints_is_active;
1594-
info->exception_breakpoint_before = info->exception_breakpoint;
15951593
info->breakpoints_is_active = 0;
15961594
info->exception_breakpoint = 0;
15971595
} else {
@@ -1890,9 +1888,9 @@ void HandleSetPauseOnExceptions(DebuggerParams *debugger_options) {
18901888
}
18911889
if (state) {
18921890
if (strcmp("uncaught", state) == 0 || strcmp("all", state) == 0) {
1893-
info->exception_breakpoint = 1;
1891+
info->exception_breakpoint_before = info->exception_breakpoint = 1;
18941892
} else if (strcmp("none", state) == 0) {
1895-
info->exception_breakpoint = 0;
1893+
info->exception_breakpoint_before = info->exception_breakpoint = 0;
18961894
}
18971895
if (!ctx->rt->gc_enable) LEPUS_FreeCString(ctx, state);
18981896

src/inspector/debugger/debugger_breakpoint.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,8 @@ void HandleSetBreakpointActive(DebuggerParams *debugger_options) {
703703
int32_t is_active = LEPUS_VALUE_GET_BOOL(active);
704704
if (!ctx->rt->gc_enable) LEPUS_FreeValue(ctx, params);
705705

706-
info->breakpoints_is_active = is_active ? 1 : 0;
706+
info->breakpoints_is_active_before = info->breakpoints_is_active =
707+
is_active ? 1 : 0;
707708

708709
LEPUSValue result = LEPUS_NewObject(ctx);
709710
if (LEPUS_IsException(result)) {
@@ -981,7 +982,7 @@ void HandleContinueToLocation(DebuggerParams *debugger_options) {
981982
const char *url = GetScriptURLByScriptId(ctx, script_id);
982983

983984
// set brekapoint active is 1
984-
info->breakpoints_is_active = 1;
985+
info->breakpoints_is_active_before = info->breakpoints_is_active = 1;
985986

986987
// add this new breakpoint to the info->breakpoints, set specific_condition
987988
// true

0 commit comments

Comments
 (0)