platform/upstream/nodejs.git
8 years agotools: alphabetize eslint stylistic issues section
Rich Trott [Mon, 8 Feb 2016 04:57:14 +0000 (20:57 -0800)]
tools: alphabetize eslint stylistic issues section

Rearrange the style rules in .eslintrc to be in alphabetical order.

This has two benefits:

It means the rules appear in the same order as they do in the ESLint
documentation, easing cross-referencing.

It also means that it is much easier to determine with visual inspection
if a rule is set or not.

https://github.com/nodejs/node/pull/5135
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
8 years agotest: fix flaky test-dgram-pingpong
Rich Trott [Fri, 5 Feb 2016 00:27:15 +0000 (16:27 -0800)]
test: fix flaky test-dgram-pingpong

There is no guarantee UDP messages will be received. Accommodate the
occasional dropped message.

This is a functionality test, not a performance benchmark. Speed up the
test by not sending 1500 messages across three ports.

Fixes: https://github.com/nodejs/node/issues/4526
PR-URL: https://github.com/nodejs/node/pull/5125
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
8 years agotest: fix child-process-fork-regr-gh-2847
Santiago Gimeno [Sat, 6 Feb 2016 15:19:03 +0000 (16:19 +0100)]
test: fix child-process-fork-regr-gh-2847

The test would sometimes time out on some platforms. Take the initial
version of the test and instead of sending 100 handles, just send 2.
It still fails when run with the code before the change was introduced
and passes afterwards.

Remove test from parallel.status.

PR-URL: https://github.com/nodejs/node/pull/5121
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Fixes: https://github.com/nodejs/node/issues/3635

8 years agodoc: fix dgram doc indentation
Rich Trott [Sat, 6 Feb 2016 07:58:35 +0000 (23:58 -0800)]
doc: fix dgram doc indentation

PR-URL: https://github.com/nodejs/node/pull/5118
Reviewed-By: Roman Reiss <me@silverwind.io>
8 years agotools: lint for empty character classes in regex
Rich Trott [Sat, 6 Feb 2016 04:39:45 +0000 (20:39 -0800)]
tools: lint for empty character classes in regex

Enable linting rule to forbid empty character classes in regular
expressions. See http://eslint.org/docs/rules/no-empty-character-class

Organize "Possible Error" rules in .eslintrc in alphabetical order to
match eslint documentation.

PR-URL: https://github.com/nodejs/node/pull/5115
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
8 years agodoc: fix typo in dgram doc
Rich Trott [Sat, 6 Feb 2016 04:18:09 +0000 (20:18 -0800)]
doc: fix typo in dgram doc

Remove stray square brackets from dgram documentation.

PR-URL: https://github.com/nodejs/node/pull/5114
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>

8 years agocrypto: fix memory leak in LoadPKCS12
Fedor Indutny [Sat, 6 Feb 2016 04:13:36 +0000 (23:13 -0500)]
crypto: fix memory leak in LoadPKCS12

`sk_X509_pop_free` should be used instead of `sk_X509_free` to free all
items in queue too, not just the queue itself.

PR-URL: https://github.com/nodejs/node/pull/5109
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Shigeki Ohtsu <ohtsu@iij.ad.jp>
8 years agocrypto: add `pfx` certs as CA certs too
Fedor Indutny [Sat, 6 Feb 2016 04:13:30 +0000 (23:13 -0500)]
crypto: add `pfx` certs as CA certs too

According to documentation all certificates specified in `pfx` option
should be treated as a CA certificates too. While it doesn't seem to be
logically correct to me, we can't afford to break API stability at this
point.

Fix: #5100
PR-URL: https://github.com/nodejs/node/pull/5109
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Shigeki Ohtsu <ohtsu@iij.ad.jp>
8 years agotest: don't run test-tick-processor.js on Aix
Michael Dawson [Thu, 4 Feb 2016 23:30:13 +0000 (18:30 -0500)]
test: don't run test-tick-processor.js on Aix

Currently the test-tick-processor functionality in V8
depends on addresses being smaller than a full 64 bits.  Aix supports
the full 64 bits and the result is that it does not process the
addresses correctly and runs of out memory.
Disabling until we get a fix upstreamed into V8.

PR-URL: https://github.com/nodejs/node/pull/5093
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: thefourtheye - Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
8 years agotest: mark flaky tests on Raspberry Pi
Rich Trott [Thu, 4 Feb 2016 19:55:50 +0000 (11:55 -0800)]
test: mark flaky tests on Raspberry Pi

A few tests have started failing on Raspberry Pi devices in CI.
https://ci.nodejs.org/job/node-test-binary-arm/943/

PR-URL: https://github.com/nodejs/node/pull/5082
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Roman Klauke <romaaan.git@gmail.com>
Ref: https://github.com/nodejs/node/issues/4830
Ref: https://github.com/nodejs/node/issues/3635
Ref: https://github.com/nodejs/node/issues/4526

8 years agosrc: clean up usage of __proto__
Jackson Tian [Thu, 4 Feb 2016 02:53:17 +0000 (10:53 +0800)]
src: clean up usage of __proto__

Prefer using Object.setPrototypeOf() instead.

PR-URL: https://github.com/nodejs/node/pull/5069
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
8 years agodoc: fix link in cluster documentation
Timothy Gu [Thu, 4 Feb 2016 02:33:39 +0000 (18:33 -0800)]
doc: fix link in cluster documentation

