This commit is contained in:
Joshaven Potter 2010-10-06 23:05:23 -04:00 коммит произвёл Ryan Dahl
Родитель 9481bc1009
Коммит 3d4e4d8909
28 изменённых файлов: 85 добавлений и 86 удалений

Просмотреть файл

@ -59,7 +59,7 @@ assert.AssertionError.prototype.toString = function() {
, JSON.stringify(this.actual)
].join(" ");
}
}
};
// assert.AssertionError instanceof Error
@ -279,7 +279,7 @@ function _throws (shouldThrow, block, err, message) {
(!shouldThrow && threw)) {
throw exception;
}
}
};
// 11. Expected to throw an error:
// assert.throws(block, Error_opt, message_opt);

Просмотреть файл

@ -88,7 +88,7 @@ exports.execFile = function (file /* args, options, callback */) {
stderr += chunk;
if (!killed && stderr.length > options.maxBuffer) {
child.kill(options.killSignal);
killed = true
killed = true;
}
});

Просмотреть файл

@ -3579,8 +3579,7 @@ var RootCaCerts = [
+"I2bw/FWAp/tmGYI1Z2JwOV5vx+qQQEQIHriy1tvuWacNGHk0vFQYXlPKNFHtRQrmjseCNj6nOGOp\n"
+"MCwXEGCSn1WHElkQwg9naRHMTh5+Spqtr0CodaxWkHS4oJyleW/c6RrIaQXpuvoDs3zk4E7Czp3o\n"
+"tkYNbn5XOmeUwssfnHdKZ05phkOTOPu220+DkdRgfks+KzgHVZhepA==\n"
+"-----END CERTIFICATE-----\n",
+"-----END CERTIFICATE-----\n"
];
var sys = require("sys");
@ -3630,45 +3629,45 @@ exports.createCredentials = function(cred) {
}
}
return c;
}
};
exports.Credentials = Credentials;
exports.Hash = Hash;
exports.createHash = function(hash) {
return new Hash(hash);
}
};
exports.Hmac = Hmac;
exports.createHmac = function(hmac, key) {
return (new Hmac).init(hmac, key);
}
};
exports.Cipher = Cipher;
exports.createCipher = function(cipher, key) {
return (new Cipher).init(cipher, key);
}
};
exports.createCipheriv = function(cipher, key, iv) {
return (new Cipher).initiv(cipher, key, iv);
}
};
exports.Decipher = Decipher;
exports.createDecipher = function(cipher, key) {
return (new Decipher).init(cipher, key);
}
};
exports.createDecipheriv = function(cipher, key, iv) {
return (new Decipher).initiv(cipher, key, iv);
}
};
exports.Sign = Sign;
exports.createSign = function(algorithm) {
return (new Sign).init(algorithm);
}
};
exports.Verify = Verify;
exports.createVerify = function(algorithm) {
return (new Verify).init(algorithm);
}
};
exports.RootCaCerts = RootCaCerts;

Просмотреть файл

