Browse Source

Merge remote-tracking branch 'origin/v0.10'

Conflicts:
	configure
	lib/_stream_readable.js
	lib/http.js
	src/node_dtrace.cc
v0.11.12-release
Fedor Indutny 11 years ago
parent
commit
78d245f5b2
  1. 8
      configure
  2. 4
      doc/api/assert.markdown
  3. 6
      lib/_http_client.js
  4. 3
      lib/_stream_readable.js
  5. 3
      lib/_tls_wrap.js
  6. 9
      lib/assert.js
  7. 34
      node.gyp
  8. 4
      src/node_dtrace.cc
  9. 5
      test/simple/test-assert.js
  10. 47
      test/simple/test-http-createConnection.js
  11. 6
      tools/install.py
  12. 32
      tools/specialize_node_d.py

8
configure

@ -464,13 +464,15 @@ def configure_node(o):
if not is_clang and cc_version < (4,0,0): if not is_clang and cc_version < (4,0,0):
o['variables']['visibility'] = '' o['variables']['visibility'] = ''
if flavor in ('solaris', 'mac', 'linux'): if flavor in ('solaris', 'mac', 'linux', 'freebsd'):
use_dtrace = not options.without_dtrace use_dtrace = not options.without_dtrace
# Don't enable by default on linux, it needs the sdt-devel package. # Don't enable by default on linux and freebsd
if flavor in ('linux', 'freebsd'):
use_dtrace = options.with_dtrace
if flavor == 'linux': if flavor == 'linux':
if options.systemtap_includes: if options.systemtap_includes:
o['include_dirs'] += [options.systemtap_includes] o['include_dirs'] += [options.systemtap_includes]
use_dtrace = options.with_dtrace
o['variables']['node_use_dtrace'] = b(use_dtrace) o['variables']['node_use_dtrace'] = b(use_dtrace)
o['variables']['uv_use_dtrace'] = b(use_dtrace) o['variables']['uv_use_dtrace'] = b(use_dtrace)
o['variables']['uv_parent_path'] = '/deps/uv/' o['variables']['uv_parent_path'] = '/deps/uv/'

4
doc/api/assert.markdown