PR-URL: https://github.com/nodejs/node/pull/5068
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
8 years agotools: lint for spacing around unary operators
Rich Trott [Wed, 3 Feb 2016 20:27:40 +0000 (12:27 -0800)]
tools: lint for spacing around unary operators

Enable `space-unary-ops` in `.eslintrc`. This prohibits things like:

    i ++        // use `i++` instead
    typeof(foo) // use `typeof foo` or `typeof (foo)` instead

Ref: https://github.com/nodejs/node/pull/4772#discussion_r51732299
PR-URL: https://github.com/nodejs/node/pull/5063
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: James M Snell <jasnell@gmail.com>
8 years agotools: enable no-redeclare rule for linter
Rich Trott [Thu, 14 Jan 2016 00:14:28 +0000 (16:14 -0800)]
tools: enable no-redeclare rule for linter

PR-URL: https://github.com/nodejs/node/pull/5047
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
8 years agotools: fix redeclared vars in doc/json.js
Rich Trott [Wed, 3 Feb 2016 00:20:44 +0000 (16:20 -0800)]
tools: fix redeclared vars in doc/json.js

PR-URL: https://github.com/nodejs/node/pull/5047
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
8 years agodeps: backport 8d00c2c from v8 upstream
Gibson Fahnestock [Mon, 1 Feb 2016 12:13:28 +0000 (12:13 +0000)]
deps: backport 8d00c2c from v8 upstream

Original commit message:

```
Stop profiler on isolate teardown if still running

If the profiler is started via the API and not stopped, V8 will
 intermittently crash during isolate teardown.

The fix is to run the DeleteAllProfiles function in Isolate::Deinit()
 if cpu_profiler_ still exists.

https://groups.google.com/forum/#!topic/v8-dev/WsIlpbaD4mo

TEST= Run in debug mode, if you start a profile and don't stop it,
 this assert should fail:

   Fatal error in ../src/profiler/cpu-profiler.cc, line 414
   Check failed: !is_profiling_.

Review URL: https://codereview.chromium.org/1526253005

Cr-Commit-Position: refs/heads/master@{#32953}
```

PR-URL: https://github.com/nodejs/node/pull/5024
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
8 years agodoc: fix minor typo in process doc
Prayag Verma [Mon, 1 Feb 2016 04:49:05 +0000 (10:19 +0530)]
doc: fix minor typo in process doc

Remove extra `be`

PR-URL: https://github.com/nodejs/node/pull/5018
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
8 years agodoc: fix typo in Readme.md
Prayag Verma [Mon, 1 Feb 2016 04:37:08 +0000 (10:07 +0530)]
doc: fix typo in Readme.md

Spelling mistake - `begining` > `beginning`

PR-URL: https://github.com/nodejs/node/pull/5017
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
8 years agotest: fix inconsistent styling in test-url
Brian White [Sun, 31 Jan 2016 21:15:52 +0000 (16:15 -0500)]
test: fix inconsistent styling in test-url

PR-URL: https://github.com/nodejs/node/pull/5014
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Minwoo Jung <jmwsoft@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
8 years agodoc: minor improvement in OS docs
Alexander Makarenko [Sun, 31 Jan 2016 14:38:04 +0000 (17:38 +0300)]
doc: minor improvement in OS docs

Add links to `process.arch` and `process.platform`.

PR-URL: https://github.com/nodejs/node/pull/5006
Reviewed-By: Roman Klauke <romaaan.git@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
8 years agodoc: improve styling consistency in VM docs
Alexander Makarenko [Sun, 31 Jan 2016 14:29:27 +0000 (17:29 +0300)]
doc: improve styling consistency in VM docs

Improve functions styling. Connect sections with links.

PR-URL: https://github.com/nodejs/node/pull/5005
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
8 years agodoc: minor improvement to HTTPS doc
Alexander Makarenko [Sun, 31 Jan 2016 13:46:39 +0000 (16:46 +0300)]
doc: minor improvement to HTTPS doc

Add link to Buffer page.

PR-URL: https://github.com/nodejs/node/pull/5002
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Chris Dickinson <chris@neversaw.us>
Reviewed-By: James M Snell <jasnell@gmail.com>
8 years agotest: fix redeclared vars in sequential tests
Rich Trott [Sun, 31 Jan 2016 07:09:00 +0000 (23:09 -0800)]
test: fix redeclared vars in sequential tests

PR-URL: https://github.com/nodejs/node/pull/4999
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Roman Klauke <romaaan.git@gmail.com>
8 years agotest: pummel test fixes
Rich Trott [Sun, 31 Jan 2016 06:58:19 +0000 (22:58 -0800)]
test: pummel test fixes

This fixes some variable redeclarations in pummel tests and, in the
process, gets `test-stream-pipe-multi.js` to run again. It had been
failing to run.

PR-URL: https://github.com/nodejs/node/pull/4998
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
8 years agotest: fix redeclared vars in test-vm-*
Rich Trott [Sun, 31 Jan 2016 06:44:26 +0000 (22:44 -0800)]
test: fix redeclared vars in test-vm-*

PR-URL: https://github.com/nodejs/node/pull/4997
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
8 years agotest: fix redeclared vars in test-url
Rich Trott [Sun, 31 Jan 2016 05:59:41 +0000 (21:59 -0800)]
test: fix redeclared vars in test-url

