diff --git a/lib/timers.js b/lib/timers.js index d637ca91ae48e9..a6adbf74f255d6 100644 --- a/lib/timers.js +++ b/lib/timers.js @@ -603,7 +603,6 @@ Timeout.prototype.unref = function() { this._handle.owner = this; this._handle[kOnTimeout] = unrefdHandle; this._handle.start(delay); - this._handle.domain = this.domain; this._handle.unref(); } return this; diff --git a/test/parallel/test-domain-timers.js b/test/parallel/test-domain-timers.js index fe7247b2a92c95..f9857a991af880 100644 --- a/test/parallel/test-domain-timers.js +++ b/test/parallel/test-domain-timers.js @@ -30,13 +30,19 @@ timeoutd.on('error', common.mustCall(function(e) { assert.strictEqual(e.message, 'Timeout UNREFd', 'Domain should catch timer error'); clearTimeout(timeout); -})); +}, 2)); +let t; timeoutd.run(function() { setTimeout(function() { throw new Error('Timeout UNREFd'); }, 0).unref(); + + t = setTimeout(function() { + throw new Error('Timeout UNREFd'); + }, 0); }); +t.unref(); const immediated = domain.create();