Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

domain: fix dispose call inside another domain

since 0400571 dispose exits the domain
however if the active domain wasn't the disposed domain, then the active
domain would get out of sync
  • Loading branch information...
commit 5915c2f5e091edf6ca708e0828f742ee11c2c59b 1 parent 38c72d4
@AndreasMadsen authored
Showing with 17 additions and 1 deletion.
  1. +1 −1  lib/domain.js
  2. +16 −0 test/simple/test-domain-dispose-exit.js
View
2  lib/domain.js
@@ -210,7 +210,7 @@ Domain.prototype.dispose = function() {
if (this._disposed) return;
// if we're the active domain, then get out now.
- this.exit();
+ if (exports.active === this) this.exit();
this.emit('dispose');
View
16 test/simple/test-domain-dispose-exit.js
@@ -0,0 +1,16 @@
+
+var domain = require('domain');
+var assert = require('assert');
+
+var d = domain.create();
+
+d.run(function () {
+
+ var dd = domain.create();
+ dd.run(function () {
+ d.dispose();
+
+ assert.strictEqual(domain.active, dd);
+ });
+});
+
Please sign in to comment.
Something went wrong with that request. Please try again.