0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-30 07:27:22 +01:00
Commit Graph

20115 Commits

Author SHA1 Message Date
Luigi Pinca
97ba69f915 doc: add missing introduced_in comments
Add missing "introduced_in" comments for alternative version links.

PR-URL: https://github.com/nodejs/node/pull/16741
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
2017-11-19 18:10:05 +01:00
vladimir
51e0948862
domain: re-implement domain over async_hook
Domain core module has been re-implemented over async_hook.

PR-URL: https://github.com/nodejs/node/pull/16222
Reviewed-By: Andreas Madsen <amwebdk@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2017-11-19 17:39:19 +01:00
Franziska Hinkelmann
2d50b5e537
src: use unique_ptr for http2_state
PR-URL: https://github.com/nodejs/node/pull/17078
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2017-11-19 16:13:37 +01:00
Anna Henningsen
d61cd9d4fe
src: add missing include in node_platform.h
PR-URL: https://github.com/nodejs/node/pull/17133
Refs: https://github.com/nodejs/node/pull/17083
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
2017-11-19 14:20:43 +01:00
Rich Trott
5f720bebe7
test: reduce benchmark cases in test-benchmark-buffer
Specify `buffer=fast` so that we only run that and not that along with
`buffer=slow` in two benchmarks.

PR-URL: https://github.com/nodejs/node/pull/17111
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2017-11-19 12:33:06 +01:00
Franziska Hinkelmann
24e824ad68 src: use unique_ptr for scheduled delayed tasks
Use std::unique_ptr for delayed tasks in the scheduled
delayed tasks vector. This makes it clear that the vector
has ownership of the delayed tasks and is responsible for
deleting them.

Use a custom deleter for the pointers because libuv
needs to close the handle and then delete the data. Provide
the handle when creating the pointer instead of invoking the
special delete action everytime an element is removed from the vector.

PR-URL: https://github.com/nodejs/node/pull/17083
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2017-11-19 09:32:37 +01:00
Franziska Hinkelmann
f841fc63dd src: use std::unique_ptr in base-object-inl.h
Drive-by fix: delete superflouos nullptr in ptr.reset().

PR-URL: https://github.com/nodejs/node/pull/17079
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
2017-11-19 09:20:26 +01:00
Rich Trott
ce6c7f5b01
doc: change v8 to V8
Google's V8 engine is styled "V8" and not "v8". Most Node.js docs style
it correctly. This change fixes a few instances that are not styled
correctly.

PR-URL: https://github.com/nodejs/node/pull/17089
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2017-11-18 22:25:05 +01:00
Patrick Heneise
8f8999c1c0
test: fs.write() if 3rd argument is a callback, not offset
Easier way to resolve conflicts from #16822 and #16827.

PR-URL: https://github.com/nodejs/node/pull/17045
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2017-11-18 22:09:08 +01:00
Luigi Pinca
9531fcbb2e
doc: avoid mentioning 'uncaughtException'
Avoid suggesting using `'uncaughtException'` for emitted errors.

PR-URL: https://github.com/nodejs/node/pull/16905
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2017-11-18 21:07:06 +01:00
Vipin Menon
fe932a1204
stream: use arrow fns for 'this' in readable
PR-URL: https://github.com/nodejs/node/pull/16927
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2017-11-18 21:05:39 +01:00
Mathias Bynens
42bdb66bf2
deps: cherry-pick upstream ICU fix
ICU 60.1 has a bug resulting in incorrect Script_Extensions data
for 5 characters.
http://bugs.icu-project.org/trac/ticket/13462

Upstream patch:
http://bugs.icu-project.org/trac/changeset/40667

Refs: https://bugs.chromium.org/p/v8/issues/detail?id=4743#c54
PR-URL: https://github.com/nodejs/node/pull/16931
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Steven R Loomis <srloomis@us.ibm.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
2017-11-18 21:02:50 +01:00
Anna Henningsen
8854598b42
src: remove superfluous check in backtrace_posix.cc
The error check doesn't matter because a failure would be ignored
as part of the loop condition.

