mirror of
https://github.com/nodejs/node.git
synced 2024-11-24 20:29:23 +01:00
Merge remote-tracking branch 'origin/v0.10'
Conflicts: configure lib/_stream_readable.js lib/http.js src/node_dtrace.cc
This commit is contained in:
commit
78d245f5b2
8
configure
vendored
8
configure
vendored
@ -464,13 +464,15 @@ def configure_node(o):
|
||||
if not is_clang and cc_version < (4,0,0):
|
||||
o['variables']['visibility'] = ''
|
||||
|
||||
if flavor in ('solaris', 'mac', 'linux'):
|
||||
if flavor in ('solaris', 'mac', 'linux', 'freebsd'):
|
||||
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 options.systemtap_includes:
|
||||
o['include_dirs'] += [options.systemtap_includes]
|
||||
use_dtrace = options.with_dtrace
|
||||
o['variables']['node_use_dtrace'] = b(use_dtrace)
|
||||
o['variables']['uv_use_dtrace'] = b(use_dtrace)
|
||||
o['variables']['uv_parent_path'] = '/deps/uv/'
|
||||
|
@ -39,7 +39,7 @@ Tests strict non-equality, as determined by the strict not equal operator ( `!==
|
||||
|
||||
## 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.
|
||||
|
||||
Validate instanceof using constructor:
|
||||
@ -76,7 +76,7 @@ Custom error validation:
|
||||
|
||||
## 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)
|
||||
|
||||
|
@ -53,7 +53,7 @@ function ClientRequest(options, cb) {
|
||||
var defaultAgent = options._defaultAgent || Agent.globalAgent;
|
||||
if (agent === false) {
|
||||
agent = new defaultAgent.constructor();
|
||||
} else if (util.isNullOrUndefined(agent)) {
|
||||
} else if (util.isNullOrUndefined(agent) && !options.createConnection) {
|
||||
agent = defaultAgent;
|
||||
}
|
||||
self.agent = agent;
|
||||
@ -70,9 +70,9 @@ function ClientRequest(options, cb) {
|
||||
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';
|
||||
|
||||
if (util.isUndefined(options.setHost)) {
|
||||
|
@ -373,8 +373,7 @@ function chunkInvalid(state, chunk) {
|
||||
if (!util.isBuffer(chunk) &&
|
||||
!util.isString(chunk) &&
|
||||
!util.isNullOrUndefined(chunk) &&
|
||||
!state.objectMode &&
|
||||
!er) {
|
||||
!state.objectMode) {
|
||||
er = new TypeError('Invalid non-string/buffer chunk');
|
||||
}
|
||||
return er;
|
||||
|
@ -1,5 +1,8 @@
|
||||
// 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
|
||||
// copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
|
@ -201,10 +201,11 @@ function objEquiv(a, b) {
|
||||
if (a.prototype !== b.prototype) return false;
|
||||
//~~~I've managed to break Object.keys through screwy arguments passing.
|
||||
// Converting to array solves the problem.
|
||||
if (isArguments(a)) {
|
||||
if (!isArguments(b)) {
|
||||
return false;
|
||||
}
|
||||
var aIsArgs = isArguments(a),
|
||||
bIsArgs = isArguments(b);
|
||||
if ((aIsArgs && !bIsArgs) || (!aIsArgs && bIsArgs))
|
||||
return false;
|
||||
if (aIsArgs) {
|
||||
a = pSlice.call(a);
|
||||
b = pSlice.call(b);
|
||||
return _deepEqual(a, b);
|
||||
|
34
node.gyp
34
node.gyp
@ -187,8 +187,12 @@
|
||||
}],
|
||||
[ 'node_use_dtrace=="true"', {
|
||||
'defines': [ 'HAVE_DTRACE=1' ],
|
||||
'dependencies': [ 'node_dtrace_header' ],
|
||||
'dependencies': [
|
||||
'node_dtrace_header',
|
||||
'specialize_node_d',
|
||||
],
|
||||
'include_dirs': [ '<(SHARED_INTERMEDIATE_DIR)' ],
|
||||
|
||||
#
|
||||
# DTrace is supported on linux, solaris, mac, and bsd. There are
|
||||
# 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
|
||||
}
|
||||
|
@ -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);
|
||||
/*
|
||||
* 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);
|
||||
return 0;
|
||||
}
|
||||
|
@ -249,6 +249,11 @@ try {
|
||||
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');
|
||||
assert.ok(gotError);
|
||||
|
||||
|
47
test/simple/test-http-createConnection.js
Normal file
47
test/simple/test-http-createConnection.js
Normal file
@ -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');
|
||||
}
|
@ -129,10 +129,8 @@ def subdir_files(path, dest, action):
|
||||
def files(action):
|
||||
action(['out/Release/node'], 'bin/node')
|
||||
|
||||
# install unconditionally, checking if the platform supports dtrace doesn't
|
||||
# work when cross-compiling and besides, there's at least one linux flavor
|
||||
# with dtrace support now (oracle's "unbreakable" linux)
|
||||
action(['src/node.d'], 'lib/dtrace/')
|
||||
if 'true' == variables.get('node_use_dtrace'):
|
||||
action(['out/Release/node.d'], 'lib/dtrace/node.d')
|
||||
|
||||
# behave similarly for systemtap
|
||||
action(['src/node.stp'], 'share/systemtap/tapset/')
|
||||
|
32
tools/specialize_node_d.py
Executable file
32
tools/specialize_node_d.py
Executable file
@ -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…
Reference in New Issue
Block a user