tls_wrap: ensure that TLSCallbacks are gc-able

Call `MakeWeak()` to destruct TLSCallbacks when the js-object dies.

fix #8416

Reviewed-By: Fedor Indutny <fedor@indutny.com>
tests: add test for buffer.slice.

4c9b30d introduced a regression in buffer.slice that 7c3c51b fixed, but
no test had been added to make sure that a similar regression is caught
by the tests suite in the future.
test: disable dgram-bind-shared-ports on win32

Windows currently doesn't support clustered dgram sockets, when it does
re-enable this test
benchmark: add test for module loader

Adds a test for benchmarking the module loader, needed for benchmarking
changes / refacortings in the module loader.

Reviewed-by: Trevor Norris <trev.norris@gmail.com>
Reviewed-by: Timothy J Fontaine <tjfontaine@gmail.com>
net: Make server.connections un-enumerable

The property server.connections should no longer be enumerable because
it has been deprecated. This will prevent deprecation warnings when
server objects are accessed by functions such as JSON.stringify.

Fixes: https://github.com/joyent/node/issues/8373
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
deps: upgrade npm to 2.0.0
2014.09.24, Version 0.11.14 (Unstable)

* uv: Upgrade to v1.0.0-rc1

* http_parser: Upgrade to v2.3.0

* npm: Upgrade to v2.0.0

* openssl: Upgrade to v1.0.1i

* v8: Upgrade to 3.26.33

* Add fast path for simple URL parsing (Gabriel Wicke)

* Added support for options parameter in console.dir() (Xavi Magrinyà)

* Cluster: fix shared handles on Windows (Alexis Campailla)

* buffer: Fix incorrect Buffer.compare behavior (Feross Aboukhadijeh)

* buffer: construct new buffer from buffer toJSON() output (cjihrig)

* buffer: improve Buffer constructor (Kang-Hao Kenny)

* build: linking CoreFoundation framework for OSX (Thorsten Lorenz)

* child_process: accept uid/gid everywhere (Fedor Indutny)

* child_process: add path to spawn ENOENT Error (Ryan Cole)

* child_process: copy spawnSync() cwd option to proper buffer (cjihrig)

* child_process: do not access stderr when stdio set to 'ignore' (cjihrig)

* child_process: don't throw on EAGAIN (Charles)

* child_process: don't throw on EMFILE/ENFILE (Ben Noordhuis)

* child_process: use full path for cmd.exe on Win32 (Ed Morley)

* cluster: allow multiple calls to setupMaster() (Ryan Graham)

* cluster: centralize removal from workers list. (Julien Gilli)

* cluster: enable error/message events using .worker (cjihrig)

* cluster: include settings object in 'setup' event (Ryan Graham)

* cluster: restore v0.10.x setupMaster() behaviour (Ryan Graham)

* cluster: support options in Worker constructor (cjihrig)

* cluster: test events emit on cluster.worker (Sam Roberts)

* console: console.dir() accepts options object (Xavi Magrinyà)

* crypto: add `honorCipherOrder` argument (Fedor Indutny)

* crypto: allow padding in RSA methods (Fedor Indutny)

* crypto: clarify RandomBytes() error msg (Mickael van der Beek)

* crypto: never store pointer to conn in SSL_CTX (Fedor Indutny)

* crypto: unsigned value can't be negative (Brian White)

* dgram: remove new keyword from errnoException (Jackson Tian)

* dns: always set variable family in lookup() (cjihrig)

* dns: include host name in error message if available (Maciej Małecki)

* dns: introduce lookupService function (Saúl Ibarra Corretgé)

* dns: send lookup c-ares errors to callback (Chris Dickinson)

* dns: throw if hostname is not string or falsey (cjihrig)

* events: Output the event that is leaking (Arnout Kazemier)

* fs: close file if fstat() fails in readFile() (cjihrig)

* fs: fs.readFile should not throw uncaughtException (Jackson Tian)

* http: add 308 status_code, see RFC7238 (Yazhong Liu)

* http: don't default OPTIONS to chunked encoding (Nick Muerdter)

* http: fix bailout for writeHead (Alex Kocharin)

* http: remove unused code block (Fedor Indutny)

* http: write() after end() emits an error. (Julien Gilli)

* lib, src: add vm.runInDebugContext() (Ben Noordhuis)

* lib: noisy deprecation of child_process customFds (Ryan Graham)

* module: don't require fs several times (Robert Kowalski)

* net,dgram: workers can listen on exclusive ports (cjihrig)

* net,stream: add isPaused, don't read() when paused (Chris Dickinson)

* net: Ensure consistent binding to IPV6 if address is absent (Raymond Feng)

* net: add remoteFamily for socket (Jackson Tian)

* net: don't emit listening if handle is closed (Eli Skeggs)

* net: don't prefer IPv4 addresses during resolution (cjihrig)

* net: don't throw on net.Server.close() (cjihrig)