PR-URL: https://github.com/nodejs/node/pull/16950
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
2017-11-18 20:58:12 +01:00
Kevin Locke
662d803682
zlib: fix assert fail for bad write in object mode
add4b0ab8c introduced a regression from Node 8 to Node 9 by removing the
`ArrayBuffer.isView(chunk)` check in `Zlib.prototype._transform` without
properly forcing `opts.objectMode` to `false` in the constructor because
the change to `opts` occurs after `opts` has been passed to the
`Transform` constructor.  This commit fixes the issue by moving the call
to `Transform` after the changes to `opts`.

The regression can be demonstrated by running

    node -e 'require("zlib").Gunzip({objectMode: true}).write({})'

On Node 8 this correctly throws a `TypeError`:

    events.js:183
          throw er; // Unhandled 'error' event
          ^

    TypeError: invalid input
        at Gunzip._transform (zlib.js:367:15)
        at Gunzip.Transform._read (_stream_transform.js:186:10)
        at Gunzip.Transform._write (_stream_transform.js:174:12)
        at doWrite (_stream_writable.js:387:12)
        at writeOrBuffer (_stream_writable.js:373:5)
        at Gunzip.Writable.write (_stream_writable.js:290:11)
        at [eval]:1:44
        at ContextifyScript.Script.runInThisContext (vm.js:50:33)
        at Object.runInThisContext (vm.js:139:38)
        at Object.<anonymous> ([eval]-wrapper:6:22)

