@@ -75,21 +75,12 @@ function Domain() {
7575}
7676
7777Domain . prototype . members = undefined ;
78- Domain . prototype . _disposed = undefined ;
7978
8079
8180// Called by process._fatalException in case an error was thrown.
8281Domain . prototype . _errorHandler = function _errorHandler ( er ) {
8382 var caught = false ;
8483
85- // ignore errors on disposed domains.
86- //
87- // XXX This is a bit stupid. We should probably get rid of
88- // domain.dispose() altogether. It's almost always a terrible
89- // idea. --isaacs
90- if ( this . _disposed )
91- return true ;
92-
9384 if ( ! util . isPrimitive ( er ) ) {
9485 er . domain = this ;
9586 er . domainThrown = true ;
@@ -160,8 +151,6 @@ Domain.prototype._errorHandler = function _errorHandler(er) {
160151
161152
162153Domain . prototype . enter = function ( ) {
163- if ( this . _disposed ) return ;
164-
165154 // note that this might be a no-op, but we still need
166155 // to push it onto the stack so that we can pop it later.
167156 exports . active = process . domain = this ;
@@ -171,10 +160,9 @@ Domain.prototype.enter = function() {
171160
172161
173162Domain . prototype . exit = function ( ) {
174- // skip disposed domains, as usual, but also don't do anything if this
175- // domain is not on the stack.
163+ // don't do anything if this domain is not on the stack.
176164 var index = stack . lastIndexOf ( this ) ;
177- if ( this . _disposed || index === - 1 ) return ;
165+ if ( index === - 1 ) return ;
178166
179167 // exit all domains until this one.
180168 stack . splice ( index ) ;
@@ -187,8 +175,8 @@ Domain.prototype.exit = function() {
187175
188176// note: this works for timers as well.
189177Domain . prototype . add = function ( ee ) {
190- // If the domain is disposed or already added, then nothing left to do.
191- if ( this . _disposed || ee . domain === this )
178+ // If the domain is already added, then nothing left to do.
179+ if ( ee . domain === this )
192180 return ;
193181
194182 // has a domain already - remove it first.
@@ -224,9 +212,6 @@ Domain.prototype.remove = function(ee) {
224212
225213
226214Domain . prototype . run = function ( fn ) {
227- if ( this . _disposed )
228- return ;
229-
230215 var ret ;
231216
232217 this . enter ( ) ;
@@ -248,9 +233,6 @@ Domain.prototype.run = function(fn) {
248233
249234
250235function intercepted ( _this , self , cb , fnargs ) {
251- if ( self . _disposed )
252- return ;
253-
254236 if ( fnargs [ 0 ] && fnargs [ 0 ] instanceof Error ) {
255237 var er = fnargs [ 0 ] ;
256238 util . _extend ( er , {
@@ -291,9 +273,6 @@ Domain.prototype.intercept = function(cb) {
291273
292274
293275function bound ( _this , self , cb , fnargs ) {
294- if ( self . _disposed )
295- return ;
296-
297276 var ret ;
298277
299278 self . enter ( ) ;
@@ -318,22 +297,3 @@ Domain.prototype.bind = function(cb) {
318297
319298 return runBound ;
320299} ;
321-
322-
323- Domain . prototype . dispose = util . deprecate ( function ( ) {
324- if ( this . _disposed ) return ;
325-
326- // if we're the active domain, then get out now.
327- this . exit ( ) ;
328-
329- // remove from parent domain, if there is one.
330- if ( this . domain ) this . domain . remove ( this ) ;
331-
332- // kill the references so that they can be properly gc'ed.
333- this . members . length = 0 ;
334-
335- // mark this domain as 'no longer relevant'
336- // so that it can't be entered or activated.
337- this . _disposed = true ;
338- } , 'Domain.dispose is deprecated. Recover from failed I/O actions explicitly ' +
339- 'via error event handlers set on the domain instead.' , 'DEP0012' ) ;
0 commit comments