0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-29 15:06:33 +01:00
Commit Graph

16952 Commits

Author SHA1 Message Date
Daiki Arai
e9f2ec4e1e doc: fix the timing of setImmediate's execution
About setImmediate, the execution timing is after timers currently.

PR-URL: https://github.com/nodejs/node/pull/12034
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2017-04-04 10:38:50 -07:00
Daiki Arai
08442621a2 doc: fix fs.read arg type
About fs.read's 2nd argument, string is invalid.

PR-URL: https://github.com/nodejs/node/pull/12034
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2017-04-04 10:38:44 -07:00
Luigi Pinca
8d386ed7e1 events: do not keep arrays with a single listener
Use the remaining listener directly if the array of listeners has only
one element after running `EventEmitter.prototype.removeListener()`.

Advantages:

- Better memory usage and better performance if no new listeners are
  added for the same event.

Disadvantages:

- A new array must be created if new listeners are added for the same
  event.

PR-URL: https://github.com/nodejs/node/pull/12043
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Reviewed-By: Ron Korving <ron@ronkorving.nl>
2017-04-04 10:36:39 -07:00
Rich Trott
f637703b86 tools: replace custom ESLint timers rule
ESLint 3.19.0 allows the specification of selectors that represent
disallowed syntax. Replace our custom rule for timer arguments with a
pair of `no-restricted-syntax` option objects.

PR-URL: https://github.com/nodejs/node/pull/12162
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2017-04-04 10:24:15 -07:00
Rich Trott
316665235c tools: update ESLint to 3.19.0
PR-URL: https://github.com/nodejs/node/pull/12162
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2017-04-04 10:24:10 -07:00
Daniel Bevenius
5ccaba49f0 test: add variable arguments support for Argv
At the moment Argv only supports three arguments which fulfilled my
requirements when working on #9163.

This commit adds support for a variable number of arguments. There is
also a no-args constructor that is the equivalent to running "node -p
process.version" which is hopefully alright as a default.

PR-URL: https://github.com/nodejs/node/pull/12166
Ref: https://github.com/nodejs/node/pull/9163
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-04-04 10:20:59 -07:00
JR McEntee
503342daf0 doc: update Mac OS X references in releases.md
This commit updates 3 additional references to Mac OS X in
releases.md to macOS.

PR-URL: https://github.com/nodejs/node/pull/12106
Fixes: https://github.com/nodejs/node/issues/12086
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-04-04 10:14:40 -07:00
JR McEntee
6ebc806a47 doc: correct markdown file line lengths
This commit updates two paragraphs that exceeded the 80 line standard
after updating to macOS.

PR-URL: https://github.com/nodejs/node/pull/12106
Fixes: https://github.com/nodejs/node/issues/12086
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-04-04 10:14:32 -07:00
JR McEntee
7a5d07c7fb doc: change Mac OS X to macOS
This update changes references to "Mac OS X", "OS X", and "OSX" in
markdown files to "macOS".

PR-URL: https://github.com/nodejs/node/pull/12106
Fixes: https://github.com/nodejs/node/issues/12086
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-04-04 10:14:24 -07:00
Brian White
84a23391f6 linkedlist: remove public module
PR-URL: https://github.com/nodejs/node/pull/12113
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2017-04-04 10:05:04 -07:00
Raphael Okon
e1161a3718 doc: add notes to http.get options
Extra notes that options doesn't include the prototype when copied

Fixes: https://github.com/nodejs/node/issues/12092
PR-URL: https://github.com/nodejs/node/pull/12124
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2017-04-04 09:57:37 -07:00
Timothy Gu
c4469c49ec url: error when domainTo*() is called w/o argument
PR-URL: https://github.com/nodejs/node/pull/12134
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-04-04 09:51:44 -07:00
Refael Ackermann
f6ddbaff8a test: performance, remove Popen(shell=True) on Win
not needed according to official python docs -
https://docs.python.org/2/library/subprocess.html#index-2

PR-URL: https://github.com/nodejs/node/pull/12138
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Nikolai Vavilov <vvnicholas@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-04-04 09:48:12 -07:00
Alexey Orlenko
e77a83f5a5 buffer: optimize decoding wrapped base64 data
The fast base64 decoder used to switch to the slow one permanently when
it saw a whitespace or other garbage character.  Since the most common
situation such characters may be encountered in is line-wrapped base64
data, a more profitable strategy is to decode a single 24-bit group with
the slow decoder and then continue running the fast algorithm.