On Node 9 this causes an assertion failure:

    node[21732]: ../src/node_zlib.cc:179:static void node::{anonymous}::ZCtx::Write(const v8::FunctionCallbackInfo<v8::Value>&) [with bool async = true]: Assertion `Buffer::HasInstance(args[1])' failed.
     1: node::Abort() [node]
     2: node::Assert(char const* const (*) [4]) [node]
     3: 0x1250916 [node]
     4: v8::internal::FunctionCallbackArguments::Call(void (*)(v8::FunctionCallbackInfo<v8::Value> const&)) [node]
     5: 0xb7547c [node]
     6: v8::internal::Builtin_HandleApiCall(int, v8::internal::Object**, v8::internal::Isolate*) [node]
     7: 0x20c44b8842fd
    Aborted

Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
PR-URL: https://github.com/nodejs/node/pull/16960
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2017-11-18 20:55:57 +01:00
Daniel Bevenius
6c5a39c51f
build: minor corrections to configure descriptions
PR-URL: https://github.com/nodejs/node/pull/17094
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2017-11-18 20:55:04 +01:00
Witthawat Piwawatthanapanit
078eaa9f98
src: fix size of CounterSet
PR-URL: https://github.com/nodejs/node/pull/16984
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2017-11-18 20:53:38 +01:00
buji
71ee0d9a40
util: escaping object keys in util.inspect()
PR-URL: https://github.com/nodejs/node/pull/16986
Fixes: https://github.com/nodejs/node/issues/16979
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
2017-11-18 20:52:08 +01:00
sreepurnajasti
95d9a58cbc
test: utilize common.mustCall() on child exit
PR-URL: https://github.com/nodejs/node/pull/16996
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2017-11-18 20:49:36 +01:00
buji
6244070c48
buffer: don't predefine error
PR-URL: https://github.com/nodejs/node/pull/17021
Fixes: https://github.com/nodejs/node/issues/16994
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2017-11-18 20:44:56 +01:00
Refael Ackermann
66e2751e0a
tools: bump remark-cli to 4.0
PR-URL: https://github.com/nodejs/node/pull/17028
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
2017-11-18 20:44:17 +01:00
pimlie
adb7be2649
doc: add note about using cluster without networking
Although the primary use-case for the cluster module is networking, the
module provides a generic master/worker interface that could also be
used if you dont use networking at all. Currently the docs are a bit
ambiguous about this as only the primary use-case is ever mentioned,
this remark should clarify that the cluster module can also be used
without disadvantages if you dont use networking.

PR-URL: https://github.com/nodejs/node/pull/17031
Refs: https://github.com/nodejs/help/issues/970
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2017-11-18 20:42:04 +01:00
Anna Henningsen
01f853cde6
zlib: fix decompression of empty data streams
add4b0ab8c made the assumption that compressed data
would never lead to an empty decompressed stream.

Fix that by explicitly checking the number of read bytes.

PR-URL: https://github.com/nodejs/node/pull/17042
Fixes: https://github.com/nodejs/node/issues/17041
Refs: https://github.com/nodejs/node/pull/13322
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-11-18 20:40:27 +01:00
Joyee Cheung
c5b8e168b3
build: enforce order of dependency when building addons
PR-URL: https://github.com/nodejs/node/pull/17048
Fixes: https://github.com/nodejs/node/issues/17043
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2017-11-18 20:33:31 +01:00
Anatoli Papirovski
4b82d892ab
errors: consistent format for error message
Consistently use printf-style strings for error messages that
do not need a custom argument order or processing of arguments.

PR-URL: https://github.com/nodejs/node/pull/16904
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2017-11-18 20:27:40 +01:00
Sebastian Silbermann
2c0acc0bc1
doc: explicitly document highWaterMark option
PR-URL: https://github.com/nodejs/node/pull/17049
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2017-11-18 20:26:39 +01:00
Tobias Nießen
707cd3f615
test: use arrow functions instead of bind
PR-URL: https://github.com/nodejs/node/pull/17070
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Lance Ball <lball@redhat.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Khaidi Chu <i@2333.moe>
2017-11-18 17:31:46 +01:00
Vse Mozhet Byt
bbd95554c0 doc: fix a link in dgram.md
PR-URL: https://github.com/nodejs/node/pull/17107
Refs: https://en.wikipedia.org/w/index.php?title=IPv6_address&type=revision&diff=809494791&oldid=804196124
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2017-11-18 14:11:41 +02:00
Benjamin Zaslavsky
45e6642476
console: add support for console.debug
Adds the console.debug() method, alias for console.log(). This method is
exposed by V8 and was only available in inspector until now. Also adds
matching test and documentation.

PR-URL: https://github.com/nodejs/node/pull/17033
Refs: https://github.com/nodejs/node/pull/17004
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Khaidi Chu <i@2333.moe>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-11-18 12:38:59 +01:00
Joyee Cheung
0a1fba02a6
doc: reorganize collaborator guide
* Add sections about first time contributions, code reviews
  and seeking consensus, waiting for approvals, testing and CI
* Move paragraphs to more suitable sections
* Update table of contents
* Document the fast-tracking process

PR-URL: https://github.com/nodejs/node/pull/17056
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
2017-11-18 15:38:28 +08:00
Rich Trott
cfda245706 benchmark: use unique filenames in fs benchmarks
Use a unique file name for each benchmark. Running benchmarks
simultaneously may be a bit of an unusual use case, but there are use
cases, such as stress testing `test/parallel/test-benchmark-fs.js`.

PR-URL: https://github.com/nodejs/node/pull/16776
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-11-17 21:08:17 -08:00
Rich Trott
780c2d3917 test: move timing-sensitive test to sequential
test-https-server-keep-alive-timeout relies on server timeouts and
whatnot that will be inherently unreliable on a busy host. The test
fails when run with a high `-j` value and higher `--repeat` value passed
to `tools/test.py`. Move the test to `sequential`.

PR-URL: https://github.com/nodejs/node/pull/16775
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Khaidi Chu <i@2333.moe>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-11-17 21:04:53 -08:00
Rich Trott
02590b4cfa tools: fail tests if malformed status file
PR-URL: https://github.com/nodejs/node/pull/16703
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2017-11-17 20:56:34 -08:00
Anna Henningsen
ae558af7bc
timers: cross JS/C++ border less frequently
This removes the `process._needImmediateCallback` property
and its semantics of having a 1/0 switch that tells C++ whether
immediates are currently scheduled.

Instead, a counter keeping track of all immediates is created,
that can be increased on `setImmediate()` or decreased when an
immediate is run or cleared.

This is faster, because rather than reading/writing a C++ getter,
this operation can be performed as a direct memory read/write via
a typed array. The only C++ call that is left to make is
activating the native handles upon creation of the first
`Immediate` after the queue is empty.

One other (good!) side-effect is that `immediate._destroyed` now
reliably tells whether an `immediate` is still scheduled to run or not.

Also, as a nice extra, this should make it easier to implement
an internal variant of `setImmediate` for C++ that piggybacks
off the same mechanism, which should be useful at least for
async hooks and HTTP/2.

Benchmark results:

    $ ./node benchmark/compare.js --new ./node --old ./node-master-1b093cb93df0 --runs 10 --filter immediate timers | Rscript benchmark/compare.R
    [00:08:53|% 100| 4/4 files | 20/20 runs | 1/1 configs]: Done
                                                         improvement confidence      p.value
     timers/immediate.js type="breadth" thousands=2000      25.61 %         ** 1.432301e-03
     timers/immediate.js type="breadth1" thousands=2000      7.66 %            1.320233e-01
     timers/immediate.js type="breadth4" thousands=2000      4.61 %            5.669053e-01
     timers/immediate.js type="clear" thousands=2000       311.40 %        *** 3.896291e-07
     timers/immediate.js type="depth" thousands=2000        17.54 %         ** 9.755389e-03
     timers/immediate.js type="depth1" thousands=2000       17.09 %        *** 7.176229e-04
     timers/set-immediate-breadth-args.js millions=5        10.63 %          * 4.250034e-02
     timers/set-immediate-breadth.js millions=10            20.62 %        *** 9.150439e-07
     timers/set-immediate-depth-args.js millions=10         17.97 %        *** 6.819135e-10

PR-URL: https://github.com/nodejs/node/pull/17064
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2017-11-18 01:50:56 +01:00
Vse Mozhet Byt
ca3f9b7585 doc: delete unused definition in README.md
PR-URL: https://github.com/nodejs/node/pull/17108
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2017-11-18 00:56:19 +02:00
Rich Trott
6b6474d6c0 doc: add Support section in README
Add a Support section, borrowing heavily from wp-cli project.

Move stuff about contributing to Node.js to the bottom as vastly more
users are interested in using Node.js and getting help with Node.js than
contributing to Node.js. Information still belongs, just not at the top.
(Many people will know to look in CONTRIBUTING.md anyway.)

PR-URL: https://github.com/nodejs/node/pull/16533
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
2017-11-17 13:55:44 -08:00
Rich Trott
959c425a19 doc: make error descriptions more concise
Remove the practice of starting most error descriptions with "Used when"
or wordier variations.

Change errors of the form:

> Used when the type of an asynchronous resource is invalid.

...to:

> The type of an asynchronous resource was invalid.

Change errors of the form:

> The `'ERR_INVALID_CURSOR_POS'` is thrown specifically when a cursor on
> a given stream is attempted to move to a specified row without a
> specified column.

...to:

> A cursor on a given stream cannot be moved to a specified row without
> a specified column.

PR-URL: https://github.com/nodejs/node/pull/16954
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2017-11-17 09:57:00 -08:00
João Reis
d8debd8448 doc,win: clarify WSL support
Fixes: https://github.com/nodejs/node/issues/13471
PR-URL: https://github.com/nodejs/node/pull/17008
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Hitesh Kanwathirtha <hiteshk@microsoft.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2017-11-17 17:41:20 +00:00
Michael Dawson
9b4ab1452d doc: document common pattern for instanceof checks
PR-URL: https://github.com/nodejs/node/pull/16699
Fixes: https://github.com/nodejs/node/issues/13824
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2017-11-17 10:01:11 -05:00
Joyee Cheung
f24d9619ff
tools: try installing js-yaml only once
PR-URL: https://github.com/nodejs/node/pull/16661
Fixes: https://github.com/nodejs/node/issues/16650
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
2017-11-17 21:43:31 +08:00
Daniel Bevenius
b58a1cd70a src: rename req-wrap -> req_wrap
This commit renames req-wrap to req_wrap consitency with other
c++ source files.

PR-URL: https://github.com/nodejs/node/pull/17022
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
2017-11-17 12:49:20 +01:00
Daniel Bevenius
a515e593f3 src: rename base-object -> base_object
This commit renames base-object to base_object for consitency with other
c++ source files.

PR-URL: https://github.com/nodejs/node/pull/17022
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
2017-11-17 12:49:10 +01:00
Daniel Bevenius
78447666ea src: rename async-wrap -> async_wrap
This commit renames async-wrap to async_wrap for consitency with other
c++ source files.

PR-URL: https://github.com/nodejs/node/pull/17022
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
2017-11-17 12:49:00 +01:00
Vijayalakshmi Kannan
a0aff57c5a
lib: replace string concatenation with template
PR-URL: https://github.com/nodejs/node/pull/16923
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
2017-11-17 11:06:01 +01:00
Franziska Hinkelmann
0e1abb12e2 doc: mention smart pointers in Cpp style guide
Add rule for smart pointers, i.e., std::unique_ptr and std::shared_ptr,
to the Cpp style guide. Mostly copied from the Google style guide.

PR-URL: https://github.com/nodejs/node/pull/17055
Ref: https://github.com/nodejs/node/pull/16970
Ref: https://github.com/nodejs/node/pull/16974
Ref: https://github.com/nodejs/node/pull/17000
Ref: https://github.com/nodejs/node/pull/17012
Ref: https://github.com/nodejs/node/pull/17020
Ref: https://github.com/nodejs/node/pull/17030
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2017-11-17 10:47:31 +01:00
Franziska Hinkelmann
f96abea88e src: use smart pointer instead of new and delete
Use an std::unique_ptr for variables that are deleted
right after creation.

Since the destructor of InspectorTimer is private
but needed by the unique_ptr, define deleter_type as friend.

PR-URL: https://github.com/nodejs/node/pull/17020
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
2017-11-17 10:37:04 +01:00
Daniel Bevenius
c661dad086 build: fix cctest target --with-dtrace
Currently the cctest target will fail on linux when configured
--with-dtrace:

/node-v9.2.0/out/Release/obj.target/node/src/node_dtrace.o:
In function `node::DTRACE_NET_SERVER_CONNECTION(
    v8::FunctionCallbackInfo<v8::Value> const&)':