@ -13,13 +13,13 @@ timer.callback = function () {
var sockets = Object.keys(activeWatchers);
for (var i = 0, l = sockets.length; i < l; i++) {
var socket = sockets[i];
var s = parseInt(socket);
var s = parseInt(socket, 10);
channel.processFD( watchers[socket].read ? s : dns.SOCKET_BAD
, watchers[socket].write ? s : dns.SOCKET_BAD
);
}
updateTimer();
}
};
function updateTimer() {
@ -30,7 +30,7 @@ function updateTimer() {
var max = 20000;
var timeout = channel.timeout(max);
timer.start(timeout, 0);
}
};
var channel = new dns.Channel({SOCK_STATE_CB: function (socket, read, write) {
@ -50,8 +50,8 @@ var channel = new dns.Channel({SOCK_STATE_CB: function (socket, read, write) {
, write ? socket : dns.SOCKET_BAD
);
updateTimer();
}
}
};
};
watcher.set(socket, read == 1, write == 1);
@ -84,7 +84,7 @@ exports.resolve = function (domain, type_, callback_) {
} else {
throw new Error('Unknown type "' + type + '"');
}
}
};
function familyToSym(family) {
@ -92,7 +92,7 @@ function familyToSym(family) {
family = (family === 6) ? dns.AF_INET6 : dns.AF_INET;
}
return family;
}
};
exports.getHostByName = function (domain, family/*=4*/, callback) {
@ -114,7 +114,7 @@ exports.lookup = function (domain, family, callback) {
callback = family;
family = undefined;
} else if (family && family !== 4 && family !== 6) {
family = parseInt(family);
family = parseInt(family, 10);
if (family === dns.AF_INET) {
family = 4;
} else if (family === dns.AF_INET6) {
@ -203,7 +203,7 @@ var resolveMap = {
'TXT' : exports.resolveTxt,
'SRV' : exports.resolveSrv,
'PTR' : exports.resolvePtr,
'NS' : exports.resolveNs,
'NS' : exports.resolveNs
};
// ERROR CODES

Просмотреть файл

@ -117,5 +117,5 @@ exports.Promise = function removed () {
throw new Error(
'Promise has been removed. See '+
'http://groups.google.com/group/nodejs/msg/0c483b891c56fea2 for more information.');
}
};
process.Promise = exports.Promise;

Просмотреть файл

@ -4,7 +4,7 @@ exports.FreeList = function(name, max, constructor) {
this.constructor = constructor;
this.max = max;
this.list = [];
}
};
exports.FreeList.prototype.alloc = function () {

Просмотреть файл

@ -111,7 +111,7 @@ fs.readFileSync = function (path, encoding) {
if (!i._bytesRead) return;
i.copy(buffer,offset,0,i._bytesRead);
offset += i._bytesRead;
})
});
} else if (buffers.length) {
//buffers has exactly 1 (possibly zero length) buffer, so this should be a shortcut
buffer = buffers[0].slice(0, buffers[0]._bytesRead);
@ -943,7 +943,7 @@ WriteStream.prototype.close = function (cb) {
sys.error(writeStreamCloseWarning);
}
return this.end(cb);
}
};
WriteStream.prototype.end = function (cb) {

Просмотреть файл

@ -235,9 +235,9 @@ IncomingMessage.prototype.resume = function () {
IncomingMessage.prototype._addHeaderLine = function (field, value) {
var dest;
if (this.complete) {
dest = this.trailers
dest = this.trailers;
} else {
dest = this.headers
dest = this.headers;
}
switch (field) {
// Array headers:
@ -317,8 +317,8 @@ OutgoingMessage.prototype._send = function (data, encoding) {
}
this._headerSent = true;
}
this._writeRaw(data, encoding)
}
this._writeRaw(data, encoding);
};
OutgoingMessage.prototype._writeRaw = function(data, encoding) {
if (this.connection._outgoing[0] === this && this.connection.writable) {
@ -606,7 +606,7 @@ exports.ServerResponse = ServerResponse;
ServerResponse.prototype.writeContinue = function () {
this._writeRaw("HTTP/1.1 100 Continue" + CRLF + CRLF, 'ascii');
this._sent100 = true;
}
};
ServerResponse.prototype.writeHead = function (statusCode) {
var reasonPhrase, headers, headerIndex;
@ -769,7 +769,7 @@ sys.inherits(Server, net.Server);
Server.prototype.setSecure = function (credentials) {
this.secure = true;
this.credentials = credentials;
}
};
exports.Server = Server;
@ -875,7 +875,7 @@ function connectionListener (socket) {
&& continueExpression.test(req.headers['expect'])) {
res._expect_continue = true;
if (self.listeners("checkContinue").length) {
self.emit("checkContinue", req, res)
self.emit("checkContinue", req, res);
} else {
res.writeContinue();
self.emit('request', req, res);
@ -905,7 +905,7 @@ function Client ( ) {
} else if (self.parser.incoming && self.parser.incoming.upgrade) {
var bytesParsed = ret;
self.ondata = null;
self.onend = null
self.onend = null;
var req = self.parser.incoming;
@ -1008,9 +1008,9 @@ Client.prototype._initParser = function () {
// All that should be required for keep-alive is to not reconnect,
// but outgoingFlush instead.
if (req.shouldKeepAlive) {
outgoingFlush(self)
self._outgoing.shift()
outgoingFlush(self)
outgoingFlush(self);
self._outgoing.shift();
outgoingFlush(self);
} else {
self.end();
}

Просмотреть файл

@ -91,7 +91,7 @@ var timeout = new (function () {
remove(socket);
socket._idleNext = list._idleNext;
socket._idleNext._idlePrev = socket;
socket._idlePrev = list
socket._idlePrev = list;
list._idleNext = socket;
}
@ -200,7 +200,7 @@ var timeout = new (function () {
socket._idlePrev._idleNext = socket._idleNext;
socket._idleNext = list._idleNext;
socket._idleNext._idlePrev = socket;
socket._idlePrev = list
socket._idlePrev = list;
list._idleNext = socket;
}
}
@ -313,7 +313,7 @@ function setImplmentationMethods (self) {
}
self._shutdownImpl = function () {
shutdown(self.fd, 'write')
shutdown(self.fd, 'write');
};
if (self.secure) {
@ -525,7 +525,7 @@ function Stream (fd, type) {
this.type = null;
this.secure = false;
if (parseInt(fd) >= 0) {
if (parseInt(fd, 10) >= 0) {
this.open(fd, type);
} else {
setImplmentationMethods(this);
@ -567,7 +567,7 @@ Stream.prototype.setSecure = function (credentials) {
// If client, trigger handshake
this._checkForSecureHandshake();
}
}
};
Stream.prototype.verifyPeer = function () {
@ -575,7 +575,7 @@ Stream.prototype.verifyPeer = function () {
throw new Error('Stream is not a secure stream.');
}
return this.secureStream.verifyPeer(this.credentials.context);
}
};
Stream.prototype._checkForSecureHandshake = function () {
@ -586,7 +586,7 @@ Stream.prototype._checkForSecureHandshake = function () {
// Do an empty write to see if we need to write out as part of handshake
if (!emptyBuffer) allocEmptyBuffer();
this.write(emptyBuffer);
}
};
Stream.prototype.getPeerCertificate = function (credentials) {
@ -594,7 +594,7 @@ Stream.prototype.getPeerCertificate = function (credentials) {
throw new Error('Stream is not a secure stream.');
}
return this.secureStream.getPeerCertificate();
}
};
Stream.prototype.getCipher = function () {
@ -602,7 +602,7 @@ Stream.prototype.getCipher = function () {
throw new Error('Stream is not a secure stream.');
}
return this.secureStream.getCurrentCipher();
}
};
Stream.prototype.open = function (fd, type) {
@ -616,7 +616,7 @@ Stream.prototype.open = function (fd, type) {
this._writeWatcher.set(this.fd, false, true);
this.writable = true;
}
};
exports.createConnection = function (port, host) {
@ -703,7 +703,7 @@ Stream.prototype._writeOut = function (data, encoding, fd) {
len = data.length;
} else {
assert(typeof data == 'string')
assert(typeof data == 'string');
if (!pool || pool.length - pool.used < kMinPoolSpace) {
pool = null;
@ -788,7 +788,7 @@ Stream.prototype._writeOut = function (data, encoding, fd) {
}
return false;
}
};
// Flushes the write buffer out.
@ -869,7 +869,7 @@ function doConnect (socket, port, host) {
};
}
function toPort (x) { return (x = Number(x)) >= 0 ? x : false }
function toPort (x) { return (x = Number(x)) >= 0 ? x : false; }
// var stream = new Stream();
@ -886,7 +886,7 @@ Stream.prototype.connect = function () {
self._connecting = true; // set false in doConnect
var port = toPort(arguments[0])
var port = toPort(arguments[0]);
if (port === false) {
// UNIX
self.fd = socket('unix');
@ -1102,7 +1102,7 @@ Server.prototype.listen = function () {
self.addListener('listening', lastArg);
}
var port = toPort(arguments[0])
var port = toPort(arguments[0]);
if (port === false) {
// the first argument specifies a path
self.fd = socket('unix');
@ -1176,7 +1176,7 @@ Server.prototype._startWatcher = function () {
Server.prototype._doListen = function () {
listen(this.fd, 128);
this._startWatcher();
}
};

Просмотреть файл

@ -27,7 +27,7 @@ exports.normalizeArray = function (parts, keepBlanks) {
&& (prev !== "" || keepBlanks)
) {
directories.pop();
prev = directories.slice(-1)[0]
prev = directories.slice(-1)[0];
} else {
if (prev === ".") directories.pop();
directories.push(directory);
@ -84,7 +84,7 @@ exports.exists = function (path, callback) {
exports.existsSync = function (path) {
try {
process.binding('fs').stat(path)
process.binding('fs').stat(path);
return true;
} catch(e){
return false;

Просмотреть файл

@ -28,7 +28,7 @@ function Interface (output, completer) {
this.enabled = output.fd < 3; // Looks like a TTY.
if (parseInt(process.env['NODE_NO_READLINE'])) {
if (parseInt(process.env['NODE_NO_READLINE'], 10)) {
this.enabled = false;
}
@ -211,7 +211,7 @@ Interface.prototype._tabComplete = function () {
// If there is a common prefix to all matches, then apply that
// portion.
var prefix = commonPrefix(
completions.filter(function(e) { if (e) return e }));
completions.filter(function(e) { if (e) return e; }));
if (prefix.length > completeOn.length) {
self._insertString(prefix.slice(completeOn.length));
}

Просмотреть файл

@ -58,7 +58,7 @@ function REPLServer(prompt, stream) {
// Turn on ANSI coloring.
exports.writer = function(obj, showHidden, depth) {
return sys.inspect(obj, showHidden, depth, true);
}
};
}
rli.setPrompt(self.prompt);
@ -306,7 +306,7 @@ REPLServer.prototype.complete = function (line) {
"false", "finally", "for", "function", "if", "import", "in",
"instanceof", "let", "new", "null", "return", "switch", "this",
"throw", "true", "try", "typeof", "undefined", "var", "void",
"while", "with", "yield"])
"while", "with", "yield"]);
}
} else {
try {

Просмотреть файл

@ -315,7 +315,7 @@ exports.log = function (msg) {
var execWarning;
exports.exec = function () {
if (!execWarning) {
execWarning = 'sys.exec has moved to the "child_process" module. Please update your source code.'
execWarning = 'sys.exec has moved to the "child_process" module. Please update your source code.';
error(execWarning);
}
return require('child_process').exec.apply(this, arguments);
@ -332,8 +332,8 @@ exports.pump = function (readStream, writeStream, callback) {
}
}
if (!readStream.pause) readStream.pause = function () {readStream.emit("pause")};
if (!readStream.resume) readStream.resume = function () {readStream.emit("resume")};
if (!readStream.pause) readStream.pause = function () {readStream.emit("pause");};
if (!readStream.resume) readStream.resume = function () {readStream.emit("resume");};
readStream.addListener("data", function (chunk) {
if (writeStream.write(chunk) === false) readStream.pause();

Просмотреть файл

@ -284,7 +284,7 @@ function urlResolveObject (source, relative) {
mustEndAbs = mustEndAbs || (source.host && srcPath.length);
if (mustEndAbs && srcPath[0] !== "") srcPath.unshift("")
if (mustEndAbs && srcPath[0] !== "") srcPath.unshift("");
source.pathname = srcPath.join("/");

Просмотреть файл

@ -10,8 +10,8 @@ global.root = global;
function removed (reason) {
return function () {
throw new Error(reason)
}
throw new Error(reason);
};
}
process.debug = removed("process.debug() has moved. Use require('sys') to bring it back.");
@ -156,7 +156,7 @@ var module = (function () {
function index (ext) { return path.join(dir, id, 'index' + ext); }
inDir = [
function () { return exts.map(direct); },
function () { return exts.map(index); },
function () { return exts.map(index); }
];
head = [path.join(dir, id)];
return next();
@ -335,7 +335,7 @@ var module = (function () {
// Load the main module--the command line argument.
process.mainModule = new Module(".");
process.mainModule.load(process.argv[1]);
}
};
return exports;
})();
@ -551,7 +551,7 @@ global.console.assert = function(expression){
var arr = Array.prototype.slice.call(arguments, 1);
process.assert(false, format.apply(this, arr));
}
}
};
global.Buffer = module.requireNative('buffer').Buffer;

Просмотреть файл

@ -1,5 +1,5 @@
common = require("../common");
assert = common.assert
assert = common.assert;
var dns = require("dns"),
child_process = require("child_process"),

Просмотреть файл

@ -1,7 +1,7 @@
/* XXX Can this test be modified to not call the now-removed wait()? */
common = require("../common");
assert = common.assert
assert = common.assert;
console.log('first stat ...');

Просмотреть файл

@ -1,5 +1,5 @@
common = require("../common");
assert = common.assert
assert = common.assert;
tcp = require("tcp");
sys = require("sys");

Просмотреть файл

@ -1,5 +1,5 @@
common = require("../common");
assert = common.assert
assert = common.assert;
var sys = require("sys"),
fs = require("fs"),
http = require("http"),
@ -9,7 +9,7 @@ var chunk = '01234567890123456789';
// Produce a very large response.
var chargen = http.createServer(function (req, res) {
var len = parseInt(req.headers['x-len']);
var len = parseInt(req.headers['x-len'], 10);
assert.ok(len > 0);
res.writeHead(200, {"transfer-encoding":"chunked"});
for (var i=0; i<len; i++) {
@ -22,9 +22,9 @@ chargen.listen(9000);
// Proxy to the chargen server.
var proxy = http.createServer(function (req, res) {
var c = http.createClient(9000, 'localhost')
var c = http.createClient(9000, 'localhost');
var len = parseInt(req.headers['x-len']);
var len = parseInt(req.headers['x-len'], 10);
assert.ok(len > 0);
var sent = 0;

Просмотреть файл

@ -1,5 +1,5 @@
common = require("../common");
assert = common.assert
assert = common.assert;
var assert = require("assert");
var http = require("http");

Просмотреть файл

@ -1,5 +1,5 @@
common = require("../common");
assert = common.assert
assert = common.assert;
http = require("http");
@ -23,7 +23,7 @@ server.addListener('listening', function () {
if (err) {
common.print("-");
} else {
assert.equal(body, content)
assert.equal(body, content);
common.print(".");
requests_ok++;
}

Просмотреть файл

@ -1,5 +1,5 @@
common = require("../common");
assert = common.assert
assert = common.assert;
var complete = false;
var idle = new process.IdleWatcher();

Просмотреть файл

@ -4,7 +4,7 @@ var spawn = require('child_process').spawn;
if (process.title === '') {
console.log('skipping test -- not implemented for the host platform');
return;
//return;
}
// disabled because of two things

Просмотреть файл

@ -1,5 +1,5 @@
common = require("../common");
assert = common.assert
assert = common.assert;
var http = require('http');
var sys = require('sys');

Просмотреть файл

@ -1,6 +1,6 @@
// Requires special privlages
common = require("../common");
assert = common.assert
assert = common.assert;
var assert = require('assert');
var oldgid = process.getgid();

Просмотреть файл

@ -1,5 +1,5 @@
common = require("../common");
assert = common.assert
assert = common.assert;
var sys=require('sys');
var net=require('net');
var fs=require('fs');

Просмотреть файл

@ -1,5 +1,5 @@
common = require("../common");
assert = common.assert
assert = common.assert;
var sys=require('sys');
var net=require('net');

2
test/fixtures/echo.js поставляемый
Просмотреть файл

@ -1,5 +1,5 @@
common = require("../common");
assert = common.assert
assert = common.assert;
common.print("hello world\r\n");