PR-URL: https://github.com/nodejs/node/pull/12146
Ref: https://github.com/nodejs/node/issues/12114
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-04-04 09:42:44 -07:00
Rich Trott
1e6186e902 buffer,util: refactor for performance
internal/util.js definied toInteger() and toLength() but they were only
used by buffer.js. Inlining these small functions results in a small but
statistically-significant performance gain.

PR-URL: https://github.com/nodejs/node/pull/12153
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-04-04 09:39:09 -07:00
DavidCai
dc7d9eb0a9 test: increase querystring coverage
PR-URL: https://github.com/nodejs/node/pull/12163
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2017-04-04 09:28:36 -07:00
Vse Mozhet Byt
b2ac3b60b2 doc: fix and update examples in http.md
* replace `var` by `const` in http.md
* replace `let` by `const` in http.md
* fix spaces in code examples of http.md
* replace console.log() by .error() in http.md
* make arrow function clearer in http.md
* use object destructuring in http.md
* update output examples in http.md

PR-URL: https://github.com/nodejs/node/pull/12169
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2017-04-04 09:20:40 -07:00
Vse Mozhet Byt
74dc3bfe08 benchmark: replace [].join() with ''.repeat()
Also add a benchmark to compare both ways to create strings.

PR-URL: https://github.com/nodejs/node/pull/12170
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-04-04 09:19:18 -07:00
Teddy Katz
9348f31c2a
test: fix test-cli-syntax assertions on windows
The test introduced in a5f91ab230
accidentally introduced failures on some windows builds. Update the
assertion that was causing the failures.

PR-URL: https://github.com/nodejs/node/pull/12212
Ref: https://github.com/nodejs/node/pull/11689
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2017-04-04 12:12:16 -04:00
Zero King
c79b081367 doc: fix typo in CHANGELOG_V6.md
PR-URL: https://github.com/nodejs/node/pull/12206
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-04-04 19:04:00 +03:00
Santiago Gimeno
45c4ad58e5
test: fix flaky test-child-process-exec-timeout
At least starting with Darwin Kernel Version 16.4.0, sending a SIGTERM
to a process that is still starting up kills it with SIGKILL instead of
SIGTERM.

PR-URL: https://github.com/nodejs/node/pull/12159
Refs: https://github.com/libuv/libuv/issues/1226
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-04-04 15:02:35 +02:00
Myles Borins
f7a31180ad
2017-04-04, Version 4.8.2 'Argon' (Maintenance)
This is a maintenance release to fix a memory leak that was
introduced in 4.8.1.

It also includes an upgrade to zlib 1.2.11 to fix a number of low
severity CVEs that were present in zlib 1.2.8.

http://seclists.org/oss-sec/2016/q4/602

Notable changes:

* crypto:
  - fix memory leak if certificate is revoked (Tom Atkinson)
    https://github.com/nodejs/node/pull/12089
* deps:
  - upgrade zlib to 1.2.11 (Sam Roberts)
    https://github.com/nodejs/node/pull/10980
2017-04-04 14:40:28 +02:00
Myles Borins
28f8b17ffb
2017-04-04, Version 6.10.2 'Boron' (LTS)
This is a special LTS to fix a number of regressions that were found
on the 6.10.x release line.

This includes:

 * a fix for memory leak in the crypto module that
   was introduced in 6.10.1
 * a fix for a regression introduced to the windows repl in 6.10.0
 * a backported fix for V8 to stop a segfault that could occur
   when using spread syntax

It also includes an upgrade to zlib 1.2.11 to fix a numberof low
severity CVEs that were present in zlib 1.2.8.

http://seclists.org/oss-sec/2016/q4/602

Notable changes

* crypto:
  - fix memory leak if certificate is revoked (Tom Atkinson)
    https://github.com/nodejs/node/pull/12089
* deps:
  - upgrade zlib to 1.2.11 (Sam Roberts)
    https://github.com/nodejs/node/pull/10980
  - backport V8 fixes for spread syntax regression causing segfaults
    (Michaël Zasso) https://github.com/nodejs/node/pull/12037
* repl:
  - Revert commit that broke REPL display on Windows (Myles Borins)
    https://github.com/nodejs/node/pull/12123
2017-04-04 14:23:35 +02:00
Gibson Fahnestock
d19809a3c5
build: avoid passing kill empty input in Makefile
Using `xargs -r` on some platforms and `xargs` on others doesn't work,
we can't guarantee whether xargs is GNU or not. Avoid the issue by only
running kill if there are processes to clean.

