internal/jsre: pass correct args to setTimeout/setInterval callbacks (#32936)

## Description
- Summary: Correct the JS timer callback argument forwarding to match
standard JS semantics.
- What changed: In `internal/jsre/jsre.go`, the callback is now invoked
with only the arguments after the callback and delay.
- Why: Previously, the callback received the function and delay as
parameters, causing unexpected behavior and logic bugs for consumers.
This commit is contained in:
anim001k 2025-10-28 12:34:14 +01:00 committed by Alvarez
parent dca38204c4
commit baeb82855b

View file

@ -201,7 +201,7 @@ loop:
if !isFunc { if !isFunc {
panic(re.vm.ToValue("js error: timer/timeout callback is not a function")) panic(re.vm.ToValue("js error: timer/timeout callback is not a function"))
} }
call(goja.Null(), timer.call.Arguments...) call(goja.Null(), timer.call.Arguments[2:]...)
_, inreg := registry[timer] // when clearInterval is called from within the callback don't reset it _, inreg := registry[timer] // when clearInterval is called from within the callback don't reset it
if timer.interval && inreg { if timer.interval && inreg {