An internal zlib error may cause _handle to be set to null.
Close now will check if there is a _handle prior to calling .close on
it.
PR-URL: https://github.com/nodejs/node/pull/5982
Fixes: https://github.com/nodejs/node/issues/6034
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit safely allows event names that are named the same as
properties that are ordinarily inherited from Object.prototype such
as __proto__.
Fixes: https://github.com/nodejs/node/issues/728
PR-URL: https://github.com/nodejs/node/pull/6092
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit safely allows querystring keys that are named the same as
properties that are ordinarily inherited from Object.prototype such
as __proto__. Additionally, this commit provides a bit of a speed
improvement (~25% in the querystring-parse 'manypairs' benchmark)
when there are many unique keys.
Fixes: https://github.com/nodejs/node/issues/5642
PR-URL: https://github.com/nodejs/node/pull/6055
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Enforce alignment/indentation on variable assignments that span multiple
lines.
PR-URL: https://github.com/nodejs/node/pull/6242
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: James M Snell <jasnell@gmail.com>
Correct alignment on variable assignments that span multiple lines in
preparation for lint rule to enforce such alignment.
PR-URL: https://github.com/nodejs/node/pull/6242
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: James M Snell <jasnell@gmail.com>
Special handling to detect when user has supplied a custom message.
Added a test for user message.
When testing if `actual` value is an error use
`util.isError` instead of `instanceof`.
Fixes: https://github.com/nodejs/node/issues/2385
PR-URL: https://github.com/nodejs/node/pull/2407
Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/6257
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Removes the options block from the http 'response' event and attaches
it to Agent#getName where it belongs. Removes socketPath and documents
localAddress option.
PR-URL: https://github.com/nodejs/node/pull/5993
Reviewed-By: James M Snell <jasnell@gmail.com>
calling digest or update on a hash object after digest has been called
now gives a topical error message instead of an error message saying that the
hash failed to initialize.
PR-URL: https://github.com/nodejs/node/pull/6042
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
* Modify tools/license-builder.sh to support ICU 57.1's plain text
license. (Separate issue to add ICU 57.1 in #6058)
* Update/regenerate LICENSE to include ICU 57.1's license
* Note that because the tool was rerun, the change in #6065 is already
included here.
PR-URL: https://github.com/nodejs/node/pull/6068
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: James M Snell <jasnell@gmail.com>
This is created by vs 2015 for user & machine-specific files and should
be ignored by git.
PR-URL: https://github.com/nodejs/node/pull/6070
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
These files are created by VS 2015 and should be ignored by git.
PR-URL: https://github.com/nodejs/node/pull/6070
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Provide an example for implementing browser like behavior for console.assert.
This "fixes" https://github.com/nodejs/node/issues/5340 by providing an
alternative to changing Node.js' implemented behavior. Instead, we
document the differences and show how to work around them if
browser like semantics are desired.
Fixes: https://github.com/nodejs/node/issues/5340
PR-URL: https://github.com/nodejs/node/pull/6169
Reviewed-By: Robert Jefe Lindstädt <robert.lindstaedt@gmail.com>
Reviewed-By: Jeff Harris <@techjeffharris>
Make sure that the built-in modules in the repl stay non-enumerable.
Previously, they would pop up as enumerable properties of the global
object after having been accessed for the first time.
PR-URL: https://github.com/nodejs/node/pull/6207
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Make the builtin libraries available for the `--eval` and
`--print` CLI options, using the same mechanism that the
REPL uses.
This renders workarounds like `node -e 'require("fs").doStuff()'`
unnecessary.
As part of this, the list of builtin modules and the code for
adding the corresponding properties to the target context is moved
to `internal/module.js`, and the previously missing `repl` entry
is added.
PR-URL: https://github.com/nodejs/node/pull/6207
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Clarify in docs for require.cache that reloading native modules
isn't supported.
Related: #6160
PR-URL: https://github.com/nodejs/node/pull/6168
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Moving the `message` event listener from the cluster object to each
worker object allows easier backporting of the recent jslint
changes since v5.x and older do not have v6.x's `worker` parameter
in the cluster object's `message` event.
PR-URL: https://github.com/nodejs/node/pull/6212
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Original commit message:
Improved diagnostic message for JS heap out of memory
This patch replaces the unused 'take_snapshot' parameter on
FatalProcessOutOfMemory() with a 'is_heap_oom' parameter.
The parameter is set to true on error paths where the
JS heap is out of memory, as distinct from a malloc()
failure i.e. process out of memory. The message output to
stderr or passed to embedding applications via FatalErrorCallback
is 'Javascript heap out of memory' rather than
'process out of memory'.
BUG=
R=jochen@chromium.org, verwaest@chromium.org, michael_dawson@ca.ibm.com
Review URL: https://codereview.chromium.org/1873443002
Cr-Commit-Position: refs/heads/master@{#35431}
We'd like this in 6.x to help with diagnosing customer problems.
It provides a better message on OOM so that it is easier to
be able to tell whether the OOM was due to heap exhaustion
or running out of native memory.
PR-URL: https://github.com/nodejs/node/pull/6218
Reviewed-By: Ben Noordhuis <ben@strongloop.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
The message argument for `assert.fail()` is the third argument, not the
first. Correct minor misuse in internal module.
PR-URL: https://github.com/nodejs/node/pull/6211
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
On Linux and OS X systems, `fs.watch()` resolves the watched path to an
inode. This clarifies that `fs.watch()` watches the inode and not the
path. If the inode of the path subsequently changes, `fs.watch()` will
continue watching the original inode and events for the path will no
longer be emitted. This is expected behavior.
Fixes: https://github.com/nodejs/node/issues/5039
PR-URL: https://github.com/nodejs/node/pull/6099
Reviewed-By: James M Snell <jasnell@gmail.com>
Run the debugger with `--port=common.PORT` to avoid the use of the same
port.
PR-URL: https://github.com/nodejs/node/pull/6246
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Some vm tests are not in strict mode because they need to create and use
global variables. By using `global.foo` instead of just `foo`, we can
still enable strict mode.
PR-URL: https://github.com/nodejs/node/pull/6209
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Minwoo Jung <jmwsoft@gmail.com>
Up to now, `Z_FINISH` was always the flushing flag that was used
for the last chunk of input data. This patch makes this choice
configurable so that advanced users can perform e.g. decompression of
partial data using `Z_SYNC_FLUSH`, if that suits their needs.
Add tests to make sure that an error is thrown upon encountering
invalid `flush` or `finishFlush` flags.
Fixes: https://github.com/nodejs/node/issues/5761
PR-URL: https://github.com/nodejs/node/pull/6069
Reviewed-By: James M Snell <jasnell@gmail.com>
Run tests in parallel if the environment variable JOBS
(which should contain a number of parallel jobs) is set.
PR-URL: https://github.com/nodejs/node/pull/6208
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Do to various reasons, outlined in the committed document, domains were
only in core for 2 years before being deprecated. This outline explains
why they received criticism from the community and never gained traction
with module authors.
Also included is an example script that accompanies the postmortem
analysis.
PR-URL: https://github.com/nodejs/node/pull/6159
Reviewed-By: Robert Lindstädt <robert.lindstaedt@gmail.com>
Reviewed-By: Kelvin Knighton <keltheceo@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
With the addition of `Buffer.allocUnsafeSlow(size)`
`SlowBuffer` can be deprecated... but docs-only for now.
PR-URL: https://github.com/nodejs/node/pull/5833
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Aligns the functionality of SlowBuffer with the new Buffer
constructor API. Next step is to docs-only deprecate
SlowBuffer.
Replace the internal uses of SlowBuffer with
`Buffer.allocUnsafeSlow(size)`
PR-URL: https://github.com/nodejs/node/pull/5833
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Remove realpath() and realpathSync() cache.
Use the native uv_fs_realpath() which is faster
then the JS implementation by a few orders of magnitude.
PR-URL: https://github.com/nodejs/node/pull/3594
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
This commit switches from the eslint command-line tool to a custom
tool that uses eslint programmatically in order to perform linting
in parallel and to display linting results incrementally instead of
buffering them until the end.
Fixes: https://github.com/nodejs/node/issues/5596
PR-URL: https://github.com/nodejs/node/pull/5638
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
The debugger tests in parallel fail with `make test` sometimes (all the
time?). This appears to be related to running in parallel, as it does
not fail with `make test-ci`, when run via `tools/test.py` or directly
from the command line with `./node
test/parallel/test-debugger-util-regression.js`.
A separate issue may be opened to find out why it is failing in
parallel, but for now, I think it's important to fix `make test`
promptly.
I suspect the issue is that the tests are relying on a default port
somewhere and so they are colliding when run in parallel. But that's
just a guess for the moment.
PR-URL: https://github.com/nodejs/node/pull/6205
Fixes: https://github.com/nodejs/node/issues/6201
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Though not a POSIX signal, SIGINFO is supported by BSD systems
(including Mac OS X) and is amongst the few signals that can be
triggered in a terminal via a simple key combination (CTRL-T).
On Linux, SIGINFO is an alias for SIGPWR; hence the defensive
conditionals in src/node.cc.
PR-URL: https://github.com/nodejs/node/pull/6093
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit improves module loading performance by at least ~25-35%
in the module-loader benchmarks.
Some optimization strategies include:
* Try-finally/try-catch isolation
* Replacing regular expressions with manual parsing
* Avoiding unnecessary string and array creation
* Avoiding constant recompilation of anonymous functions and
function definitions within functions
PR-URL: https://github.com/nodejs/node/pull/5172
Reviewed-By: James M Snell <jasnell@gmail.com>
V8 5.0 introduced a small modification for the unexpected end of input
error.
PR-URL: https://github.com/nodejs/node/pull/5945
Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: indutny - Fedor Indutny <fedor.indutny@gmail.com>