Skip to content

Commit a001cca

Browse files
committed
fix: wrong assumption that the timeoutId argument to clearTimeout is always a JS::Value of type JSVAL_TYPE_INT32
1 parent 116f600 commit a001cca

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/internalBinding/timers.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ static bool cancelByTimeoutId(JSContext *cx, unsigned argc, JS::Value *vp) {
4444

4545
args.rval().setUndefined();
4646

47-
// silently does nothing when an invalid timeoutID is passed in
48-
if (!timeoutIdArg.isInt32()) {
47+
// silently does nothing when an invalid timeoutID (should be an int32 value) is passed in
48+
if (!timeoutIdArg.isNumber()) {
4949
return true;
5050
}
5151

5252
// Retrieve the AsyncHandle by `timeoutID`
53-
int32_t timeoutID = timeoutIdArg.toInt32();
53+
double timeoutID = timeoutIdArg.toNumber();
5454
AsyncHandle *handle = AsyncHandle::fromId((uint32_t)timeoutID);
5555
if (!handle) return true; // does nothing on invalid timeoutID
5656

0 commit comments

Comments
 (0)