From 17eaef0688ee4065376f3115e338975d3fbf36f8 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Sun, 9 Jun 2024 18:42:03 +0200 Subject: [PATCH] [spidermonkey] allow timeout == 0 for setTimeout --- src/ecmascript/spidermonkey/window.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/ecmascript/spidermonkey/window.cpp b/src/ecmascript/spidermonkey/window.cpp index a5f2e74c..14b98f0b 100644 --- a/src/ecmascript/spidermonkey/window.cpp +++ b/src/ecmascript/spidermonkey/window.cpp @@ -639,12 +639,17 @@ window_setTimeout(JSContext *ctx, unsigned int argc, JS::Value *rval) char *code; int timeout; - if (argc != 2) + if (argc < 1) { return true; + } - timeout = args[1].toInt32(); + if (argc > 1) { + timeout = args[1].toInt32(); + } else { + timeout = 0; + } - if (timeout <= 0) { + if (timeout < 0) { return true; }