node_dtrace.cc:(.text+0x103): undefined reference to
`node_net__server__connection_semaphore'
/node-v9.2.0/out/Release/obj.target/node/src/node_dtrace.o:
In function `node::DTRACE_NET_STREAM_END(
    v8::FunctionCallbackInfo<v8::Value> const&)':
...

This is because node_dtrace_provider.o is not linked by the cctest
target.

This commit tries to fix and simplify the conditions in cctest target
so that node_dtrace.o is included for all operating systems that support
dtrace, include node_dtrace_ustack.o for all operating systems except
mac and linux, and include node_dtrace_provider.o for all operating
systems except mac.

PR-URL: https://github.com/nodejs/node/pull/17039
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2017-11-17 07:20:24 +01:00
Rich Trott
617e3e96e6 util: runtime deprecation for custom .inspect()
Change documentation-only deprecation for custom inspection using
`object.inspect` property to a runtime deprecation.

This is a breaking change. Custom inspection via `object.inspect` is
deprecated because there is a more robust Symbol-based alternative to
`.inspect` and the custom inspection via `object.inspect` feature means
that people can accidentally break `console.log()` simply by attaching a
`.inspect` property to their objects. Note that since this is a
deprecation, the custom inspection will still work. The breaking change
is simply the printing of a warning which could alarm users, break tests
or other things that might be dependent on specific output, etc.