@ -39,7 +39,7 @@ Tests strict non-equality, as determined by the strict not equal operator ( `!==
## assert.throws(block, [error], [message]) ## assert.throws(block, [error], [message])
Expects `block` to throw an error. `error` can be constructor, regexp or Expects `block` to throw an error. `error` can be constructor, `RegExp` or
validation function. validation function.
Validate instanceof using constructor: Validate instanceof using constructor:
@ -76,7 +76,7 @@ Custom error validation:
## assert.doesNotThrow(block, [message]) ## assert.doesNotThrow(block, [message])
Expects `block` not to throw an error, see assert.throws for details. Expects `block` not to throw an error, see `assert.throws` for details.
## assert.ifError(value) ## assert.ifError(value)

6
lib/_http_client.js

@ -53,7 +53,7 @@ function ClientRequest(options, cb) {
var defaultAgent = options._defaultAgent || Agent.globalAgent; var defaultAgent = options._defaultAgent || Agent.globalAgent;
if (agent === false) { if (agent === false) {
agent = new defaultAgent.constructor(); agent = new defaultAgent.constructor();
} else if (util.isNullOrUndefined(agent)) { } else if (util.isNullOrUndefined(agent) && !options.createConnection) {
agent = defaultAgent; agent = defaultAgent;
} }
self.agent = agent; self.agent = agent;
@ -70,9 +70,9 @@ function ClientRequest(options, cb) {
throw new Error('Protocol:' + options.protocol + ' not supported.'); throw new Error('Protocol:' + options.protocol + ' not supported.');
} }
var defaultPort = options.defaultPort || self.agent.defaultPort; var defaultPort = options.defaultPort || self.agent && self.agent.defaultPort;
var port = options.port = options.port || defaultPort; var port = options.port = options.port || defaultPort || 80;
var host = options.host = options.hostname || options.host || 'localhost'; var host = options.host = options.hostname || options.host || 'localhost';
if (util.isUndefined(options.setHost)) { if (util.isUndefined(options.setHost)) {

3
lib/_stream_readable.js

@ -373,8 +373,7 @@ function chunkInvalid(state, chunk) {
if (!util.isBuffer(chunk) && if (!util.isBuffer(chunk) &&
!util.isString(chunk) && !util.isString(chunk) &&
!util.isNullOrUndefined(chunk) && !util.isNullOrUndefined(chunk) &&
!state.objectMode && !state.objectMode) {
!er) {
er = new TypeError('Invalid non-string/buffer chunk'); er = new TypeError('Invalid non-string/buffer chunk');
} }
return er; return er;

3
lib/_tls_wrap.js

@ -1,5 +1,8 @@
// Copyright Joyent, Inc. and other Node contributors. // Copyright Joyent, Inc. and other Node contributors.
// //
// // Emit `beforeExit` if the loop became alive either after emitting
// event, or after running some callbacks.
//
// Permission is hereby granted, free of charge, to any person obtaining a // Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the // copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including

9
lib/assert.js

@ -201,10 +201,11 @@ function objEquiv(a, b) {
if (a.prototype !== b.prototype) return false; if (a.prototype !== b.prototype) return false;
//~~~I've managed to break Object.keys through screwy arguments passing. //~~~I've managed to break Object.keys through screwy arguments passing.
// Converting to array solves the problem. // Converting to array solves the problem.
if (isArguments(a)) { var aIsArgs = isArguments(a),
if (!isArguments(b)) { bIsArgs = isArguments(b);
return false; if ((aIsArgs && !bIsArgs) || (!aIsArgs && bIsArgs))
} return false;
if (aIsArgs) {
a = pSlice.call(a); a = pSlice.call(a);
b = pSlice.call(b); b = pSlice.call(b);
return _deepEqual(a, b); return _deepEqual(a, b);

34
node.gyp

@ -187,8 +187,12 @@
}], }],
[ 'node_use_dtrace=="true"', { [ 'node_use_dtrace=="true"', {
'defines': [ 'HAVE_DTRACE=1' ], 'defines': [ 'HAVE_DTRACE=1' ],
'dependencies': [ 'node_dtrace_header' ], 'dependencies': [
'node_dtrace_header',
'specialize_node_d',
],
'include_dirs': [ '<(SHARED_INTERMEDIATE_DIR)' ], 'include_dirs': [ '<(SHARED_INTERMEDIATE_DIR)' ],
# #
# DTrace is supported on linux, solaris, mac, and bsd. There are # DTrace is supported on linux, solaris, mac, and bsd. There are
# three object files associated with DTrace support, but they're # three object files associated with DTrace support, but they're
@ -544,10 +548,36 @@
] ]
} ], } ],
] ]
} },
] ]
} ], } ],
] ]
},
{
'target_name': 'specialize_node_d',
'type': 'none',
'conditions': [
[ 'node_use_dtrace=="true"', {
'actions': [
{
'action_name': 'specialize_node_d',
'inputs': [
'src/node.d'
],
'outputs': [
'<(PRODUCT_DIR)/node.d',
],
'action': [
'tools/specialize_node_d.py',
'<@(_outputs)',
'<@(_inputs)',
'<@(OS)',
'<@(target_arch)',
],
},
],
} ],
]
} }
] # end targets ] # end targets
} }

4
src/node_dtrace.cc

@ -287,7 +287,7 @@ void DTRACE_HTTP_CLIENT_RESPONSE(const FunctionCallbackInfo<Value>& args) {
} }
static int dtrace_gc_start(GCType type, GCCallbackFlags flags) { int dtrace_gc_start(GCType type, GCCallbackFlags flags) {
NODE_GC_START(type, flags); NODE_GC_START(type, flags);
/* /*
* We avoid the tail-call elimination of the USDT probe (which screws up * We avoid the tail-call elimination of the USDT probe (which screws up
@ -297,7 +297,7 @@ static int dtrace_gc_start(GCType type, GCCallbackFlags flags) {
} }
static int dtrace_gc_done(GCType type, GCCallbackFlags flags) { int dtrace_gc_done(GCType type, GCCallbackFlags flags) {
NODE_GC_DONE(type, flags); NODE_GC_DONE(type, flags);
return 0; return 0;
} }

5
test/simple/test-assert.js

@ -249,6 +249,11 @@ try {
gotError = true; gotError = true;
} }
// GH-7178. Ensure reflexivity of deepEqual with `arguments` objects.
var args = (function() { return arguments; })();
a.throws(makeBlock(a.deepEqual, [], args));
a.throws(makeBlock(a.deepEqual, args, []));
console.log('All OK'); console.log('All OK');
assert.ok(gotError); assert.ok(gotError);

47
test/simple/test-http-createConnection.js

@ -0,0 +1,47 @@
// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
var common = require('../common');
var assert = require('assert');
var http = require('http');
var net = require('net');
var create = 0;
var response = 0;
process.on('exit', function() {
assert.equal(1, create, 'createConnection() http option was not called');
assert.equal(1, response, 'http server "request" callback was not called');
});
var server = http.createServer(function(req, res) {
res.end();
response++;
}).listen(common.PORT, '127.0.0.1', function() {
http.get({ createConnection: createConnection }, function (res) {
res.resume();
server.close();
});
});
function createConnection() {
create++;
return net.createConnection(common.PORT, '127.0.0.1');
}

6
tools/install.py

@ -129,10 +129,8 @@ def subdir_files(path, dest, action):
def files(action): def files(action):
action(['out/Release/node'], 'bin/node') action(['out/Release/node'], 'bin/node')
# install unconditionally, checking if the platform supports dtrace doesn't if 'true' == variables.get('node_use_dtrace'):
# work when cross-compiling and besides, there's at least one linux flavor action(['out/Release/node.d'], 'lib/dtrace/node.d')
# with dtrace support now (oracle's "unbreakable" linux)
action(['src/node.d'], 'lib/dtrace/')
# behave similarly for systemtap # behave similarly for systemtap
action(['src/node.stp'], 'share/systemtap/tapset/') action(['src/node.stp'], 'share/systemtap/tapset/')

32
tools/specialize_node_d.py

@ -0,0 +1,32 @@
#!/usr/bin/env python
#
# specialize_node_d.py output_file src/node.d flavor arch
#
# Specialize node.d for given flavor (`freebsd`) and arch (`x64` or `ia32`)
#
import re
import subprocess
import sys
import errno
if len(sys.argv) != 5:
print "usage: specialize_node_d.py outfile src/node.d flavor arch"
sys.exit(2);
outfile = file(sys.argv[1], 'w');
infile = file(sys.argv[2], 'r');
flavor = sys.argv[3];
arch = sys.argv[4];
model = r'curpsinfo->pr_dmodel == PR_MODEL_ILP32'
for line in infile:
if flavor == 'freebsd':
line = re.sub('procfs.d', 'psinfo.d', line);
if arch == 'x64':
line = re.sub(model, '0', line);
else:
line = re.sub(model, '1', line);
outfile.write(line);
Loading…
Cancel
Save