Normalize scope-object this in mock function calls to prevent leak/crash - #31605
Closed
robobun wants to merge 2 commits into
Closed
Normalize scope-object this in mock function calls to prevent leak/crash#31605robobun wants to merge 2 commits into
this in mock function calls to prevent leak/crash#31605robobun wants to merge 2 commits into
Claude / Claude Code Review
completed
May 30, 2026 in 21m 11s
Code review found 1 potential issue
Found 1 candidates, confirmed 1. See review comments for details.
Details
| Severity | Count |
|---|---|
| 🔴 Important | 0 |
| 🟡 Nit | 0 |
| 🟣 Pre-existing | 1 |
| Severity | File:Line | Issue |
|---|---|---|
| 🟣 Pre-existing | src/jsc/bindings/JSMockFunction.cpp:845 |
Same scope-object leak remains in JSMock__jsSetSystemTime |
Annotations
Check notice on line 845 in src/jsc/bindings/JSMockFunction.cpp
claude / Claude Code Review
Same scope-object leak remains in JSMock__jsSetSystemTime
Pre-existing: the same raw `callframe->thisValue()` leak fixed here is still present ~600 lines down in `JSMock__jsSetSystemTime` (returns `JSValue::encode(callframe->thisValue())` on both paths, lines ~1462/1467) and in `JSMock__jsUseRealTimers` (~1435). `setSystemTime` is exposed as a top-level `bun:test` export (jest.zig:224-225), so `const { setSystemTime } = require("bun:test"); const c = () => setSystemTime; typeof setSystemTime(0) === "function"` reproduces the same JSLexicalEnvironment l
Loading