PR-URL: https://github.com/nodejs/node/pull/12158
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-04-04 10:44:53 +01:00
Gibson Fahnestock
57b850e975
build: use $(RM) in Makefile for consistency
Also allows someone to reassign `$RM`, e.g. with `RM=rm -v` instead of
`rm -f` (the default) should they want to. We're currently using a
mixture of `$(RM)` and `rm -f`.

There are a couple of places which aren't doing -f, have them do it for
consistency.

PR-URL: https://github.com/nodejs/node/pull/12157
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
2017-04-04 10:33:34 +01:00
Gibson Fahnestock
2d2970e3cb
doc, inspector: note that the host is optional
Document that `node --inspect=${port}` is also a viable option.

PR-URL: https://github.com/nodejs/node/pull/12149
Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-04-04 10:26:00 +01:00
Sakthipriyan Vairamani (thefourtheye)
d51f4f31be
test: reduce buffer size in buffer-creation test
This test is allocating much more memory than necessary to actually
reproduce the original problem. Lowering the amount of memory allocated
increases performance at least in some cases and makes this test less
likely to time out on SmartOS.

PR-URL: https://github.com/nodejs/node/pull/11177
Ref: https://github.com/nodejs/node/issues/10166

Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Julien Gilli <jgilli@nodejs.org>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2017-04-04 13:10:51 +05:30
Sakthipriyan Vairamani (thefourtheye)
ba0e3ac53d
doc: minor improvements in BUILDING.md
1. necessarily reliably => necessarily reliable
2. projects root directory => project's root directory
3. remove `console` highlighting, as `test` alone is highlighted
4. fix broken link for Android NDK
5. highlight the directory location `/usr/local/ssl/fips-2.0`
6. update expected output to an example for `process.versions.openssl` as the
   version displayed is not mentioned in the document

PR-URL: https://github.com/nodejs/node/pull/11963

Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
2017-04-04 13:08:12 +05:30
Sakthipriyan Vairamani (thefourtheye)
d75fdd96aa
child_process: improve killSignal validations
As it is, the `killSignal` is just retrieved from an object and used.
If the signal passed is actually one of the inherited properties of
that object, Node.js will die. For example,

    ➜  node -e "child_process.spawnSync('ls', {killSignal: 'toString'})"
    Assertion failed: (0), function uv_close, file ....core.c, line 166.
    [1]    58938 abort      node -e "child_process.spawnSync(...)"

1. This patch makes sure that the signal is actually a own property of
   the constants object.

2. Extends the killSignal validation to all the other functions.

PR-URL: https://github.com/nodejs/node/pull/10423

Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2017-04-04 13:02:51 +05:30
Teddy Katz
a5f91ab230
src: throw when -c and -e are used simultaneously
The -c flag ("check script syntax") and -e flag ("evaluate given code")
have contradictory meanings. Make them mutually exclusive by throwing
when both of them are provided.

Fixes: https://github.com/nodejs/node/issues/11680
PR-URL: https://github.com/nodejs/node/pull/11689
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
2017-04-03 22:07:45 -04:00
Teddy Katz
3209a8ebf3
lib: ensure --check flag works for piped-in code
Previously, the --check CLI flag had no effect when run on code piped
from stdin. This commit updates the bootstrap logic to handle the
--check flag the same way regardless of whether the code is piped from
stdin.

PR-URL: https://github.com/nodejs/node/pull/11689
Fixes: https://github.com/nodejs/node/issues/11680
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
2017-04-03 22:07:32 -04:00
Luca Maraschi
53828e8bff test: extended test to makeCallback cb type check
makeCallback and makeStatsCallback are both tested intedependently.

PR-URL: https://github.com/nodejs/node/pull/12140
Fixes: https://github.com/nodejs/node/issues/12136
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
2017-04-03 13:32:19 -04:00
James M Snell
7eb1b4658e buffer: zero fill Buffer(num) by default
PR-URL: https://github.com/nodejs/node/pull/12141
Ref: https://github.com/nodejs/CTC/issues/89
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
2017-04-03 09:57:24 -07:00
James M Snell
7b4a72d797 errors: add space between error name and code
`Error[CODE]` becomes `Error [CODE]`

PR-URL: https://github.com/nodejs/node/pull/12099
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Evan Lucas <evanlucas@me.com>
2017-04-03 09:48:40 -07:00
Anna Henningsen
9b05393362
test: fix V8 test on big-endian machines
Ref: https://github.com/nodejs/node/pull/12143#issuecomment-291131159
PR-URL: https://github.com/nodejs/node/pull/12186
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2017-04-03 15:15:08 +02:00
Daijiro Wachi
843b7e68ca test: synchronize WPT url setter test data
Updates:
+ Bring tests url-setter-tests from WPT, and put it as JavaScript
+ Comment out unpassed tests

