JS step debugger: stop() from a native mid-step leaves state=errored #1058

Closed
opened 2026-08-13 05:55:45 +00:00 by spikerj · 1 comment
Owner

Summary

JsStepDebuggerService.stop() called from a native while stepInto/runUntil is in the inner micro-step loop tears the interpreter down (interpreter = null) and resolves the in-flight promise, but the loop then does this.interpreter.step() on the nulled handle. The runUntil catch converts that into state = 'errored' with a TypeError, overwriting the idle teardown stop() just applied.

A student (or Blockly highlightBlock native) that calls Stop while a step is in flight would see an error chip instead of a clean idle session.

Repro (characterization)

Prepare stopNow(); var x = 1; with a native that calls svc.stop(), then await svc.stepInto(). Observed: state === 'errored'. Expected: state === 'idle', no error, interpreter gone.

Where

libraries/platform/js-step-debugger/src/lib/js-step-debugger.service.ts — stop() vs runUntil catch. Wave 7 tick 5 a5 characterization test pins current behavior.

## Summary `JsStepDebuggerService.stop()` called from a native while `stepInto`/`runUntil` is in the inner micro-step loop tears the interpreter down (`interpreter = null`) and resolves the in-flight promise, but the loop then does `this.interpreter.step()` on the nulled handle. The `runUntil` catch converts that into `state = 'errored'` with a TypeError, overwriting the idle teardown `stop()` just applied. A student (or Blockly `highlightBlock` native) that calls Stop while a step is in flight would see an error chip instead of a clean idle session. ## Repro (characterization) Prepare `stopNow(); var x = 1;` with a native that calls `svc.stop()`, then `await svc.stepInto()`. Observed: `state === 'errored'`. Expected: `state === 'idle'`, no error, interpreter gone. ## Where `libraries/platform/js-step-debugger/src/lib/js-step-debugger.service.ts` — `stop()` vs `runUntil` catch. Wave 7 tick 5 a5 characterization test pins current behavior.
Author
Owner

Resolved in spikersoft-angular PR #819 (merged to master). stop() from a native mid-step no longer leaves state=errored. Closing.

Resolved in spikersoft-angular [PR #819](https://git.spikersoft.com/spikerj/spikersoft-angular/pulls/819) (merged to `master`). stop() from a native mid-step no longer leaves state=errored. Closing.
Sign in to join this conversation.