PR-URL: https://github.com/nodejs/node/pull/4993
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
8 years agodgram: scope redeclared variables
Rich Trott [Fri, 29 Jan 2016 04:08:57 +0000 (20:08 -0800)]
dgram: scope redeclared variables

A few variables in `lib/dgram.js` are redeclared with `var` in a scope
where they have already been declared. These instances can be scoped
more narrowly with `const`, so that's what this change does.

PR-URL: https://github.com/nodejs/node/pull/4940
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
8 years agotest: fix redeclared test-util-* vars
Rich Trott [Sun, 31 Jan 2016 06:18:36 +0000 (22:18 -0800)]
test: fix redeclared test-util-* vars

PR-URL: https://github.com/nodejs/node/pull/4994
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Roman Klauke <romaaan.git@gmail.com>
8 years agotest: fix variable redeclarations
Rich Trott [Sun, 31 Jan 2016 05:46:45 +0000 (21:46 -0800)]
test: fix variable redeclarations

I'm a fan of small changesets, but even I'm getting a little annoyed at
me for opening all these PRs weeding out variable redeclarations. So I'm
bundling a bunch of small changes here.

PR-URL: https://github.com/nodejs/node/pull/4992
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
8 years agotest: fix redeclared test-path vars
Rich Trott [Sun, 31 Jan 2016 05:27:25 +0000 (21:27 -0800)]
test: fix redeclared test-path vars

PR-URL: https://github.com/nodejs/node/pull/4991
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: Roman Klauke <romaaan.git@gmail.com>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: James M Snell <jasnell@gmail.com>
8 years agotest: fix var redeclarations in test-os
Rich Trott [Sun, 31 Jan 2016 05:20:37 +0000 (21:20 -0800)]
test: fix var redeclarations in test-os

PR-URL: https://github.com/nodejs/node/pull/4990
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: Roman Klauke <romaaan.git@gmail.com>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: James M Snell <jasnell@gmail.com>
8 years agotest: fix test-net-* variable redeclarations
Rich Trott [Sun, 31 Jan 2016 05:14:12 +0000 (21:14 -0800)]
test: fix test-net-* variable redeclarations

PR-URL: https://github.com/nodejs/node/pull/4989
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Roman Klauke <romaaan.git@gmail.com>
8 years agotest: fix redeclared test-intl var
Rich Trott [Sun, 31 Jan 2016 04:47:31 +0000 (20:47 -0800)]
test: fix redeclared test-intl var

PR-URL: https://github.com/nodejs/node/pull/4988
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
8 years agotest: fix redeclared test-http-* vars
Rich Trott [Sun, 31 Jan 2016 04:43:11 +0000 (20:43 -0800)]
test: fix redeclared test-http-* vars

PR-URL: https://github.com/nodejs/node/pull/4987
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Roman Klauke <romaaan.git@gmail.com>
8 years agotest: fix redeclared test-event-emitter-* vars
Rich Trott [Sun, 31 Jan 2016 04:16:14 +0000 (20:16 -0800)]
test: fix redeclared test-event-emitter-* vars

PR-URL: https://github.com/nodejs/node/pull/4985
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
8 years agotest: remove redeclared var in test-domain
Rich Trott [Sun, 31 Jan 2016 04:08:42 +0000 (20:08 -0800)]
test: remove redeclared var in test-domain

PR-URL: https://github.com/nodejs/node/pull/4984
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
8 years agohttps: evict cached sessions on error
Fedor Indutny [Sat, 30 Jan 2016 23:49:11 +0000 (18:49 -0500)]
https: evict cached sessions on error

Instead of using the same session over and over, evict it when the
socket emits error. This could be used as a mitigation of #3692, until
OpenSSL fix will be merged/released.

See: https://github.com/nodejs/node/issues/3692
PR-URL: https://github.com/nodejs/node/pull/4982
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Shigeki Ohtsu <ohtsu@iij.ad.jp>
8 years agotest: remove var redeclarations in test-crypto-*
Rich Trott [Sat, 30 Jan 2016 23:43:38 +0000 (15:43 -0800)]
test: remove var redeclarations in test-crypto-*

PR-URL: https://github.com/nodejs/node/pull/4981
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
8 years agotest: remove test-cluster-* var redeclarations
Rich Trott [Sat, 30 Jan 2016 23:22:35 +0000 (15:22 -0800)]
test: remove test-cluster-* var redeclarations

PR-URL: https://github.com/nodejs/node/pull/4980
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
8 years agotest: fix test-http-extra-response flakiness
Santiago Gimeno [Sat, 30 Jan 2016 19:55:07 +0000 (20:55 +0100)]
test: fix test-http-extra-response flakiness

It can happen that the extra response is to be sent in a different chunk
from the rest of the data. At this moment, the client might have already
closed the socket causing an `ECONNRESET` error.

PR-URL: https://github.com/nodejs/node/pull/4979
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
8 years agolib: remove string_decoder.js var redeclarations
Rich Trott [Sat, 30 Jan 2016 23:08:56 +0000 (15:08 -0800)]
lib: remove string_decoder.js var redeclarations

PR-URL: https://github.com/nodejs/node/pull/4978
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
8 years agorepl: remove variable redeclaration
Rich Trott [Sat, 30 Jan 2016 23:01:06 +0000 (15:01 -0800)]
repl: remove variable redeclaration