Refs: https://github.com/w3c/web-platform-tests/pull/5112
Refs: https://github.com/nodejs/node/pull/11887
PR-URL: https://github.com/nodejs/node/pull/12058
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
2017-04-03 18:12:05 +09:00
Daijiro Wachi
50bfef66f0 test: synchronize WPT url test data
Refs: https://github.com/w3c/web-platform-tests/pull/4586
Refs: https://github.com/nodejs/node/pull/11887
PR-URL: https://github.com/nodejs/node/pull/12058
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
2017-04-03 18:11:58 +09:00
Daijiro Wachi
f8f46f9917 url: change path parsing for non-special URLs
This changes to the way path parsing for non-special URLs.
It allows paths to be empty for non-special URLs and also
takes that into account when serializing.

Fixes: https://github.com/nodejs/node/issues/11962
Refs: https://github.com/whatwg/url/pull/213
PR-URL: https://github.com/nodejs/node/pull/12058
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
2017-04-03 18:11:51 +09:00
Anna Henningsen
33a19b46ca v8: fix offsets for TypedArray deserialization
Fix the offset calculation for deserializing TypedArrays that are
not aligned in their original buffer.

Since `byteOffset` refers to the offset into the source `Buffer`
instance, not its underlying `ArrayBuffer`, that is what should
be passed to `buffer.copy`.

PR-URL: https://github.com/nodejs/node/pull/12143
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-04-03 10:38:10 +02:00
Jason Ginchereau
56e881d0b0
n-api: add support for abi stable module API
Add support for abi stable module API (N-API) as "Experimental feature".
The goal of this API is to provide a stable Node API for native
module developers. N-API aims to provide ABI compatibility guarantees
across different Node versions and also across different
Node VMs - allowing N-API enabled native modules to just work
across different versions and flavors of Node.js without recompilation.

A more detailed introduction is provided in:
https://github.com/nodejs/node-eps/blob/master/005-ABI-Stable-Module-API.md
and https://github.com/nodejs/abi-stable-node/blob/doc/VM%20Summit.pdf.

The feature, during its experimental state, will be guarded by a runtime
flag "--napi-modules". Only when this flag is added to the command line
will N-API modules along with regular non N-API modules be supported.

The API is defined by the methods in "src/node_api.h" and
"src/node_api_types.h". This is the best
starting point to review the API surface. More documentation will follow.

In addition to the implementation of the API using V8, which is included
in this PR, the API has also been validated against chakracore and that
port is available in
https://github.com/nodejs/abi-stable-node/tree/api-prototype-chakracore-8.x.

The current plan is to provide N-API support in versions 8.X and 6.X
directly. For older versions, such as 4.X or pre N-API versions of 6.X,
we plan to create an external npm module to provide a migration path
that will allow modules targeting older Node.js versions to use the API,
albeit without getting the advantage of not having to recompile.

In addition, we also plan an external npm package with C++ sugar to
simplify the use of the API. The sugar will be in-line only and will
only use the exported N-API methods but is not part of the N-API
itself. The current version is in:
https://github.com/nodejs/node-api.

This PR is a result of work in the abi-stable-node repo:
https://github.com/nodejs/abi-stable-node/tree/doc,
with this PR being the cumulative work on the api-prototype-8.x
branch with the following contributors in alphabetical order:

Author: Arunesh Chandra <arunesh.chandra@microsoft.com>
Author: Gabriel Schulhof <gabriel.schulhof@intel.com>
Author: Hitesh Kanwathirtha <hiteshk@microsoft.com>
Author: Ian Halliday <ianhall@microsoft.com>
Author: Jason Ginchereau <jasongin@microsoft.com>
Author: Michael Dawson <michael_dawson@ca.ibm.com>
Author: Sampson Gao <sampsong@ca.ibm.com>
Author: Taylor Woll <taylor.woll@microsoft.com>
PR-URL: https://github.com/nodejs/node/pull/11975
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-04-03 10:31:25 +02:00
Joseph Gentle
6481c93aef
assert: add support for Map and Set in deepEqual
assert.deepEqual and assert.deepStrictEqual currently return true for
any pair of Maps and Sets regardless of content. This patch adds
support in deepEqual and deepStrictEqual to verify the contents of Maps
and Sets.

Deeo equivalence checking is currently an
O(n^2) operation, and worse, it gets slower exponentially if maps
and sets were nested.