* net: reset `errorEmitted` on reconnect (Ed Umansky)

* node: set names for prototype methods (Trevor Norris)

* node: support v8 microtask queue (Vladimir Kurchatkin)

* path: fix slice OOB in trim (Lucio M. Tato)

* path: isAbsolute() should always return boolean (Herman Lee)

* process: throw TypeError if kill pid not a number (Sam Roberts)

* querystring: custom encode and decode (fengmk2)

* querystring: do not add sep for empty array (cjihrig)

* querystring: remove prepended ? from query field (Ezequiel Rabinovich)

* readline: fix close event of readline.Interface() (Yazhong Liu)

* readline: fixes scoping bug (Dan Kaplun)

* readline: implements keypress buffering (Dan Kaplun)

* repl: fix multi-line input (Fedor Indutny)

* repl: fix overwrite for this._prompt (Yazhong Liu)

* repl: proper `setPrompt()` and `multiline` support (Fedor Indutny)

* stream: don't try to finish if buffer is not empty (Vladimir Kurchatkin)

* stream: only end reading on null, not undefined (Jonathan Reem)

* streams: set default hwm properly for Duplex (Andrew Oppenlander)

* string_bytes: ucs2 support big endian (Andrew Low)

* tls, crypto: add DHE support (Shigeki Ohtsu)

* tls: `checkServerIdentity` option (Trevor Livingston)

* tls: add DHE-RSA-AES128-SHA256 to the def ciphers (Shigeki Ohtsu)

* tls: better error reporting at cert validation (Fedor Indutny)

* tls: support multiple keys/certs (Fedor Indutny)

* tls: throw an error, not string (Jackson Tian)

* udp: make it possible to receive empty udp packets (Andrius Bentkus)

* url: treat  the same as / (isaacs)
Now working on 0.11.15
doc: fix brackets for optional parameters

Documentation incorrectly used bracket notation for optional parameters.
This caused inconsistencies in usage because of examples like the
following:

    fs.write(fd, data[, position[, encoding]], callback)

This simply fixes all uses of bracket notation in documentation.

Signed-off-by: Trevor Norris <trev.norris@gmail.com>
Reviewed-by: Fedor Indutny <fedor@indutny.com>
readline: fix performance issue when large line

Only run lineEnding.test() on the newly acquired chunk of string instead
of on the entire line buffer.

Reviewed-by: Trevor Norris <trev.norris@gmail.com>
child_process: improve spawn() argument handling

Add stricter argument type checking to normalizeSpawnArguments().

Removes a number of extraneous checks in spawn().

Fix regression in handling of the optional args argument.

Add more thorough testing of spawn() arguments.

Reviewed-by: Trevor Norris <trev.norris@gmail.com>
crypto: lower RSS usage for TLSCallbacks

Don't allocate any BIO buffers initially, do this on a first read from
the TCP connection. Allocate different amount of data for initial read
and for consequent reads: small buffer for hello+certificate, big buffer
for better throughput.

see #8416
timer_wrap: remove HandleScopes, check return size

Calls from JS to C++ have an implicit HandleScope. So there is no need
to instantiate a new HandleScope in these basic cases.

Check if the returned int64_t is an SMI and cast the return value to
uint32_t instead of a double. Prevents needing to box the return value,
and saves a small amount of execution time.

Signed-off-by: Trevor Norris <trev.norris@gmail.com>
http: cleanup setHeader()

Several fields on OutgoingMessage were set after instantiation. These
have been included in the constructor to prevent mutation of the object
map after instantiation.

"name" is now explicitly checked to be a string. Where before if a
non-string was passed the following cryptic error was thrown:

    _http_outgoing.js:334
      var key = name.toLowerCase();
                     ^
    TypeError: undefined is not a function

Signed-off-by: Trevor Norris <trev.norris@gmail.com>
readme: grammer fix

Reviewed-by: Trevor Norris <trev.norris@gmail.com>
src: fix VC++ warning C4244

Reviewed-by: Trevor Norris <trev.norris@gmail.com>
doc: fix optional parameter parsing

The parameter parser specifically looked for the old bracket syntax.
This generated a lot of warnings when building the docs. Those warnings
have been fixed by changing the parsing logic.

Signed-off-by: Trevor Norris <trev.norris@gmail.com>
buffer: fix and cleanup fill()

Running fill() with an empty string would cause Node to hang
indefinitely. Now it will return without having operated on the buffer.

User facing function has been pulled into JS to perform all initial
value checks and coercions. The C++ method has been placed on the
"internal" object.

Coerced non-string values to numbers to match v0.10 support.

Simplified logic and changed a couple variable names.

Added tests for fill() and moved them all to the beginning of
buffer-test.js since many other tests depend on fill() working properly.

Fixes: https://github.com/joyent/node/issues/8469
Signed-off-by: Trevor Norris <trev.norris@gmail.com>
http: Improve _addHeaderLines method

Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
doc: note stdout and stderr special behaviors.

Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>