`match` and `filter` are declared twice with `var` in `repl.js`.
Declare the variables only once.

PR-URL: https://github.com/nodejs/node/pull/4977
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
8 years agotools: apply linting to doc tools
Rich Trott [Sat, 30 Jan 2016 18:17:57 +0000 (10:17 -0800)]
tools: apply linting to doc tools

Apply eslint rules to `tools/doc`.

PR-URL: https://github.com/nodejs/node/pull/4973
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
8 years agotools: fix detecting constructor for JSON doc
Timothy Gu [Sat, 30 Jan 2016 05:11:49 +0000 (21:11 -0800)]
tools: fix detecting constructor for JSON doc

Regex previous was not detecting cases like AssertionError as
a class name.

PR-URL: https://github.com/nodejs/node/pull/4966
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Chris Dickinson <chris@neversaw.us>
8 years agolib: scope loop variables
Rich Trott [Sat, 30 Jan 2016 04:34:13 +0000 (20:34 -0800)]
lib: scope loop variables

Refactor instances in `lib` where a loop variable is redeclared in the
same scope with `var`. In these cases, `let` can be used to scope the
variable declarations more precisely.

PR-URL: https://github.com/nodejs/node/pull/4965
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
8 years agonet: refactor redeclared variables
Rich Trott [Sat, 30 Jan 2016 03:57:34 +0000 (19:57 -0800)]
net: refactor redeclared variables

`lib/net.js` contained four variables that were redeclared with `var` in
the same scope. This change refactors those redeclarations so they are
scoped properly.

PR-URL: https://github.com/nodejs/node/pull/4963
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Roman Klauke <romaaan.git@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
8 years agomodule: refactor redeclared variable
Rich Trott [Sat, 30 Jan 2016 03:45:20 +0000 (19:45 -0800)]
module: refactor redeclared variable

`homedir` was declared with `var` twice in the same scope in
`lib/module.js`. This change makes it a single declaration.

PR-URL: https://github.com/nodejs/node/pull/4962
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Minwoo Jung <jmwsoft@gmail.com>
Reviewed-By: Roman Klauke <romaaan.git@gmail.com>
8 years agofs: refactor redeclared variables
Rich Trott [Fri, 29 Jan 2016 22:03:13 +0000 (14:03 -0800)]
fs: refactor redeclared variables

Two variables are declared twice with `var` in the same scope in
`lib/fs.js`. This change refactors the code so the variable is declared
just once.

PR-URL: https://github.com/nodejs/node/pull/4959
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
8 years agodoc: spell writable consistently
Peter Lyons [Fri, 29 Jan 2016 17:58:50 +0000 (10:58 -0700)]
doc: spell writable consistently

Docs have 108 instances of "writable" and only 1 "writeable" so
fix this one.

PR-URL: https://github.com/nodejs/node/pull/4954
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
8 years agotest: scope redeclared vars in test-child-process*
Rich Trott [Fri, 29 Jan 2016 07:02:57 +0000 (23:02 -0800)]
test: scope redeclared vars in test-child-process*

A handful of child process tests had variables declared multiple times
in the same scope using `var`. This change scopes those declarations.

PR-URL: https://github.com/nodejs/node/pull/4944
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
8 years agotest: refactor switch
Rich Trott [Tue, 26 Jan 2016 00:07:59 +0000 (16:07 -0800)]
test: refactor switch

`test-child-process-fork-net2.js` has a switch statement with 6 cases.
Each case uses `child.send()`, passing an object for the callback.
`child.send()` ignores the callback because it is not a function.
Removing the unused argument.

PR-URL: https://github.com/nodejs/node/pull/4870
Reviewed-By: Alexis Campailla <orangemocha@nodejs.org>
8 years agotest: add common.platformTimeout() to dgram test
Rich Trott [Thu, 28 Jan 2016 23:59:35 +0000 (15:59 -0800)]
test: add common.platformTimeout() to dgram test

Use common.platformTimeout() to mitigate potential for CI to timeout
on slower devices.

Ref: https://github.com/nodejs/node/issues/4937
PR-URL: https://github.com/nodejs/node/pull/4938
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Myles Borins <mborins@us.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
8 years agotest: fix flaky cluster test on Windows 10
Rich Trott [Thu, 28 Jan 2016 06:00:33 +0000 (22:00 -0800)]
test: fix flaky cluster test on Windows 10

test-cluster-shared-leak was flaky on Windows 10. Remove unnecessary
.send() calls and replace with .disconnect() to avoid spurious EPIPE.

Fixes: https://github.com/nodejs/node/issues/4887
PR-URL: https://github.com/nodejs/node/pull/4934
Reviewed-By: James M Snell <jasnell@gmail.com>
8 years agodoc: update eol handling in readline
Kári Tristan Helgason [Thu, 28 Jan 2016 11:01:20 +0000 (11:01 +0000)]
doc: update eol handling in readline

This commit explicitly calls out the end of line sequences
used to generate line events in the readline module.

Fixes: https://github.com/nodejs/node/issues/4916
PR-URL: https://github.com/nodejs/node/pull/4927
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
8 years agodoc: add more details to process.env
Evan Lucas [Thu, 28 Jan 2016 03:27:56 +0000 (21:27 -0600)]
doc: add more details to process.env

process.env has a few quirks that deserve documenting.

The commit documents:

- How assigning to process.env will implicitly call `toString()`
- How to remove an environment variable from process.env

PR-URL: https://github.com/nodejs/node/pull/4924
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
8 years agotest: Add assertion for TLS peer certificate fingerprint
Alan Cohen [Thu, 28 Jan 2016 00:01:19 +0000 (16:01 -0800)]
test: Add assertion for TLS peer certificate fingerprint

PR-URL: https://github.com/nodejs/node/pull/4923
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
8 years agocrypto: use SSL_CTX_clear_extra_chain_certs.
Adam Langley [Wed, 27 Jan 2016 20:28:41 +0000 (12:28 -0800)]
crypto: use SSL_CTX_clear_extra_chain_certs.

The SSL_CTX_clear_extra_chain_certs function clears the extra
certificates associated with an SSL_CTX without reaching into the
SSL_CTX structure itself (which will become impossible in OpenSSL
1.1.0). The underlying implementation in OpenSSL[1] is the same what the
code was doing and OpenSSL has provided this function since 0.9.8 so
this change should be fully compatible.

[1] https://github.com/nodejs/node/blob/master/deps/openssl/openssl/ssl/s3_lib.c#L3899

PR-URL: https://github.com/nodejs/node/pull/4919
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Reviewed-By: Shigeki Ohtsu <ohtsu@iij.ad.jp>
8 years agocrypto: fix build when OCSP-stapling not provided
Adam Langley [Wed, 27 Jan 2016 20:15:00 +0000 (12:15 -0800)]
crypto: fix build when OCSP-stapling not provided

node_crypto.cc attempts to handle the case where OCSP stapling APIs
aren't provided by using NODE__HAVE_TLSEXT_STATUS_CB. But the build
would actually fail in this case because of a couple of places that were
missing #ifdefs.

With this change the build works although, as expected,
test-tls-ocsp-callback.js will fail.

PR-URL: https://github.com/nodejs/node/pull/4914
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Shigeki Ohtsu <ohtsu@iij.ad.jp>
8 years agocrypto: use a const SSL_CIPHER
Adam Langley [Wed, 27 Jan 2016 18:58:09 +0000 (10:58 -0800)]
crypto: use a const SSL_CIPHER

SSL_CIPHER objects are conceptually const in any case and this allows
STACK_OF(SSL_CIPHER) to return a const pointer, as is done in BoringSSL
and, perhaps, OpenSSL in the future.

PR-URL: https://github.com/nodejs/node/pull/4913
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
8 years agotest,buffer: refactor redeclarations
Rich Trott [Wed, 27 Jan 2016 00:47:10 +0000 (16:47 -0800)]
test,buffer: refactor redeclarations

Many variables in the buffer tests are redeclared. Change them so that
they are scoped appropriately.

PR-URL: https://github.com/nodejs/node/pull/4893
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: James M Snell <jasnell@gmail.com>
8 years agotest: fix test-tls-zero-clear-in flakiness
Santiago Gimeno [Tue, 26 Jan 2016 23:44:36 +0000 (00:44 +0100)]
test: fix test-tls-zero-clear-in flakiness

It can happen that the server-side socket is destroyed before the
client-side socket has gracefully closed, thus causing a 'ECONNRESET'
error in this socket. To solve this, also close gracefully in the server
side too.

PR-URL: https://github.com/nodejs/node/pull/4888
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
8 years agobuffer: refactor redeclared variables
Rich Trott [Tue, 26 Jan 2016 21:17:31 +0000 (13:17 -0800)]
buffer: refactor redeclared variables

A handful of variable declarations in `lib/buffer.js` redeclare the same
variable in the same scope. This change removes each redeclaration by
switching to `const`, switching to `let`, or explicitly hoisting the
`var` declaration.

PR-URL: https://github.com/nodejs/node/pull/4886
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Roman Klauke <romaaan.git@gmail.com>
8 years agotls_wrap: reach error reporting for UV_EPROTO
Fedor Indutny [Tue, 26 Jan 2016 20:01:12 +0000 (15:01 -0500)]
tls_wrap: reach error reporting for UV_EPROTO

Do not swallow error details when reporting UV_EPROTO asynchronously,
and when creating artificial errors.

Fix: #3692
PR-URL: https://github.com/nodejs/node/pull/4885
Reviewed-By: Shigeki Ohtsu <ohtsu@iij.ad.jp>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
8 years agotools: add property types in JSON documentation
Timothy Gu [Tue, 26 Jan 2016 18:22:00 +0000 (10:22 -0800)]
tools: add property types in JSON documentation

PR-URL: https://github.com/nodejs/node/pull/4884
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
8 years agonet: move isLegalPort to internal/net
Evan Lucas [Tue, 26 Jan 2016 14:12:41 +0000 (08:12 -0600)]
net: move isLegalPort to internal/net

isLegalPort can be used in more places than just net.js. This change
moves it to a new internal net module in preparation for using it in
the dns module.

PR-URL: https://github.com/nodejs/node/pull/4882
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
8 years agourl: change scoping of variables with let
Kári Tristan Helgason [Mon, 25 Jan 2016 22:41:23 +0000 (22:41 +0000)]
url: change scoping of variables with let

Also changes some `var`s to `const` as they never change.

PR-URL: https://github.com/nodejs/node/pull/4867
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
8 years agotest: fix irregular whitespace issue
Roman Reiss [Mon, 25 Jan 2016 21:22:14 +0000 (22:22 +0100)]
test: fix irregular whitespace issue