Note that this change breaks compatibility with previous versions of
deepEqual and deepStrictEqual if consumers were depending on all maps
and sets to be seen as equivalent. The old behaviour was never
documented, but nevertheless there are certainly some tests out there
which depend on it.

Support has stalled because the assert API was frozen, but was recently
unfrozen in CTC#63.

---

Later squashed in:

This change updates the checks for deep equality checking on Map and Set
to check all set values / all map keys to see if any of them match the
expected result.

This change is much slower, but based on the conversation in the pull
request its probably the right approach.

Fixes: https://github.com/nodejs/node/issues/2309
Refs: https://github.com/substack/tape/issues/342
Refs: https://github.com/nodejs/node/pull/2315
Refs: https://github.com/nodejs/CTC/issues/63
PR-URL: https://github.com/nodejs/node/pull/12142
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2017-04-03 10:15:53 +02:00
Anna Henningsen
3cc3e099be
util: show External values explicitly in inspect
Display `v8::External` values as `[External]` rather than `{}`
which makes them look like objects.

PR-URL: https://github.com/nodejs/node/pull/12151
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2017-04-03 10:08:26 +02:00
Timothy Gu
91383e47fd
zlib: support Uint8Array in convenience methods
Also support Uint8Array as a `dictionary` option.

PR-URL: https://github.com/nodejs/node/pull/12001
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2017-04-03 09:50:09 +02:00
Roman Reiss
2d039ffa29
doc: add logo to README
Adds a centered logo to the README to make it a little more festive. As
centering is not possible in pure Markdown, a bit of HTML is used.

PR-URL: https://github.com/nodejs/node/pull/12148
Ref: https://github.com/nodejs/node/issues/6920
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Italo A. Casas <me@italoacasas.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
2017-04-02 13:54:34 +02:00
Joyee Cheung
0ea45707a4 net: rename internal functions for readability
* Rename listen to listenInCluster
* Rename _listen2 to _setupListenHandle
* Remove _listen since it's a one-liner only used in one place
* Correct comments in server.listen

PR-URL: https://github.com/nodejs/node/pull/11796
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-04-02 01:38:24 +08:00
Tobias Nießen
0e710aada4
crypto: add sign/verify support for RSASSA-PSS
Adds support for the PSS padding scheme. Until now, the sign/verify
functions used the old EVP_Sign*/EVP_Verify* OpenSSL API, making it
impossible to change the padding scheme. Fixed by first computing the
message digest and then signing/verifying with a custom EVP_PKEY_CTX,
allowing us to specify options such as the padding scheme and the PSS
salt length.

Fixes: https://github.com/nodejs/node/issues/1127
PR-URL: https://github.com/nodejs/node/pull/11705
Reviewed-By: Shigeki Ohtsu <ohtsu@ohtsu.org>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2017-04-01 13:27:52 +02:00
Anna Henningsen
c68da89694
build: always use V8_ENABLE_CHECKS in debug mode
Define `V8_ENABLE_CHECKS` in `common.gypi` for the debug mode.
Without this, these checks would only be present in the object files
generated from the V8 build, and so for inline functions in v8.h
multiple different definitions could be generated, where one definition
includes the check and the other does not.

Refs: https://github.com/nodejs/node/pull/11975#discussion_r108005423
PR-URL: https://github.com/nodejs/node/pull/12029
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jason Ginchereau <jasongin@microsoft.com>
Reviewed-By: Hitesh Kanwathirtha <hiteshk@microsoft.com>
2017-03-31 22:12:57 +02:00
AnnaMag
241de510a8
vm: use SetterCallback to set func declarations
Currently, when in strict mode, function
declarations are copied on the sandbox by
CopyProperties(), which is not necessary
and will break when CP is removed.

This change maintains current behavior,
letting GlobalPropertySetterCallback
copy functions on the sandbox instead
of using CP to do the task.

PR-URL: https://github.com/nodejs/node/pull/12051
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2017-03-31 22:07:45 +02:00
Jeremiah Senkpiel
1b63fa1096
tty: remove NODE_TTY_UNSAFE_ASYNC
Nothing but trouble can ever come from it.

PR-URL: https://github.com/nodejs/node/pull/12057
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2017-03-31 22:02:25 +02:00
Nikolai Vavilov
7e0c3ab641 src: fix base64 decoding
Make sure trailing garbage is not treated as a valid base64 character.

Fixes: https://github.com/nodejs/node/issues/11987
PR-URL: https://github.com/nodejs/node/pull/11995
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2017-03-31 23:00:02 +03:00