PR-URL: https://github.com/nodejs/node/pull/16393
Ref: https://github.com/nodejs/node/issues/15549
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2017-11-16 22:00:39 -08:00
Rich Trott
07d39a2262 util: emit deprecation code only once
If another function has already emitted the deprecation warning with the
same code as the warning that is about to be emitted, do not emit the
warning.

This is a breaking change. Previously, different functions could emit
the same deprecation warning multiple times. This was a known bug rather
than a feature, but this change is being treated as a breaking change
out of caution. Identical deprecation warnings should not be emitted.

PR-URL: https://github.com/nodejs/node/pull/16393
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2017-11-16 22:00:24 -08:00
Rich Trott
ccc87ebb33 doc: improve documentation for util.deprecate()
Improve documentation for `util.deprecate()`. In particular, provide
complete function signature, document arguments, and document return
value.

PR-URL: https://github.com/nodejs/node/pull/16393
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2017-11-16 22:00:16 -08:00
Rich Trott
60698c2455 test: apply eslint exceptions narrowly
In test-util-inspect, apply ESLint exception for accessor-pairs rule
narrowly. It had been applied to nearly the whole file, but is only
needed for two lines.

PR-URL: https://github.com/nodejs/node/pull/16393
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2017-11-16 21:59:36 -08:00