PR-URL: https://github.com/nodejs/node/pull/4864
Reviewed-By: targos - Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Roman Klauke <romaaan.git@gmail.com>
8 years agotools: enable assorted ESLint error rules
Roman Reiss [Mon, 25 Jan 2016 21:15:16 +0000 (22:15 +0100)]
tools: enable assorted ESLint error rules

Enables assorted rules from the category of possible errors. These
should not get in the way in any form.

- http://eslint.org/docs/rules/no-control-regex
- http://eslint.org/docs/rules/no-extra-boolean-cast
- http://eslint.org/docs/rules/no-invalid-regexp
- http://eslint.org/docs/rules/no-irregular-whitespace
- http://eslint.org/docs/rules/no-unexpected-multiline

PR-URL: https://github.com/nodejs/node/pull/4864
Reviewed-By: targos - Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Roman Klauke <romaaan.git@gmail.com>
8 years agotest: fs.link() test runs on same device
Drew Folta [Mon, 25 Jan 2016 19:08:30 +0000 (11:08 -0800)]
test: fs.link() test runs on same device

When running the tests if `NODE_TEST_DIR` is set to a device different
than the location of the test files (where this repo is checked out),
then the parallel/test-fs-link.js test will fail with
`EXDEV: cross-device link not permitted`. The code works fine (and is in
fact throwing an error as desired) but the test fails.

This commit first creates the "source" file in the same directory as the
"destination" (where the hardlink will be created).

PR-URL: https://github.com/nodejs/node/pull/4861
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Rich Trott <rtrott@gmail.com>
8 years agotest: scope redeclared variable
Rich Trott [Thu, 14 Jan 2016 00:14:28 +0000 (16:14 -0800)]
test: scope redeclared variable

`test-assert.js` redeclares a variable with `var`. This change converts
it to a `const` declaration and wraps it in a standalone block to scope
it to just the test that uses it.

PR-URL: https://github.com/nodejs/node/pull/4854
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: targos - Michaël Zasso <mic.besace@gmail.com>
8 years agotls: scope loop vars with let
Rich Trott [Mon, 25 Jan 2016 05:58:18 +0000 (21:58 -0800)]
tls: scope loop vars with let

`lib/_tls_common.js` had instances of `for` loops that defined variables
with `var` such that they were re-declared in the same scope. This
change scopes those variables with `let` so that they are not
re-declared.

PR-URL: https://github.com/nodejs/node/pull/4853
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
8 years agosrc: remove no longer relevant comments
Chris911 [Sun, 24 Jan 2016 20:13:18 +0000 (15:13 -0500)]
src: remove no longer relevant comments

PR-URL: https://github.com/nodejs/node/pull/4843
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
8 years agodns: throw a TypeError in lookupService with invalid port
Evan Lucas [Sun, 24 Jan 2016 14:58:56 +0000 (08:58 -0600)]
dns: throw a TypeError in lookupService with invalid port

Previously, port was assumed to be a number and would cause an abort in
cares_wrap. This change throws a TypeError if port is not a number
before we actually hit C++.

Fixes: https://github.com/nodejs/node/issues/4837
PR-URL: https://github.com/nodejs/node/pull/4839
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Roman Klauke <romaaan.git@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
8 years agodoc: undo move http.IncomingMessage.statusMessage
Jeff Harris [Fri, 22 Jan 2016 22:45:12 +0000 (14:45 -0800)]
doc: undo move http.IncomingMessage.statusMessage

The description for `statusMessage` was accidentally moved under the
heading for `http.IncomingMessage.socket`.  This commit puts it back
in the correct place.

PR-URL: https://github.com/nodejs/node/pull/4822
Fixes: https://github.com/nodejs/node/issues/4558
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Roman Klauke <romaaan.git@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
8 years agostream: refactor redeclared variables
Rich Trott [Fri, 22 Jan 2016 06:35:51 +0000 (22:35 -0800)]
stream: refactor redeclared variables

`lib/_stream_readable.js` contained three instances of `var`
declarations occurring twice in the same scope. Refactored to `const` or
`let` as appropriate.

PR-URL: https://github.com/nodejs/node/pull/4816
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
8 years agotest: update arrow function style
cjihrig [Thu, 28 Jan 2016 15:21:57 +0000 (10:21 -0500)]
test: update arrow function style

This commit applies new arrow function linting rules across the
codebase. As it turns out, the only offenders were in the test
directory.

PR-URL: https://github.com/nodejs/node/pull/4813
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
8 years agotools: add arrow function rules to eslint
cjihrig [Fri, 22 Jan 2016 05:27:02 +0000 (00:27 -0500)]
tools: add arrow function rules to eslint

This commit enables the following rules:
* arrow-parens - requires parens around arrow function arguments
* arrow-spacing - ensures a space on each side of the =>
* no-arrow-condition - prevents accidental use of => in cases
where the user really intends to use <=

PR-URL: https://github.com/nodejs/node/pull/4813
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
8 years agotest: mark test-tick-processor flaky
Rich Trott [Thu, 21 Jan 2016 23:33:34 +0000 (15:33 -0800)]
test: mark test-tick-processor flaky

PR-URL: https://github.com/nodejs/node/pull/4809
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: James M Snell <jasnell@gmail.com>
Ref: https://github.com/nodejs/node/issues/4427

