Skip to content

Commit 33b213c

Browse files
committed
[Squash] set _list to undefined
1 parent 29bd0ce commit 33b213c

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

lib/timers.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,9 @@ Timeout.prototype.unref = function() {
538538
}
539539

540540
var handle = reuse(this);
541-
if (handle) handle._list = null;
541+
if (handle) {
542+
handle._list = undefined;
543+
}
542544

543545
this._handle = handle || new TimerWrap();
544546
this._handle.owner = this;

test/parallel/test-timers-unref-reuse-no-exposed-list.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@
33
require('../common');
44
const assert = require('assert');
55

6-
// In a case of handle re-use, _list should be null rather than undefined.
76
const timer1 = setTimeout(() => {}, 1).unref();
8-
assert.strictEqual(timer1._handle._list, null,
9-
'timer1._handle._list should be nulled.');
7+
assert.strictEqual(timer1._handle._list, undefined,
8+
'timer1._handle._list should be undefined');
109

1110
// Check that everything works even if the handle was not re-used.
1211
setTimeout(() => {}, 1);
1312
const timer2 = setTimeout(() => {}, 1).unref();
1413
// Note: It is unlikely that this assertion will be hit in a failure.
1514
// Instead, timers.js will likely throw a TypeError internally.
1615
assert.strictEqual(timer2._handle._list, undefined,
17-
'timer2._handle._list should not exist');
16+
'timer2._handle._list should be undefined');

0 commit comments

Comments
 (0)