diff options
author | isaacs <i@izs.me> | 2012-09-28 09:47:48 -0700 |
---|---|---|
committer | isaacs <i@izs.me> | 2012-09-28 09:47:48 -0700 |
commit | ae40f1c438050bf4607143862259ae10931e3a3c (patch) | |
tree | 0e90ed620fd8dd2eab01388eacbfae1615359553 /lib | |
parent | d68c02e3fe50405279a138e908701558939ce926 (diff) | |
parent | 33a5c8a814483ff48ba3acd94e091335b3536870 (diff) | |
download | android-node-v8-ae40f1c438050bf4607143862259ae10931e3a3c.tar.gz android-node-v8-ae40f1c438050bf4607143862259ae10931e3a3c.tar.bz2 android-node-v8-ae40f1c438050bf4607143862259ae10931e3a3c.zip |
Merge remote-tracking branch 'ry/v0.8' into v0.8-merge
Conflicts:
AUTHORS
ChangeLog
deps/openssl/openssl.gyp
deps/uv/src/unix/linux/linux-core.c
deps/uv/src/unix/process.c
deps/uv/src/unix/stream.c
deps/v8/src/arm/builtins-arm.cc
deps/v8/src/arm/code-stubs-arm.cc
deps/v8/src/arm/full-codegen-arm.cc
lib/tls.js
src/node_version.h
test/simple/test-http-client-timeout-agent.js
Diffstat (limited to 'lib')
-rw-r--r-- | lib/domain.js | 5 | ||||
-rw-r--r-- | lib/events.js | 16 | ||||
-rw-r--r-- | lib/fs.js | 5 | ||||
-rw-r--r-- | lib/http.js | 6 | ||||
-rw-r--r-- | lib/repl.js | 3 |
5 files changed, 29 insertions, 6 deletions
diff --git a/lib/domain.js b/lib/domain.js index e219c5e507..fe71235e1e 100644 --- a/lib/domain.js +++ b/lib/domain.js @@ -59,7 +59,7 @@ function uncaughtHandler(er) { domain_thrown: true }); exports.active.emit('error', er); - exports.active.exit(); + if (exports.active) exports.active.exit(); } else if (process.listeners('uncaughtException').length === 1) { // if there are other handlers, then they'll take care of it. // but if not, then we need to crash now. @@ -209,6 +209,9 @@ Domain.prototype.bind = function(cb, interceptError) { Domain.prototype.dispose = function() { if (this._disposed) return; + // if we're the active domain, then get out now. + this.exit(); + this.emit('dispose'); // remove error handlers. diff --git a/lib/events.js b/lib/events.js index 11f91b5ccb..d71380dcd6 100644 --- a/lib/events.js +++ b/lib/events.js @@ -45,6 +45,8 @@ EventEmitter.prototype.setMaxListeners = function(n) { this._maxListeners = n; }; +// non-global reference, for speed. +var PROCESS; EventEmitter.prototype.emit = function() { var type = arguments[0]; @@ -77,7 +79,10 @@ EventEmitter.prototype.emit = function() { if (typeof handler == 'function') { if (this.domain) { - this.domain.enter(); + PROCESS = PROCESS || process; + if (this !== PROCESS) { + this.domain.enter(); + } } switch (arguments.length) { // fast cases @@ -97,14 +102,17 @@ EventEmitter.prototype.emit = function() { for (var i = 1; i < l; i++) args[i - 1] = arguments[i]; handler.apply(this, args); } - if (this.domain) { + if (this.domain && this !== PROCESS) { this.domain.exit(); } return true; } else if (isArray(handler)) { if (this.domain) { - this.domain.enter(); + PROCESS = PROCESS || process; + if (this !== PROCESS) { + this.domain.enter(); + } } var l = arguments.length; var args = new Array(l - 1); @@ -114,7 +122,7 @@ EventEmitter.prototype.emit = function() { for (var i = 0, l = listeners.length; i < l; i++) { listeners[i].apply(this, args); } - if (this.domain) { + if (this.domain && this !== PROCESS) { this.domain.exit(); } return true; @@ -956,7 +956,10 @@ function StatWatcher() { var oldStatus = -1; this._handle.onchange = function(current, previous, newStatus) { - if (oldStatus == -1 && newStatus == -1) return; + if (oldStatus === -1 && + newStatus === -1 && + current.nlink === previous.nlink) return; + oldStatus = newStatus; self.emit('change', current, previous); }; diff --git a/lib/http.js b/lib/http.js index c4e0a77aad..afa55b9423 100644 --- a/lib/http.js +++ b/lib/http.js @@ -1421,6 +1421,12 @@ function parserOnIncomingClient(res, shouldKeepAlive) { var socket = this.socket; var req = socket._httpMessage; + // propogate "domain" setting... + if (req.domain && !res.domain) { + debug('setting "res.domain"'); + res.domain = req.domain; + } + debug('AGENT incoming response!'); if (req.res) { diff --git a/lib/repl.js b/lib/repl.js index dee6f2d3af..361745fc16 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -271,6 +271,9 @@ function REPLServer(prompt, stream, eval_, useGlobal, ignoreUndefined) { // Convert error to string e = e && (e.stack || e.toString()); return e && e.match(/^SyntaxError/) && + // RegExp syntax error + !e.match(/^SyntaxError: Invalid regular expression/) && + // JSON.parse() error !(e.match(/^SyntaxError: Unexpected token .*\n/) && e.match(/\n at Object.parse \(native\)\n/)); } |