8 years agodoc: proper markdown escaping -> \_\_, \*, \_
Robert Jefe Lindstaedt [Thu, 21 Jan 2016 21:55:55 +0000 (22:55 +0100)]
doc: proper markdown escaping -> \_\_, \*, \_

PR-URL: https://github.com/nodejs/node/pull/4805
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
8 years agotools: fix setting path containing an ampersand
Brian White [Thu, 21 Jan 2016 21:20:23 +0000 (16:20 -0500)]
tools: fix setting path containing an ampersand

This commit fixes an issue with the Node.js command prompt
on Windows where the PATH environment variable would not be
set correctly if the existing PATH contained an '&'.

Fixes: https://github.com/nodejs/node/issues/4802
PR-URL: https://github.com/nodejs/node/pull/4804
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
8 years agotest: refactor test-net-settimeout
Rich Trott [Thu, 21 Jan 2016 18:41:30 +0000 (10:41 -0800)]
test: refactor test-net-settimeout

test-net-settimeout is unnecessarily complex. This change simplifies it.

PR-URL: https://github.com/nodejs/node/pull/4799
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
8 years agoprocess: support symbol events
cjihrig [Thu, 21 Jan 2016 18:07:25 +0000 (13:07 -0500)]
process: support symbol events

Event emitters support symbols as event names. The process object
assumes that the event name is a string, and examines the first
three characters to check for signals. This causes an exception
if the event name is a symbol. This commit ensures that the
event name is a string before trying to slice() it.

PR-URL: https://github.com/nodejs/node/pull/4798
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: Wyatt Preul <wpreul@gmail.com>
8 years agodoc: remove unnecessary bind(this)
Dmitriy Lazarev [Thu, 21 Jan 2016 16:21:16 +0000 (21:21 +0500)]
doc: remove unnecessary bind(this)

PR-URL: https://github.com/nodejs/node/pull/4797
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Chris Dickinson <chris@neversaw.us>
Reviewed-By: Roman Reiss <me@silverwind.io>
8 years agotest: remove race condition in http flood test
Rich Trott [Thu, 21 Jan 2016 06:55:00 +0000 (22:55 -0800)]
test: remove race condition in http flood test

Timer race results in some flakiness on slower devices in CI. Remove
unneeded setTimeout() and replace booleans with common.mustCall().

PR-URL: https://github.com/nodejs/node/pull/4793
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
8 years agotest: remove test-http-exit-delay
Rich Trott [Thu, 21 Jan 2016 00:13:40 +0000 (16:13 -0800)]
test: remove test-http-exit-delay

test-http-exit-delay has a flaky history. Examination of the bug it was
written to find suggests that the test should be removed.

* The test is trying to find a delay of up to 1 second, but the delay
may also be much smaller than that. So the test will not catch the bug
all the time. It is therefore flaky when the bug exists.

* Experience has shown that the test is flaky as well when the bug is
absent in the code because it can sometimes take slower devices (such as
the Raspberry Pi devices that we have in continuous integration) more
than the allowed one second to run. Increasing the timeout for those
devices will make the test pass but will also mean that the test isn't
really testing anything because the delay it is trying to catch was a
delay of up to one second.

I don't think this is an appropriate test to run once on CI. If there is
to be a test for the issue in question, it should be a benchmark test
that is run a large number of times. We don't really have such tests in
CI yet

I would argue that this test is actively a problem. It does not reliably
catch the issue it is supposed to catch, nor can it likely be made to do
so. (To do so would likely require converting it to a benchmarking test
as previously described. We don't run those in CI, at least not at this
time.)

Because this test will have both false positives and false negatives,
especially on the slower devices, it contributes to a culture of
dismissing failed tests. It does not reliably identify an issue nor does
it reliably pass on a working code base. This test should be removed.

Ref: https://github.com/nodejs/node/pull/4277
PR-URL: https://github.com/nodejs/node/pull/4786
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
8 years agotest: refactor test-fs-watch
Rich Trott [Wed, 20 Jan 2016 07:30:43 +0000 (23:30 -0800)]
test: refactor test-fs-watch

* Exchange 20 millisecond timers for setImmediate().

* Do not attempt to unlink path that will have been guaranteed to be
removed by `common.refreshTmpDir()`

* Do not swallow errors thrown by failed creation of needed test
subdirectory. If that happens, we want to know about it.

* Use `common.isSunOS` in one place where it is applicable

PR-URL: https://github.com/nodejs/node/pull/4776
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
8 years agotest: fix `net-socket-timeout-unref` flakiness
Santiago Gimeno [Sat, 16 Jan 2016 00:54:44 +0000 (01:54 +0100)]
test: fix `net-socket-timeout-unref` flakiness

From time to time this test is failing in OS X because at least one of
the connections takes quite a long time (around 5 seconds) causing some
of the timers may fire before the test exited. To solve this, wait for
all the connections to be established before setting the timeouts and
unrefing the sockets.

PR-URL: https://github.com/nodejs/node/pull/4772
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
8 years agotest: remove Object.observe from tests
Vladimir Kurchatkin [Tue, 19 Jan 2016 21:12:57 +0000 (00:12 +0300)]
test: remove Object.observe from tests

Testing this wasn't really useful, besides Object.observe is going to be
deprecated.

