syntax fixes to pass jslint
This commit is contained in:
parent
9481bc1009
commit
3d4e4d8909
@ -59,7 +59,7 @@ assert.AssertionError.prototype.toString = function() {
|
|||||||
, JSON.stringify(this.actual)
|
, JSON.stringify(this.actual)
|
||||||
].join(" ");
|
].join(" ");
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
// assert.AssertionError instanceof Error
|
// assert.AssertionError instanceof Error
|
||||||
|
|
||||||
@ -279,7 +279,7 @@ function _throws (shouldThrow, block, err, message) {
|
|||||||
(!shouldThrow && threw)) {
|
(!shouldThrow && threw)) {
|
||||||
throw exception;
|
throw exception;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
// 11. Expected to throw an error:
|
// 11. Expected to throw an error:
|
||||||
// assert.throws(block, Error_opt, message_opt);
|
// assert.throws(block, Error_opt, message_opt);
|
||||||
|
@ -88,7 +88,7 @@ exports.execFile = function (file /* args, options, callback */) {
|
|||||||
stderr += chunk;
|
stderr += chunk;
|
||||||
if (!killed && stderr.length > options.maxBuffer) {
|
if (!killed && stderr.length > options.maxBuffer) {
|
||||||
child.kill(options.killSignal);
|
child.kill(options.killSignal);
|
||||||
killed = true
|
killed = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -3579,8 +3579,7 @@ var RootCaCerts = [
|
|||||||
+"I2bw/FWAp/tmGYI1Z2JwOV5vx+qQQEQIHriy1tvuWacNGHk0vFQYXlPKNFHtRQrmjseCNj6nOGOp\n"
|
+"I2bw/FWAp/tmGYI1Z2JwOV5vx+qQQEQIHriy1tvuWacNGHk0vFQYXlPKNFHtRQrmjseCNj6nOGOp\n"
|
||||||
+"MCwXEGCSn1WHElkQwg9naRHMTh5+Spqtr0CodaxWkHS4oJyleW/c6RrIaQXpuvoDs3zk4E7Czp3o\n"
|
+"MCwXEGCSn1WHElkQwg9naRHMTh5+Spqtr0CodaxWkHS4oJyleW/c6RrIaQXpuvoDs3zk4E7Czp3o\n"
|
||||||
+"tkYNbn5XOmeUwssfnHdKZ05phkOTOPu220+DkdRgfks+KzgHVZhepA==\n"
|
+"tkYNbn5XOmeUwssfnHdKZ05phkOTOPu220+DkdRgfks+KzgHVZhepA==\n"
|
||||||
+"-----END CERTIFICATE-----\n",
|
+"-----END CERTIFICATE-----\n"
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
var sys = require("sys");
|
var sys = require("sys");
|
||||||
@ -3630,45 +3629,45 @@ exports.createCredentials = function(cred) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return c;
|
return c;
|
||||||
}
|
};
|
||||||
exports.Credentials = Credentials;
|
exports.Credentials = Credentials;
|
||||||
|
|
||||||
exports.Hash = Hash;
|
exports.Hash = Hash;
|
||||||
exports.createHash = function(hash) {
|
exports.createHash = function(hash) {
|
||||||
return new Hash(hash);
|
return new Hash(hash);
|
||||||
}
|
};
|
||||||
|
|
||||||
exports.Hmac = Hmac;
|
exports.Hmac = Hmac;
|
||||||
exports.createHmac = function(hmac, key) {
|
exports.createHmac = function(hmac, key) {
|
||||||
return (new Hmac).init(hmac, key);
|
return (new Hmac).init(hmac, key);
|
||||||
}
|
};
|
||||||
|
|
||||||
exports.Cipher = Cipher;
|
exports.Cipher = Cipher;
|
||||||
exports.createCipher = function(cipher, key) {
|
exports.createCipher = function(cipher, key) {
|
||||||
return (new Cipher).init(cipher, key);
|
return (new Cipher).init(cipher, key);
|
||||||
}
|
};
|
||||||
|
|
||||||
exports.createCipheriv = function(cipher, key, iv) {
|
exports.createCipheriv = function(cipher, key, iv) {
|
||||||
return (new Cipher).initiv(cipher, key, iv);
|
return (new Cipher).initiv(cipher, key, iv);
|
||||||
}
|
};
|
||||||
|
|
||||||
exports.Decipher = Decipher;
|
exports.Decipher = Decipher;
|
||||||
exports.createDecipher = function(cipher, key) {
|
exports.createDecipher = function(cipher, key) {
|
||||||
return (new Decipher).init(cipher, key);
|
return (new Decipher).init(cipher, key);
|
||||||
}
|
};
|
||||||
|
|
||||||
exports.createDecipheriv = function(cipher, key, iv) {
|
exports.createDecipheriv = function(cipher, key, iv) {
|
||||||
return (new Decipher).initiv(cipher, key, iv);
|
return (new Decipher).initiv(cipher, key, iv);
|
||||||
}
|
};
|
||||||
|
|
||||||
exports.Sign = Sign;
|
exports.Sign = Sign;
|
||||||
exports.createSign = function(algorithm) {
|
exports.createSign = function(algorithm) {
|
||||||
return (new Sign).init(algorithm);
|
return (new Sign).init(algorithm);
|
||||||
}
|
};
|
||||||
|
|
||||||
exports.Verify = Verify;
|
exports.Verify = Verify;
|
||||||
exports.createVerify = function(algorithm) {
|
exports.createVerify = function(algorithm) {
|
||||||
return (new Verify).init(algorithm);
|
return (new Verify).init(algorithm);
|
||||||
}
|
};
|
||||||
|
|
||||||
exports.RootCaCerts = RootCaCerts;
|
exports.RootCaCerts = RootCaCerts;
|
||||||
|
18
lib/dns.js
18
lib/dns.js
@ -13,13 +13,13 @@ timer.callback = function () {
|
|||||||
var sockets = Object.keys(activeWatchers);
|
var sockets = Object.keys(activeWatchers);
|
||||||
for (var i = 0, l = sockets.length; i < l; i++) {
|
for (var i = 0, l = sockets.length; i < l; i++) {
|
||||||
var socket = sockets[i];
|
var socket = sockets[i];
|
||||||
var s = parseInt(socket);
|
var s = parseInt(socket, 10);
|
||||||
channel.processFD( watchers[socket].read ? s : dns.SOCKET_BAD
|
channel.processFD( watchers[socket].read ? s : dns.SOCKET_BAD
|
||||||
, watchers[socket].write ? s : dns.SOCKET_BAD
|
, watchers[socket].write ? s : dns.SOCKET_BAD
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
updateTimer();
|
updateTimer();
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
function updateTimer() {
|
function updateTimer() {
|
||||||
@ -30,7 +30,7 @@ function updateTimer() {
|
|||||||
var max = 20000;
|
var max = 20000;
|
||||||
var timeout = channel.timeout(max);
|
var timeout = channel.timeout(max);
|
||||||
timer.start(timeout, 0);
|
timer.start(timeout, 0);
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
var channel = new dns.Channel({SOCK_STATE_CB: function (socket, read, write) {
|
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
|
, write ? socket : dns.SOCKET_BAD
|
||||||
);
|
);
|
||||||
updateTimer();
|
updateTimer();
|
||||||
}
|
};
|
||||||
}
|
};
|
||||||
|
|
||||||
watcher.set(socket, read == 1, write == 1);
|
watcher.set(socket, read == 1, write == 1);
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ exports.resolve = function (domain, type_, callback_) {
|
|||||||
} else {
|
} else {
|
||||||
throw new Error('Unknown type "' + type + '"');
|
throw new Error('Unknown type "' + type + '"');
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
function familyToSym(family) {
|
function familyToSym(family) {
|
||||||
@ -92,7 +92,7 @@ function familyToSym(family) {
|
|||||||
family = (family === 6) ? dns.AF_INET6 : dns.AF_INET;
|
family = (family === 6) ? dns.AF_INET6 : dns.AF_INET;
|
||||||
}
|
}
|
||||||
return family;
|
return family;
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
exports.getHostByName = function (domain, family/*=4*/, callback) {
|
exports.getHostByName = function (domain, family/*=4*/, callback) {
|
||||||
@ -114,7 +114,7 @@ exports.lookup = function (domain, family, callback) {
|
|||||||
callback = family;
|
callback = family;
|
||||||
family = undefined;
|
family = undefined;
|
||||||
} else if (family && family !== 4 && family !== 6) {
|
} else if (family && family !== 4 && family !== 6) {
|
||||||
family = parseInt(family);
|
family = parseInt(family, 10);
|
||||||
if (family === dns.AF_INET) {
|
if (family === dns.AF_INET) {
|
||||||
family = 4;
|
family = 4;
|
||||||
} else if (family === dns.AF_INET6) {
|
} else if (family === dns.AF_INET6) {
|
||||||
@ -203,7 +203,7 @@ var resolveMap = {
|
|||||||
'TXT' : exports.resolveTxt,
|
'TXT' : exports.resolveTxt,
|
||||||
'SRV' : exports.resolveSrv,
|
'SRV' : exports.resolveSrv,
|
||||||
'PTR' : exports.resolvePtr,
|
'PTR' : exports.resolvePtr,
|
||||||
'NS' : exports.resolveNs,
|
'NS' : exports.resolveNs
|
||||||
};
|
};
|
||||||
|
|
||||||
// ERROR CODES
|
// ERROR CODES
|
||||||
|
@ -117,5 +117,5 @@ exports.Promise = function removed () {
|
|||||||
throw new Error(
|
throw new Error(
|
||||||
'Promise has been removed. See '+
|
'Promise has been removed. See '+
|
||||||
'http://groups.google.com/group/nodejs/msg/0c483b891c56fea2 for more information.');
|
'http://groups.google.com/group/nodejs/msg/0c483b891c56fea2 for more information.');
|
||||||
}
|
};
|
||||||
process.Promise = exports.Promise;
|
process.Promise = exports.Promise;
|
||||||
|
@ -4,7 +4,7 @@ exports.FreeList = function(name, max, constructor) {
|
|||||||
this.constructor = constructor;
|
this.constructor = constructor;
|
||||||
this.max = max;
|
this.max = max;
|
||||||
this.list = [];
|
this.list = [];
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
exports.FreeList.prototype.alloc = function () {
|
exports.FreeList.prototype.alloc = function () {
|
||||||
|
@ -111,7 +111,7 @@ fs.readFileSync = function (path, encoding) {
|
|||||||
if (!i._bytesRead) return;
|
if (!i._bytesRead) return;
|
||||||
i.copy(buffer,offset,0,i._bytesRead);
|
i.copy(buffer,offset,0,i._bytesRead);
|
||||||
offset += i._bytesRead;
|
offset += i._bytesRead;
|
||||||
})
|
});
|
||||||
} else if (buffers.length) {
|
} else if (buffers.length) {
|
||||||
//buffers has exactly 1 (possibly zero length) buffer, so this should be a shortcut
|
//buffers has exactly 1 (possibly zero length) buffer, so this should be a shortcut
|
||||||
buffer = buffers[0].slice(0, buffers[0]._bytesRead);
|
buffer = buffers[0].slice(0, buffers[0]._bytesRead);
|
||||||
@ -943,7 +943,7 @@ WriteStream.prototype.close = function (cb) {
|
|||||||
sys.error(writeStreamCloseWarning);
|
sys.error(writeStreamCloseWarning);
|
||||||
}
|
}
|
||||||
return this.end(cb);
|
return this.end(cb);
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
WriteStream.prototype.end = function (cb) {
|
WriteStream.prototype.end = function (cb) {
|
||||||
|
22
lib/http.js
22
lib/http.js
@ -235,9 +235,9 @@ IncomingMessage.prototype.resume = function () {
|
|||||||
IncomingMessage.prototype._addHeaderLine = function (field, value) {
|
IncomingMessage.prototype._addHeaderLine = function (field, value) {
|
||||||
var dest;
|
var dest;
|
||||||
if (this.complete) {
|
if (this.complete) {
|
||||||
dest = this.trailers
|
dest = this.trailers;
|
||||||
} else {
|
} else {
|
||||||
dest = this.headers
|
dest = this.headers;
|
||||||
}
|
}
|
||||||
switch (field) {
|
switch (field) {
|
||||||
// Array headers:
|
// Array headers:
|
||||||
@ -317,8 +317,8 @@ OutgoingMessage.prototype._send = function (data, encoding) {
|
|||||||
}
|
}
|
||||||
this._headerSent = true;
|
this._headerSent = true;
|
||||||
}
|
}
|
||||||
this._writeRaw(data, encoding)
|
this._writeRaw(data, encoding);
|
||||||
}
|
};
|
||||||
|
|
||||||
OutgoingMessage.prototype._writeRaw = function(data, encoding) {
|
OutgoingMessage.prototype._writeRaw = function(data, encoding) {
|
||||||
if (this.connection._outgoing[0] === this && this.connection.writable) {
|
if (this.connection._outgoing[0] === this && this.connection.writable) {
|
||||||
@ -606,7 +606,7 @@ exports.ServerResponse = ServerResponse;
|
|||||||
ServerResponse.prototype.writeContinue = function () {
|
ServerResponse.prototype.writeContinue = function () {
|
||||||
this._writeRaw("HTTP/1.1 100 Continue" + CRLF + CRLF, 'ascii');
|
this._writeRaw("HTTP/1.1 100 Continue" + CRLF + CRLF, 'ascii');
|
||||||
this._sent100 = true;
|
this._sent100 = true;
|
||||||
}
|
};
|
||||||
|
|
||||||
ServerResponse.prototype.writeHead = function (statusCode) {
|
ServerResponse.prototype.writeHead = function (statusCode) {
|
||||||
var reasonPhrase, headers, headerIndex;
|
var reasonPhrase, headers, headerIndex;
|
||||||
@ -769,7 +769,7 @@ sys.inherits(Server, net.Server);
|
|||||||
Server.prototype.setSecure = function (credentials) {
|
Server.prototype.setSecure = function (credentials) {
|
||||||
this.secure = true;
|
this.secure = true;
|
||||||
this.credentials = credentials;
|
this.credentials = credentials;
|
||||||
}
|
};
|
||||||
|
|
||||||
exports.Server = Server;
|
exports.Server = Server;
|
||||||
|
|
||||||
@ -875,7 +875,7 @@ function connectionListener (socket) {
|
|||||||
&& continueExpression.test(req.headers['expect'])) {
|
&& continueExpression.test(req.headers['expect'])) {
|
||||||
res._expect_continue = true;
|
res._expect_continue = true;
|
||||||
if (self.listeners("checkContinue").length) {
|
if (self.listeners("checkContinue").length) {
|
||||||
self.emit("checkContinue", req, res)
|
self.emit("checkContinue", req, res);
|
||||||
} else {
|
} else {
|
||||||
res.writeContinue();
|
res.writeContinue();
|
||||||
self.emit('request', req, res);
|
self.emit('request', req, res);
|
||||||
@ -905,7 +905,7 @@ function Client ( ) {
|
|||||||
} else if (self.parser.incoming && self.parser.incoming.upgrade) {
|
} else if (self.parser.incoming && self.parser.incoming.upgrade) {
|
||||||
var bytesParsed = ret;
|
var bytesParsed = ret;
|
||||||
self.ondata = null;
|
self.ondata = null;
|
||||||
self.onend = null
|
self.onend = null;
|
||||||
|
|
||||||
var req = self.parser.incoming;
|
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,
|
// All that should be required for keep-alive is to not reconnect,
|
||||||
// but outgoingFlush instead.
|
// but outgoingFlush instead.
|
||||||
if (req.shouldKeepAlive) {
|
if (req.shouldKeepAlive) {
|
||||||
outgoingFlush(self)
|
outgoingFlush(self);
|
||||||
self._outgoing.shift()
|
self._outgoing.shift();
|
||||||
outgoingFlush(self)
|
outgoingFlush(self);
|
||||||
} else {
|
} else {
|
||||||
self.end();
|
self.end();
|
||||||
}
|
}
|
||||||
|
32
lib/net.js
32
lib/net.js
@ -91,7 +91,7 @@ var timeout = new (function () {
|
|||||||
remove(socket);
|
remove(socket);
|
||||||
socket._idleNext = list._idleNext;
|
socket._idleNext = list._idleNext;
|
||||||
socket._idleNext._idlePrev = socket;
|
socket._idleNext._idlePrev = socket;
|
||||||
socket._idlePrev = list
|
socket._idlePrev = list;
|
||||||
list._idleNext = socket;
|
list._idleNext = socket;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -200,7 +200,7 @@ var timeout = new (function () {
|
|||||||
socket._idlePrev._idleNext = socket._idleNext;
|
socket._idlePrev._idleNext = socket._idleNext;
|
||||||
socket._idleNext = list._idleNext;
|
socket._idleNext = list._idleNext;
|
||||||
socket._idleNext._idlePrev = socket;
|
socket._idleNext._idlePrev = socket;
|
||||||
socket._idlePrev = list
|
socket._idlePrev = list;
|
||||||
list._idleNext = socket;
|
list._idleNext = socket;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -313,7 +313,7 @@ function setImplmentationMethods (self) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
self._shutdownImpl = function () {
|
self._shutdownImpl = function () {
|
||||||
shutdown(self.fd, 'write')
|
shutdown(self.fd, 'write');
|
||||||
};
|
};
|
||||||
|
|
||||||
if (self.secure) {
|
if (self.secure) {
|
||||||
@ -525,7 +525,7 @@ function Stream (fd, type) {
|
|||||||
this.type = null;
|
this.type = null;
|
||||||
this.secure = false;
|
this.secure = false;
|
||||||
|
|
||||||
if (parseInt(fd) >= 0) {
|
if (parseInt(fd, 10) >= 0) {
|
||||||
this.open(fd, type);
|
this.open(fd, type);
|
||||||
} else {
|
} else {
|
||||||
setImplmentationMethods(this);
|
setImplmentationMethods(this);
|
||||||
@ -567,7 +567,7 @@ Stream.prototype.setSecure = function (credentials) {
|
|||||||
// If client, trigger handshake
|
// If client, trigger handshake
|
||||||
this._checkForSecureHandshake();
|
this._checkForSecureHandshake();
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
Stream.prototype.verifyPeer = function () {
|
Stream.prototype.verifyPeer = function () {
|
||||||
@ -575,7 +575,7 @@ Stream.prototype.verifyPeer = function () {
|
|||||||
throw new Error('Stream is not a secure stream.');
|
throw new Error('Stream is not a secure stream.');
|
||||||
}
|
}
|
||||||
return this.secureStream.verifyPeer(this.credentials.context);
|
return this.secureStream.verifyPeer(this.credentials.context);
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
Stream.prototype._checkForSecureHandshake = function () {
|
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
|
// Do an empty write to see if we need to write out as part of handshake
|
||||||
if (!emptyBuffer) allocEmptyBuffer();
|
if (!emptyBuffer) allocEmptyBuffer();
|
||||||
this.write(emptyBuffer);
|
this.write(emptyBuffer);
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
Stream.prototype.getPeerCertificate = function (credentials) {
|
Stream.prototype.getPeerCertificate = function (credentials) {
|
||||||
@ -594,7 +594,7 @@ Stream.prototype.getPeerCertificate = function (credentials) {
|
|||||||
throw new Error('Stream is not a secure stream.');
|
throw new Error('Stream is not a secure stream.');
|
||||||
}
|
}
|
||||||
return this.secureStream.getPeerCertificate();
|
return this.secureStream.getPeerCertificate();
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
Stream.prototype.getCipher = function () {
|
Stream.prototype.getCipher = function () {
|
||||||
@ -602,7 +602,7 @@ Stream.prototype.getCipher = function () {
|
|||||||
throw new Error('Stream is not a secure stream.');
|
throw new Error('Stream is not a secure stream.');
|
||||||
}
|
}
|
||||||
return this.secureStream.getCurrentCipher();
|
return this.secureStream.getCurrentCipher();
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
Stream.prototype.open = function (fd, type) {
|
Stream.prototype.open = function (fd, type) {
|
||||||
@ -616,7 +616,7 @@ Stream.prototype.open = function (fd, type) {
|
|||||||
|
|
||||||
this._writeWatcher.set(this.fd, false, true);
|
this._writeWatcher.set(this.fd, false, true);
|
||||||
this.writable = true;
|
this.writable = true;
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
exports.createConnection = function (port, host) {
|
exports.createConnection = function (port, host) {
|
||||||
@ -703,7 +703,7 @@ Stream.prototype._writeOut = function (data, encoding, fd) {
|
|||||||
len = data.length;
|
len = data.length;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
assert(typeof data == 'string')
|
assert(typeof data == 'string');
|
||||||
|
|
||||||
if (!pool || pool.length - pool.used < kMinPoolSpace) {
|
if (!pool || pool.length - pool.used < kMinPoolSpace) {
|
||||||
pool = null;
|
pool = null;
|
||||||
@ -788,7 +788,7 @@ Stream.prototype._writeOut = function (data, encoding, fd) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
// Flushes the write buffer out.
|
// 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();
|
// var stream = new Stream();
|
||||||
@ -886,7 +886,7 @@ Stream.prototype.connect = function () {
|
|||||||
|
|
||||||
self._connecting = true; // set false in doConnect
|
self._connecting = true; // set false in doConnect
|
||||||
|
|
||||||
var port = toPort(arguments[0])
|
var port = toPort(arguments[0]);
|
||||||
if (port === false) {
|
if (port === false) {
|
||||||
// UNIX
|
// UNIX
|
||||||
self.fd = socket('unix');
|
self.fd = socket('unix');
|
||||||
@ -1102,7 +1102,7 @@ Server.prototype.listen = function () {
|
|||||||
self.addListener('listening', lastArg);
|
self.addListener('listening', lastArg);
|
||||||
}
|
}
|
||||||
|
|
||||||
var port = toPort(arguments[0])
|
var port = toPort(arguments[0]);
|
||||||
if (port === false) {
|
if (port === false) {
|
||||||
// the first argument specifies a path
|
// the first argument specifies a path
|
||||||
self.fd = socket('unix');
|
self.fd = socket('unix');
|
||||||
@ -1176,7 +1176,7 @@ Server.prototype._startWatcher = function () {
|
|||||||
Server.prototype._doListen = function () {
|
Server.prototype._doListen = function () {
|
||||||
listen(this.fd, 128);
|
listen(this.fd, 128);
|
||||||
this._startWatcher();
|
this._startWatcher();
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ exports.normalizeArray = function (parts, keepBlanks) {
|
|||||||
&& (prev !== "" || keepBlanks)
|
&& (prev !== "" || keepBlanks)
|
||||||
) {
|
) {
|
||||||
directories.pop();
|
directories.pop();
|
||||||
prev = directories.slice(-1)[0]
|
prev = directories.slice(-1)[0];
|
||||||
} else {
|
} else {
|
||||||
if (prev === ".") directories.pop();
|
if (prev === ".") directories.pop();
|
||||||
directories.push(directory);
|
directories.push(directory);
|
||||||
@ -84,7 +84,7 @@ exports.exists = function (path, callback) {
|
|||||||
|
|
||||||
exports.existsSync = function (path) {
|
exports.existsSync = function (path) {
|
||||||
try {
|
try {
|
||||||
process.binding('fs').stat(path)
|
process.binding('fs').stat(path);
|
||||||
return true;
|
return true;
|
||||||
} catch(e){
|
} catch(e){
|
||||||
return false;
|
return false;
|
||||||
|
@ -28,7 +28,7 @@ function Interface (output, completer) {
|
|||||||
|
|
||||||
this.enabled = output.fd < 3; // Looks like a TTY.
|
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;
|
this.enabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -211,7 +211,7 @@ Interface.prototype._tabComplete = function () {
|
|||||||
// If there is a common prefix to all matches, then apply that
|
// If there is a common prefix to all matches, then apply that
|
||||||
// portion.
|
// portion.
|
||||||
var prefix = commonPrefix(
|
var prefix = commonPrefix(
|
||||||
completions.filter(function(e) { if (e) return e }));
|
completions.filter(function(e) { if (e) return e; }));
|
||||||
if (prefix.length > completeOn.length) {
|
if (prefix.length > completeOn.length) {
|
||||||
self._insertString(prefix.slice(completeOn.length));
|
self._insertString(prefix.slice(completeOn.length));
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ function REPLServer(prompt, stream) {
|
|||||||
// Turn on ANSI coloring.
|
// Turn on ANSI coloring.
|
||||||
exports.writer = function(obj, showHidden, depth) {
|
exports.writer = function(obj, showHidden, depth) {
|
||||||
return sys.inspect(obj, showHidden, depth, true);
|
return sys.inspect(obj, showHidden, depth, true);
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
rli.setPrompt(self.prompt);
|
rli.setPrompt(self.prompt);
|
||||||
@ -306,7 +306,7 @@ REPLServer.prototype.complete = function (line) {
|
|||||||
"false", "finally", "for", "function", "if", "import", "in",
|
"false", "finally", "for", "function", "if", "import", "in",
|
||||||
"instanceof", "let", "new", "null", "return", "switch", "this",
|
"instanceof", "let", "new", "null", "return", "switch", "this",
|
||||||
"throw", "true", "try", "typeof", "undefined", "var", "void",
|
"throw", "true", "try", "typeof", "undefined", "var", "void",
|
||||||
"while", "with", "yield"])
|
"while", "with", "yield"]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
|
@ -315,7 +315,7 @@ exports.log = function (msg) {
|
|||||||
var execWarning;
|
var execWarning;
|
||||||
exports.exec = function () {
|
exports.exec = function () {
|
||||||
if (!execWarning) {
|
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);
|
error(execWarning);
|
||||||
}
|
}
|
||||||
return require('child_process').exec.apply(this, arguments);
|
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.pause) readStream.pause = function () {readStream.emit("pause");};
|
||||||
if (!readStream.resume) readStream.resume = function () {readStream.emit("resume")};
|
if (!readStream.resume) readStream.resume = function () {readStream.emit("resume");};
|
||||||
|
|
||||||
readStream.addListener("data", function (chunk) {
|
readStream.addListener("data", function (chunk) {
|
||||||
if (writeStream.write(chunk) === false) readStream.pause();
|
if (writeStream.write(chunk) === false) readStream.pause();
|
||||||
|
@ -284,7 +284,7 @@ function urlResolveObject (source, relative) {
|
|||||||
|
|
||||||
mustEndAbs = mustEndAbs || (source.host && srcPath.length);
|
mustEndAbs = mustEndAbs || (source.host && srcPath.length);
|
||||||
|
|
||||||
if (mustEndAbs && srcPath[0] !== "") srcPath.unshift("")
|
if (mustEndAbs && srcPath[0] !== "") srcPath.unshift("");
|
||||||
|
|
||||||
source.pathname = srcPath.join("/");
|
source.pathname = srcPath.join("/");
|
||||||
|
|
||||||
|
10
src/node.js
10
src/node.js
@ -10,8 +10,8 @@ global.root = global;
|
|||||||
|
|
||||||
function removed (reason) {
|
function removed (reason) {
|
||||||
return function () {
|
return function () {
|
||||||
throw new Error(reason)
|
throw new Error(reason);
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
process.debug = removed("process.debug() has moved. Use require('sys') to bring it back.");
|
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); }
|
function index (ext) { return path.join(dir, id, 'index' + ext); }
|
||||||
inDir = [
|
inDir = [
|
||||||
function () { return exts.map(direct); },
|
function () { return exts.map(direct); },
|
||||||
function () { return exts.map(index); },
|
function () { return exts.map(index); }
|
||||||
];
|
];
|
||||||
head = [path.join(dir, id)];
|
head = [path.join(dir, id)];
|
||||||
return next();
|
return next();
|
||||||
@ -335,7 +335,7 @@ var module = (function () {
|
|||||||
// Load the main module--the command line argument.
|
// Load the main module--the command line argument.
|
||||||
process.mainModule = new Module(".");
|
process.mainModule = new Module(".");
|
||||||
process.mainModule.load(process.argv[1]);
|
process.mainModule.load(process.argv[1]);
|
||||||
}
|
};
|
||||||
|
|
||||||
return exports;
|
return exports;
|
||||||
})();
|
})();
|
||||||
@ -551,7 +551,7 @@ global.console.assert = function(expression){
|
|||||||
var arr = Array.prototype.slice.call(arguments, 1);
|
var arr = Array.prototype.slice.call(arguments, 1);
|
||||||
process.assert(false, format.apply(this, arr));
|
process.assert(false, format.apply(this, arr));
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
global.Buffer = module.requireNative('buffer').Buffer;
|
global.Buffer = module.requireNative('buffer').Buffer;
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
common = require("../common");
|
common = require("../common");
|
||||||
assert = common.assert
|
assert = common.assert;
|
||||||
|
|
||||||
var dns = require("dns"),
|
var dns = require("dns"),
|
||||||
child_process = require("child_process"),
|
child_process = require("child_process"),
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/* XXX Can this test be modified to not call the now-removed wait()? */
|
/* XXX Can this test be modified to not call the now-removed wait()? */
|
||||||
|
|
||||||
common = require("../common");
|
common = require("../common");
|
||||||
assert = common.assert
|
assert = common.assert;
|
||||||
|
|
||||||
|
|
||||||
console.log('first stat ...');
|
console.log('first stat ...');
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
common = require("../common");
|
common = require("../common");
|
||||||
assert = common.assert
|
assert = common.assert;
|
||||||
|
|
||||||
tcp = require("tcp");
|
tcp = require("tcp");
|
||||||
sys = require("sys");
|
sys = require("sys");
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
common = require("../common");
|
common = require("../common");
|
||||||
assert = common.assert
|
assert = common.assert;
|
||||||
var sys = require("sys"),
|
var sys = require("sys"),
|
||||||
fs = require("fs"),
|
fs = require("fs"),
|
||||||
http = require("http"),
|
http = require("http"),
|
||||||
@ -9,7 +9,7 @@ var chunk = '01234567890123456789';
|
|||||||
|
|
||||||
// Produce a very large response.
|
// Produce a very large response.
|
||||||
var chargen = http.createServer(function (req, res) {
|
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);
|
assert.ok(len > 0);
|
||||||
res.writeHead(200, {"transfer-encoding":"chunked"});
|
res.writeHead(200, {"transfer-encoding":"chunked"});
|
||||||
for (var i=0; i<len; i++) {
|
for (var i=0; i<len; i++) {
|
||||||
@ -22,9 +22,9 @@ chargen.listen(9000);
|
|||||||
|
|
||||||
// Proxy to the chargen server.
|
// Proxy to the chargen server.
|
||||||
var proxy = http.createServer(function (req, res) {
|
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);
|
assert.ok(len > 0);
|
||||||
|
|
||||||
var sent = 0;
|
var sent = 0;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
common = require("../common");
|
common = require("../common");
|
||||||
assert = common.assert
|
assert = common.assert;
|
||||||
|
|
||||||
var assert = require("assert");
|
var assert = require("assert");
|
||||||
var http = require("http");
|
var http = require("http");
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
common = require("../common");
|
common = require("../common");
|
||||||
assert = common.assert
|
assert = common.assert;
|
||||||
|
|
||||||
http = require("http");
|
http = require("http");
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ server.addListener('listening', function () {
|
|||||||
if (err) {
|
if (err) {
|
||||||
common.print("-");
|
common.print("-");
|
||||||
} else {
|
} else {
|
||||||
assert.equal(body, content)
|
assert.equal(body, content);
|
||||||
common.print(".");
|
common.print(".");
|
||||||
requests_ok++;
|
requests_ok++;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
common = require("../common");
|
common = require("../common");
|
||||||
assert = common.assert
|
assert = common.assert;
|
||||||
|
|
||||||
var complete = false;
|
var complete = false;
|
||||||
var idle = new process.IdleWatcher();
|
var idle = new process.IdleWatcher();
|
||||||
|
@ -4,7 +4,7 @@ var spawn = require('child_process').spawn;
|
|||||||
|
|
||||||
if (process.title === '') {
|
if (process.title === '') {
|
||||||
console.log('skipping test -- not implemented for the host platform');
|
console.log('skipping test -- not implemented for the host platform');
|
||||||
return;
|
//return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// disabled because of two things
|
// disabled because of two things
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
common = require("../common");
|
common = require("../common");
|
||||||
assert = common.assert
|
assert = common.assert;
|
||||||
|
|
||||||
var http = require('http');
|
var http = require('http');
|
||||||
var sys = require('sys');
|
var sys = require('sys');
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// Requires special privlages
|
// Requires special privlages
|
||||||
common = require("../common");
|
common = require("../common");
|
||||||
assert = common.assert
|
assert = common.assert;
|
||||||
var assert = require('assert');
|
var assert = require('assert');
|
||||||
|
|
||||||
var oldgid = process.getgid();
|
var oldgid = process.getgid();
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
common = require("../common");
|
common = require("../common");
|
||||||
assert = common.assert
|
assert = common.assert;
|
||||||
var sys=require('sys');
|
var sys=require('sys');
|
||||||
var net=require('net');
|
var net=require('net');
|
||||||
var fs=require('fs');
|
var fs=require('fs');
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
common = require("../common");
|
common = require("../common");
|
||||||
assert = common.assert
|
assert = common.assert;
|
||||||
|
|
||||||
var sys=require('sys');
|
var sys=require('sys');
|
||||||
var net=require('net');
|
var net=require('net');
|
||||||
|
2
test/fixtures/echo.js
vendored
2
test/fixtures/echo.js
vendored
@ -1,5 +1,5 @@
|
|||||||
common = require("../common");
|
common = require("../common");
|
||||||
assert = common.assert
|
assert = common.assert;
|
||||||
|
|
||||||
common.print("hello world\r\n");
|
common.print("hello world\r\n");
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user