Skip to content

Commit 1e14233

Browse files
committed
lib: fix undefined timeout regression
63644dd introduced a regression caused by everyone's favourite JavaScript feature: undefined < 0 === undefined >= 0. Add a case to the existing tests to cover this scenario and then add the check for undefined that makes the test pass.
1 parent 47db247 commit 1e14233

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

lib/timers.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ var lists = {};
3030
// with them.
3131
exports.active = function(item) {
3232
const msecs = item._idleTimeout;
33-
if (msecs < 0) return;
33+
if (msecs < 0 || msecs === undefined) return;
3434

3535
item._idleStart = Timer.now();
3636

test/parallel/test-timers-active.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ legitTimers.forEach(function(legit) {
2222

2323
// active() should not create a timer for these
2424
var bogusTimers = [
25-
{ _idleTimeout: -1 }
25+
{ _idleTimeout: -1 },
26+
{ _idleTimeout: undefined }
2627
];
2728

2829
bogusTimers.forEach(function(bogus) {

0 commit comments

Comments
 (0)