mirror of
https://github.com/nodejs/node.git
synced 2026-11-21 12:59:16 -05:00
Merge remote-tracking branch 'ry/v0.8'
Conflicts: ChangeLog deps/uv/src/unix/sunos.c deps/uv/test/test-tcp-unexpected-read.c src/node_version.h
This commit is contained in:
commit
3bf1846bb7
586 files changed
+5638
-59111
No files matched your search
@@ -0,0 +1,53 @@
|
||||
|
||||
// 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 spawn = require('child_process').spawn;
|
||||
|
||||
function run(cmd, strict, cb) {
|
||||
var args = [];
|
||||
if (strict) args.push('--use_strict');
|
||||
args.push('-pe', cmd);
|
||||
var child = spawn(process.execPath, args);
|
||||
child.stdout.pipe(process.stdout);
|
||||
child.stderr.pipe(process.stdout);
|
||||
child.on('close', cb);
|
||||
}
|
||||
|
||||
var queue =
|
||||
[ 'with(this){__filename}',
|
||||
'42',
|
||||
'throw new Error("hello")',
|
||||
'var x = 100; y = x;',
|
||||
'var ______________________________________________; throw 10' ];
|
||||
|
||||
function go() {
|
||||
var c = queue.shift();
|
||||
if (!c) return console.log('done');
|
||||
run(c, false, function() {
|
||||
run(c, true, go);
|
||||
});
|
||||
}
|
||||
|
||||
go();
|
||||
@@ -0,0 +1,58 @@
|
||||
[eval]
|
||||
|
||||
[eval]:1
|
||||
with(this){__filename}
|
||||
^^^^
|
||||
SyntaxError: Strict mode code may not include a with statement
|
||||
at Object.<anonymous> ([eval]-wrapper:6:22)
|
||||
at Module._compile (module.js:449:26)
|
||||
at evalScript (node.js:282:25)
|
||||
at startup (node.js:76:7)
|
||||
at node.js:623:3
|
||||
42
|
||||
42
|
||||
|
||||
[eval]:1
|
||||
throw new Error("hello")
|
||||
^
|
||||
Error: hello
|
||||
at [eval]:1:7
|
||||
at Object.<anonymous> ([eval]-wrapper:6:22)
|
||||
at Module._compile (module.js:449:26)
|
||||
at evalScript (node.js:282:25)
|
||||
at startup (node.js:76:7)
|
||||
at node.js:623:3
|
||||
|
||||
[eval]:1
|
||||
throw new Error("hello")
|
||||
^
|
||||
Error: hello
|
||||
at [eval]:1:7
|
||||
at Object.<anonymous> ([eval]-wrapper:6:22)
|
||||
at Module._compile (module.js:449:26)
|
||||
at evalScript (node.js:282:25)
|
||||
at startup (node.js:76:7)
|
||||
at node.js:623:3
|
||||
100
|
||||
|
||||
[eval]:1
|
||||
var x = 100; y = x;
|
||||
^
|
||||
ReferenceError: y is not defined
|
||||
at [eval]:1:16
|
||||
at Object.<anonymous> ([eval]-wrapper:6:22)
|
||||
at Module._compile (module.js:449:26)
|
||||
at evalScript (node.js:282:25)
|
||||
at startup (node.js:76:7)
|
||||
at node.js:623:3
|
||||
|
||||
[eval]:1
|
||||
var ______________________________________________; throw 10
|
||||
^
|
||||
10
|
||||
|
||||
[eval]:1
|
||||
var ______________________________________________; throw 10
|
||||
^
|
||||
10
|
||||
done
|
||||
@@ -0,0 +1,54 @@
|
||||
|
||||
// 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 spawn = require('child_process').spawn;
|
||||
|
||||
function run(cmd, strict, cb) {
|
||||
var args = [];
|
||||
if (strict) args.push('--use_strict');
|
||||
args.push('-p');
|
||||
var child = spawn(process.execPath, args);
|
||||
child.stdout.pipe(process.stdout);
|
||||
child.stderr.pipe(process.stdout);
|
||||
child.stdin.end(cmd);
|
||||
child.on('close', cb);
|
||||
}
|
||||
|
||||
var queue =
|
||||
[ 'with(this){__filename}',
|
||||
'42',
|
||||
'throw new Error("hello")',
|
||||
'var x = 100; y = x;',
|
||||
'var ______________________________________________; throw 10' ];
|
||||
|
||||
function go() {
|
||||
var c = queue.shift();
|
||||
if (!c) return console.log('done');
|
||||
run(c, false, function() {
|
||||
run(c, true, go);
|
||||
});
|
||||
}
|
||||
|
||||
go();
|
||||
@@ -0,0 +1,62 @@
|
||||
[stdin]
|
||||
|
||||
[stdin]:1
|
||||
with(this){__filename}
|
||||
^^^^
|
||||
SyntaxError: Strict mode code may not include a with statement
|
||||
at Object.<anonymous> ([stdin]-wrapper:6:22)
|
||||
at Module._compile (module.js:449:26)
|
||||
at evalScript (node.js:282:25)
|
||||
at Socket.<anonymous> (node.js:152:11)
|
||||
at Socket.EventEmitter.emit (events.js:85:17)
|
||||
at Pipe.onread (net.js:424:51)
|
||||
42
|
||||
42
|
||||
|
||||
[stdin]:1
|
||||
throw new Error("hello")
|
||||
^
|
||||
Error: hello
|
||||
at [stdin]:1:7
|
||||
at Object.<anonymous> ([stdin]-wrapper:6:22)
|
||||
at Module._compile (module.js:449:26)
|
||||
at evalScript (node.js:282:25)
|
||||
at Socket.<anonymous> (node.js:152:11)
|
||||
at Socket.EventEmitter.emit (events.js:85:17)
|
||||
at Pipe.onread (net.js:424:51)
|
||||
|
||||
[stdin]:1
|
||||
throw new Error("hello")
|
||||
^
|
||||
Error: hello
|
||||
at [stdin]:1:7
|
||||
at Object.<anonymous> ([stdin]-wrapper:6:22)
|
||||
at Module._compile (module.js:449:26)
|
||||
at evalScript (node.js:282:25)
|
||||
at Socket.<anonymous> (node.js:152:11)
|
||||
at Socket.EventEmitter.emit (events.js:85:17)
|
||||
at Pipe.onread (net.js:424:51)
|
||||
100
|
||||
|
||||
[stdin]:1
|
||||
var x = 100; y = x;
|
||||
^
|
||||
ReferenceError: y is not defined
|
||||
at [stdin]:1:16
|
||||
at Object.<anonymous> ([stdin]-wrapper:6:22)
|
||||
at Module._compile (module.js:449:26)
|
||||
at evalScript (node.js:282:25)
|
||||
at Socket.<anonymous> (node.js:152:11)
|
||||
at Socket.EventEmitter.emit (events.js:85:17)
|
||||
at Pipe.onread (net.js:424:51)
|
||||
|
||||
[stdin]:1
|
||||
var ______________________________________________; throw 10
|
||||
^
|
||||
10
|
||||
|
||||
[stdin]:1
|
||||
var ______________________________________________; throw 10
|
||||
^
|
||||
10
|
||||
done
|
||||
@@ -283,3 +283,13 @@ testAssertionMessage({a: undefined, b: null}, '{"a":"undefined","b":null}');
|
||||
testAssertionMessage({a: NaN, b: Infinity, c: -Infinity},
|
||||
'{"a":"NaN","b":"Infinity","c":"-Infinity"}');
|
||||
|
||||
// #2893
|
||||
try {
|
||||
assert.throws(function () {
|
||||
assert.ifError(null);
|
||||
});
|
||||
} catch (e) {
|
||||
threw = true;
|
||||
assert.equal(e.message, 'Missing expected exception..');
|
||||
}
|
||||
assert.ok(threw);
|
||||
@@ -19,21 +19,22 @@
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
var common = require('../common.js'),
|
||||
assert = require('assert'),
|
||||
child = require('child_process'),
|
||||
nodejs = '"' + process.execPath + '"';
|
||||
|
||||
// replace \ by / because windows uses backslashes in paths, but they're still
|
||||
// interpreted as the escape character when put between quotes.
|
||||
var filename = __filename.replace(/\\/g, '/');
|
||||
|
||||
if (module.parent) {
|
||||
// signal we've been loaded as a module
|
||||
console.log('Loaded as a module, exiting with status code 42.');
|
||||
process.exit(42);
|
||||
}
|
||||
|
||||
var common = require('../common.js'),
|
||||
assert = require('assert'),
|
||||
child = require('child_process'),
|
||||
nodejs = '"' + process.execPath + '"';
|
||||
|
||||
|
||||
// replace \ by / because windows uses backslashes in paths, but they're still
|
||||
// interpreted as the escape character when put between quotes.
|
||||
var filename = __filename.replace(/\\/g, '/');
|
||||
|
||||
// assert that nothing is written to stdout
|
||||
child.exec(nodejs + ' --eval 42',
|
||||
function(err, stdout, stderr) {
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
// 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 cluster = require('cluster');
|
||||
var net = require('net');
|
||||
|
||||
if (cluster.isMaster) {
|
||||
// ensure that the worker exits peacefully
|
||||
var worker = cluster.fork();
|
||||
worker.on('exit', function(statusCode) {
|
||||
assert.equal(statusCode, 0);
|
||||
worker = null;
|
||||
});
|
||||
process.on('exit', function() {
|
||||
assert.equal(worker, null);
|
||||
});
|
||||
}
|
||||
else {
|
||||
// listen() without port should not trigger a libuv assert
|
||||
net.createServer(assert.fail).listen(process.exit);
|
||||
}
|
||||
@@ -86,6 +86,11 @@ var file2 = fs.createReadStream(fn);
|
||||
file2.destroy(function(err) {
|
||||
assert.ok(!err);
|
||||
callbacks.destroy++;
|
||||
|
||||
file2.destroy(function(err) {
|
||||
assert.ok(!err);
|
||||
callbacks.destroy++;
|
||||
});
|
||||
});
|
||||
|
||||
var file3 = fs.createReadStream(fn, {encoding: 'utf8'});
|
||||
@@ -107,7 +112,7 @@ file3.on('close', function() {
|
||||
process.on('exit', function() {
|
||||
assert.equal(1, callbacks.open);
|
||||
assert.equal(1, callbacks.end);
|
||||
assert.equal(1, callbacks.destroy);
|
||||
assert.equal(2, callbacks.destroy);
|
||||
|
||||
assert.equal(2, callbacks.close);
|
||||
|
||||
|
||||
+11
-5
@@ -23,8 +23,14 @@ var common = require('../common');
|
||||
var assert = require('assert');
|
||||
var net = require('net');
|
||||
|
||||
var sock = net.connect(1234, 'localhost');
|
||||
sock.pause();
|
||||
sock.resume();
|
||||
console.log('ok');
|
||||
process.exit(0);
|
||||
var gotError = false;
|
||||
|
||||
process.on('exit', function() {
|
||||
assert.equal(gotError, true);
|
||||
});
|
||||
|
||||
// this should fail with an async EINVAL error, not throw an exception
|
||||
net.createServer(assert.fail).listen({fd:0}).on('error', function(e) {
|
||||
assert.equal(e.code, 'EINVAL');
|
||||
gotError = true;
|
||||
});
|
||||
@@ -0,0 +1,101 @@
|
||||
// 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'),
|
||||
assert = require('assert'),
|
||||
net = require('net');
|
||||
|
||||
var connections = 0,
|
||||
dataEvents = 0,
|
||||
conn;
|
||||
|
||||
|
||||
// Server
|
||||
var server = net.createServer(function(conn) {
|
||||
connections++;
|
||||
conn.end('This was the year he fell to pieces.');
|
||||
|
||||
if (connections === 5)
|
||||
server.close();
|
||||
});
|
||||
|
||||
server.listen(common.PORT);
|
||||
|
||||
|
||||
// Client 1
|
||||
conn = require('net').createConnection(common.PORT, 'localhost');
|
||||
conn.resume();
|
||||
conn.on('data', onDataOk);
|
||||
|
||||
|
||||
// Client 2
|
||||
conn = require('net').createConnection(common.PORT, 'localhost');
|
||||
conn.pause();
|
||||
conn.resume();
|
||||
conn.on('data', onDataOk);
|
||||
|
||||
|
||||
// Client 3
|
||||
conn = require('net').createConnection(common.PORT, 'localhost');
|
||||
conn.pause();
|
||||
conn.on('data', onDataError);
|
||||
scheduleTearDown(conn);
|
||||
|
||||
|
||||
// Client 4
|
||||
conn = require('net').createConnection(common.PORT, 'localhost');
|
||||
conn.resume();
|
||||
conn.pause();
|
||||
conn.resume();
|
||||
conn.on('data', onDataOk);
|
||||
|
||||
|
||||
// Client 5
|
||||
conn = require('net').createConnection(common.PORT, 'localhost');
|
||||
conn.resume();
|
||||
conn.resume();
|
||||
conn.pause();
|
||||
conn.on('data', onDataError);
|
||||
scheduleTearDown(conn);
|
||||
|
||||
|
||||
// Client helper functions
|
||||
function onDataError() {
|
||||
assert(false);
|
||||
}
|
||||
|
||||
function onDataOk() {
|
||||
dataEvents++;
|
||||
}
|
||||
|
||||
function scheduleTearDown(conn) {
|
||||
setTimeout(function() {
|
||||
conn.removeAllListeners('data');
|
||||
conn.resume();
|
||||
}, 100);
|
||||
}
|
||||
|
||||
|
||||
// Exit sanity checks
|
||||
process.on('exit', function() {
|
||||
assert.strictEqual(connections, 5);
|
||||
assert.strictEqual(dataEvents, 3);
|
||||
});
|
||||
Reference in new issue
Block a user