Also this test fails with Chakra (#4765) for obvious reason.

PR-URL: https://github.com/nodejs/node/pull/4769
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
8 years agointernal/child_process: call postSend on error
Fedor Indutny [Tue, 19 Jan 2016 01:59:18 +0000 (20:59 -0500)]
internal/child_process: call postSend on error

Call `obj.postSend` in error case of `process.send()`. The
`net.Socket`'s handle should not be leaked.

Note that there are two callbacks invoked on handles
when they are sent to the child process over IPC pipes.
These callbacks are specified by `handleConversion` object, and
during send two of them are invoked:

  * `send`
  * `postSend`

Now for `net.Socket` in particular, `postSend` performs clean up by
closing the actual uv handle. However this clean up will not happen in
one of the branches. This pull request aims to fix this.

PR-URL: https://github.com/nodejs/node/pull/4752
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
8 years agohttp: handle errors on idle sockets
José F. Romaniello [Thu, 31 Dec 2015 14:51:46 +0000 (11:51 -0300)]
http: handle errors on idle sockets

This change adds a new event handler to the `error` event of the socket
after it has been used by the http_client.

The purpose of this change is to catch errors on *keep alived*
connections from idle sockets that otherwise will cause an uncaugh error
event on the application.

Fix: #3595
PR-URL: https://github.com/nodejs/node/pull/4482
Reviewed-By: Fedor Indutny <fedor@indutny.com>
8 years agosrc: remove __builtin_bswap16 call
Ben Noordhuis [Tue, 15 Dec 2015 11:57:49 +0000 (12:57 +0100)]
src: remove __builtin_bswap16 call

Not supported by apple-gcc and I'm not convinced it's worth adding more
preprocessor hacks when it should be easy as pie for the compiler to
to optimize the byteswap.  If it doesn't, fix the compiler.

Fixes: https://github.com/nodejs/node/issues/4284
PR-URL: https://github.com/nodejs/node/pull/4290
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
8 years agosrc: remove unused BITS_PER_LONG macro
Ben Noordhuis [Tue, 15 Dec 2015 11:49:03 +0000 (12:49 +0100)]
src: remove unused BITS_PER_LONG macro

Remove the unused and broken BITS_PER_LONG macro.  Broken because x64
is the only 64 bits architecture where it produces the right result.

PR-URL: https://github.com/nodejs/node/pull/4290
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
8 years agobenchmark: add a constant declaration for `net`
Minwoo Jung [Sat, 21 Nov 2015 06:52:53 +0000 (15:52 +0900)]
benchmark: add a constant declaration for `net`

Constant declaration for `net` is omitted in `idle_server.js`
Add a constant declaration for constant `net`

PR-URL: https://github.com/nodejs/node/pull/3950
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
8 years agolib: use arrow functions instead of bind
Minwoo Jung [Fri, 21 Aug 2015 21:30:08 +0000 (14:30 -0700)]
lib: use arrow functions instead of bind

use `arrow functions` instead of `bind(this)` in order to improve
performance through optimizations.

PR-URL: https://github.com/nodejs/node/pull/3622
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
8 years agosrc: add BE support to StringBytes::Encode()
Bryon Leung [Wed, 7 Oct 2015 17:47:57 +0000 (13:47 -0400)]
src: add BE support to StringBytes::Encode()

Versions of Node.js after v0.12 have relocated byte-swapping away from
the StringBytes::Encode function, thereby causing a nan test (which
accesses this function directly) to fail on big-endian machines.

This change re-introduces byte swapping in StringBytes::Encode,
done via a call to a function in util-inl. Another change in
NodeBuffer::StringSlice was necessary to avoid double byte swapping
in big-endian function calls to StringSlice.

PR-URL: https://github.com/nodejs/node/pull/3410
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
8 years agotls: add `options` argument to createSecurePair
Коренберг Марк [Tue, 5 May 2015 07:41:16 +0000 (12:41 +0500)]
tls: add `options` argument to createSecurePair

Helps in implementation of #6204, where some options passed to
`createSecurePair()` are ignored before this patch.

These options are very helpful if someone wants to pass
`options.servername` or `options.SNICallback` to securepair.

PR-URL: https://github.com/nodejs/node/pull/2441
Reviewed-By: Fedor Indutny <fedor@indutny.com>
8 years agolib,test: remove extra semicolons
Michaël Zasso [Fri, 15 Jan 2016 08:53:11 +0000 (09:53 +0100)]
lib,test: remove extra semicolons

PR-URL: https://github.com/nodejs/node/pull/2205
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
8 years agotools: enable no-extra-semi rule in eslint
Michaël Zasso [Fri, 15 Jan 2016 08:50:44 +0000 (09:50 +0100)]
tools: enable no-extra-semi rule in eslint

PR-URL: https://github.com/nodejs/node/pull/2205
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
8 years agodeps: upgrade to npm 2.14.17
Kat Marchán [Fri, 5 Feb 2016 22:14:47 +0000 (14:14 -0800)]
deps: upgrade to npm 2.14.17

PR-URL: https://github.com/nodejs/node/pull/5110
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Myles Borins <mborins@us.ibm.com>
8 years agotest: make npm tests work on prerelease node versions
Kat Marchán [Tue, 26 Jan 2016 21:45:04 +0000 (13:45 -0800)]
test: make npm tests work on prerelease node versions

PR-URL: https://github.com/nodejs/node/pull/4960
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>