Skip to content

Commit 59d08c6

Browse files
authored
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.
1 parent b1db341 commit 59d08c6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

internal/jsre/jsre.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ loop:
201201
if !isFunc {
202202
panic(re.vm.ToValue("js error: timer/timeout callback is not a function"))
203203
}
204-
call(goja.Null(), timer.call.Arguments...)
204+
call(goja.Null(), timer.call.Arguments[2:]...)
205205

206206
_, inreg := registry[timer] // when clearInterval is called from within the callback don't reset it
207207
if timer.interval && inreg {

0 commit comments

Comments
 (0)