mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-17 21:46:36 +00:00
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:
parent
b1db341f7e
commit
59d08c66ff
1 changed files with 1 additions and 1 deletions
|
|
@ -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 {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue