0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
Commit Graph

124 Commits

Author SHA1 Message Date
Teddy Katz
b1b1978ec5
tools: add additional ESLint rules
PR-URL: https://github.com/nodejs/node/pull/8643
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@keybase.io>
2016-09-20 23:21:10 -04:00
Adri Van Houdt
d4bf5cac43 process: changed var to const in internal/process/promises
PR-URL: https://github.com/nodejs/node/pull/8620
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jackson Tian <shvyo1987@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-09-20 16:55:28 -07:00
Adri Van Houdt
41a66bc73a lib: changed var to const in bootstrap_node.js
PR-URL: https://github.com/nodejs/node/pull/8588
Reviewed-By: Yosuke Furukawa <yosuke.furukawa@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2016-09-20 11:01:52 -07:00
Fedor Indutny
15d72c8365 tickprocessor: apply c++filt manually on mac
`/bin/sh -c` trick wasn't working for several reasons:

* `/bin/sh -c "..."` expects the first argument after `"..."` to be a
  `$0`, not a `$1`. Previously `-n` wasn't passed to `nm` because of
  this, and many symbols were ordered improperly
* `c++filt` was applied not only to the names of the functions but to
  their `nm` prefixes like `t` and `a` (`t xxx` turns into
  `unsigned char xxx`).

Instead of applying `c++filt` wide and using `sh -c`, execute `nm` as
requested by `deps/v8/tools/tickprocessor.js` and apply `c++filt` to all
matching entries manually.

Included test demonstrates where previous approach failed: all builtins
were merged into `v8::internal::Builtins::~Builtins`, because they were
prefixed by `t` in `nm` output.

PR-URL: https://github.com/nodejs/node/pull/8480
Reviewed-By: Matthew Loring <mattloring@google.com>
2016-09-13 12:47:20 +02:00
Rich Trott
a6b1f175c2 tools: fix new-parens violations
PR-URL: https://github.com/nodejs/node/pull/8478
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-09-12 21:11:35 -07:00
James M Snell
7b73f55902 internal/util: remove printDeprecationWarning
Removes the internal/util printDeprecationWarning method

PR-URL: https://github.com/nodejs/node/pull/8166
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
2016-09-02 13:15:56 -07:00
James M Snell
15eaba98a1 lib: use emitWarning instead of printDeprecationMessage
The process.emitWarning() API should be used for printing
deprecation warning messages rather than directly using the
internal/util#printDeprecationMessage

PR-URL: https://github.com/nodejs/node/pull/8166
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
2016-09-02 13:15:22 -07:00
James M Snell
bf91035364 process: fix handling of process.noDeprecation in emitWarning
PR-URL: https://github.com/nodejs/node/pull/8166
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
2016-09-02 13:15:17 -07:00
James M Snell
dc7277909b fs: move SyncWriteStream to internal/fs
Move the implementation of SyncWriteStream to internal/fs.

PR-URL: https://github.com/nodejs/node/pull/6749
Reviewed-By: Ron Korving <ron@ronkorving.nl>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
2016-09-02 10:22:00 -07:00
James M Snell
07dbf7313d promise: hard deprecation for unhandled promise rejection
PR-URL: https://github.com/nodejs/node/pull/8217
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2016-08-29 16:27:58 -07:00
Benjamin Gruenbaum
ecf474ceba promise: warn on unhandled rejections
Log unhandled promise rejections with a guid and emit
a process warning. When rejection is eventually handled,
emit a secondary warning.

PR-URL: https://github.com/nodejs/node/pull/8217
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2016-08-29 16:27:38 -07:00
Anna Henningsen
59714cb7b3
util: allow symbol-based custom inspection methods
Add a `util.inspect.custom` Symbol which can be used to customize
`util.inspect()` output. Providing `obj[util.inspect.custom]`
works like providing `obj.inspect`, except that the former allows
avoiding name clashes with other `inspect()` methods.

Fixes: https://github.com/nodejs/node/issues/8071
PR-URL: https://github.com/nodejs/node/pull/8174
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
2016-08-25 07:13:00 +02:00
cjihrig
ccbb3c78cd child_process: reuse existing no-op function
The internal/child_process module has an existing no-op
function. This commit utilizes that function, instead of
creating extraneous closures.

PR-URL: https://github.com/nodejs/node/pull/8164
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Claudio Rodriguez <cjrodr@yahoo.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2016-08-20 16:24:44 -04:00
Santiago Gimeno
db6253f94a child_process: workaround fd passing issue on OS X
There's an issue on some `OS X` versions when passing fd's between processes.
When the handle associated to a specific file descriptor is closed by the sender
process before it's received in the destination, the handle is indeed closed
while it should remain opened. In order to fix this behaviour, don't close the
handle until the `NODE_HANDLE_ACK` is received by the sender.
Added `test-child-process-pass-fd` that is basically `test-cluster-net-send` but
creating lots of workers, so the issue reproduces on `OS X` consistently.

Fixes: https://github.com/nodejs/node/issues/7512
PR-URL: https://github.com/nodejs/node/pull/7572
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-08-20 10:58:28 +02:00
Bryan English
249bb8da2f util: fix deprecated class prototype
Ensure the wrapped class prototype is exactly the unwrapped class
prototype, rather than an object whose prototype is the unwrapped
class prototype.

This ensures that instances of the unwrapped class are instances
of the wrapped class. This is useful when both a wrapped class and
a factory for the unwrapped class are both exposed.

Ref: https://github.com/nodejs/node/pull/8103
PR-URL: https://github.com/nodejs/node/pull/8105
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-08-17 18:27:22 -07:00
Prince J Wesley
4b883a3fb4
readline: keypress trigger for escape character
Fixes: https://github.com/nodejs/node/issues/7379
PR-URL: https://github.com/nodejs/node/pull/7382
Reviewed-By: jasnell - James M Snell <jasnell@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
2016-08-17 23:44:39 +05:30
Aleksei Koziatinskii
f6070a1a02 deps: v8_inspector: console support
When node is running with --inspect flag, default console.log,
console.warn and other methods call inspector console methods in
addition to current behaviour (dump formatted message to stderr and
stdout). Inspector console methods forward message to DevTools and
show up in DevTools Console with DevTools formatters. Inspector
console methods not present on Node console will be added into it.

Only own methods on global.console object will be changed while in a
debugging session. User are still able to redefine it, use
console.Console or change original methods on Console.prototype.

PR-URL: https://github.com/nodejs/node/pull/7988
Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: jasnell - James M Snell <jasnell@gmail.com>
Reviewed-By: ofrobots - Ali Ijaz Sheikh <ofrobots@google.com>
2016-08-11 17:40:42 -07:00
cjihrig
2d4a521d58 repl: don't override all internal repl defaults
The createInternalRepl() module accepts an options object as an
argument. However, if one is provided, it overrides all of the
default options. This commit applies the options object to the
defaults, only changing the values that are explicitly set.

PR-URL: https://github.com/nodejs/node/pull/7826
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-08-08 11:03:18 -04:00
Pat Pannuto
a804db1af7
process: save original argv[0]
For historical and other reasons, node overwrites `argv[0]` on startup.
See
 - 2c6f79c08,
 - https://github.com/nodejs/node/issues/7434
 - https://github.com/nodejs/node/pull/7449
 - https://github.com/nodejs/node/pull/7696

For cases where it may be useful, save the original value of `argv[0]`
in `process.argv0`

PR-URL: https://github.com/nodejs/node/pull/7696
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-08-08 16:33:57 +02:00
vladimir
320f433dcd util: support classes in util.deprecate()
Classes cannot be instantiated without new, but util.deprecate()
uses Function.prototype.apply(). This commit uses new.target to
detect constructor calls, allowing classes to be deprecated.

PR-URL: https://github.com/nodejs/node/pull/7690
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-08-04 11:44:40 -04:00
cjihrig
2cc01da7f0 repl: default useGlobal to true
This is a partial revert of
15157c3c3d. This change lead to a
regression that broke require() in the CLI REPL, as imported
files were evaluated in a different context.

Refs: https://github.com/nodejs/node/pull/5703
Fixes: https://github.com/nodejs/node/issues/7788
PR-URL: https://github.com/nodejs/node/pull/7795
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Minwoo Jung <jmwsoft@gmail.com>
2016-07-21 10:33:30 -04:00
Lance Ball
15157c3c3d repl: Default useGlobal to false in CLI REPL.
Documentation for REPL states that the default value of `useGlobal` is
`false`. It makes no distinction between a REPL that is created
programmatically, and the one a user is dropped into on the command line
by executing `node` with no arguments. This change ensures that the CLI
REPL uses a default value of `false`.

Fixes: https://github.com/nodejs/node/issues/5659
Ref: https://github.com/nodejs/node/issues/6802
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
PR-URL: https://github.com/nodejs/node/pull/5703
2016-06-30 12:45:45 -04:00
Andras
6f75b6672c timers: optimize setImmediate()
Save the setImmediate() callback arguments into an array instead of a
closure, and invoke the callback on the arguments from an optimizable
function.

  60% faster setImmediate with 0 args (15% if self-recursive)
  4x faster setImmediate with 1-3 args, 2x with > 3
  seems to be faster with less memory pressure when memory is tight

Changes:
- use L.create() to build faster lists
- use runCallback() from within tryOnImmediate()
- save the arguments and do not build closures for the callbacks

PR-URL: https://github.com/nodejs/node/pull/6436
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2016-06-29 11:02:25 +02:00
Andras
6b0f86a8d5 timers: optimize linkedlist
Now uses a new L.create() factory to create access-optimized linkedlist
objects.

PR-URL: https://github.com/nodejs/node/pull/6436
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2016-06-29 11:02:25 +02:00
James M Snell
6be73feaeb crypto,tls: perf improvements for crypto and tls getCiphers
Improve performance of crypto.getCiphers, getHashes, getCurves
and tls.getCiphers by consolidating filterDuplicates logic, adding
caching of output, and streamlining filterDuplicates implementation.

Benchmarks:

crypto.getCiphers n=1    v6.2.1 = 2559.3, new = 15890 ...... -83.89%
crypto.getCiphers n=5000 v6.2.1 = 3516.3, new = 24203000 ... -99.99%

tls.getCiphers    n=1    v6.2.1 = 3405.3, new = 14877 ...... -77.11%
tls.getCiphers    n=5000 v6.2.1 = 6074.4, new = 24202000 ... -99.97%

PR-URL: https://github.com/nodejs/node/pull/7225
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
2016-06-21 10:03:08 -07:00
James M Snell
6dd093da26 buffer,string_decoder: consolidate encoding validation logic
Buffer.isEncoding and string_decoder.normalizeEncoding shared
quite a bit of logic. This moves the primary logic into
internal/util. The userland modules that monkey patch Buffer.isEncoding
should still work.

PR-URL: https://github.com/nodejs/node/pull/7207
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2016-06-21 09:28:38 -07:00
Anna Henningsen
6a93ab11a9
repl: break on sigint/ctrl+c
Adds the ability to stop execution of the current REPL command
when receiving SIGINT. This applies only to the default eval
function.

Fixes: https://github.com/nodejs/node/issues/6612
PR-URL: https://github.com/nodejs/node/pull/6635
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-06-18 20:44:25 +02:00
Brian White
686984696d
stream: improve Readable.read() performance
read() performance is improved most by switching from an array to
a linked list for storing buffered data. However, other changes that
also contribute include: making some hot functions inlinable, faster
read() argument checking, and misc code rearrangement to avoid
unnecessary code execution.

PR-URL: https://github.com/nodejs/node/pull/7077
Reviewed-By: Calvin Metcalf <calvin.metcalf@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2016-06-14 15:15:34 -04:00
Trevor Norris
54cc7212df buffer: introduce latin1 encoding term
When node began using the OneByte API (f150d56) it also switched to
officially supporting ISO-8859-1. Though at the time no new encoding
string was introduced.

Introduce the new encoding string 'latin1' to be more explicit. The
previous 'binary' and documented as an alias to 'latin1'.  While many
tests have switched to use 'latin1', there are still plenty that do both
'binary' and 'latin1' checks side-by-side to ensure there is no
regression.

PR-URL: https://github.com/nodejs/node/pull/7111
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-06-07 13:51:14 -06:00
Rich Trott
1a21524b69 debugger: fix --debug-brk interaction with -e
The command line flag `--debug-brk` was ignored when the `-e` flag was
also present. This change allows the flags to both be honored when they
are used in a single command line.

PR-URL: https://github.com/nodejs/node/pull/7089
Fixes: https://github.com/nodejs/node/issues/3589
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-06-03 21:40:30 -07:00
Ben Noordhuis
334ef4f19d lib,src: drop dependency on v8::Private::ForApi()
Said function requires that a v8::Context has been entered first,
introducing a chicken-and-egg problem when creating the first context.

PR-URL: https://github.com/nodejs/node/pull/7082
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2016-06-01 09:29:49 +02:00
Pavel Feldman
84ad31fff3 src,lib: v8-inspector support
This change introduces experimental v8-inspector support. This brings
the DevTools debug protocol allowing Node.js to be debugged with
Chrome DevTools native, or through other debuggers supporting that
protocol.

Partial WebSocket support, to the extent required by DevTools, is
included. This is derived from the implementation in Blink.

v8-inspector support can be disabled by the --without-inspector
configure flag.

PR-URL: https://github.com/nodejs/node/pull/6792
Reviewed-By: jasnell - James M Snell <jasnell@gmail.com>
Reviewed-By: addaleax - Anna Henningsen <anna@addaleax.net>
Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl>
2016-05-30 09:05:46 -07:00
cjihrig
62b544290a process: remove deprecated process.EventEmitter
process.EventEmitter was deprecated for v6. This commit removes
it for v7.

Refs: https://github.com/nodejs/node/pull/5049
PR-URL: https://github.com/nodejs/node/pull/6862
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-05-24 12:45:30 -04:00
cjihrig
d59917b2a3 child_process: emit IPC messages on next tick
Currently, if an IPC event handler throws an error, it can
cause the message to not be consumed, leading to messages piling
up. This commit causes IPC events to be emitted on the next tick,
allowing the channel's processing logic to move forward as
normal.

Fixes: https://github.com/nodejs/node/issues/6561
PR-URL: https://github.com/nodejs/node/pull/6909
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2016-05-24 12:20:57 -04:00
Anna Henningsen
dab09877b0
module: don't cache uninitialized builtins
Don't cache the exported values of fully uninitialized builtins.
This works by adding an additional `loading` flag that is only
active during initial loading of an internal module and checking
that either the module is fully loaded or is in that state before
using its cached value.

This has the effect that builtins modules which could not be loaded
(e.g. because compilation failed due to missing stack space) can be
loaded at a later point.

Fixes: https://github.com/nodejs/node/issues/6899
PR-URL: https://github.com/nodejs/node/pull/6907
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-05-24 17:03:22 +02:00
James M Snell
dcccbfdc79 src: refactor require('constants')
The require('constants') module is currently undocumented and mashes
together unrelated constants. This refactors the require('constants')
in favor of distinct os.constants, fs.constants, and crypto.constants
that are specific to the modules for which they are relevant. The
next step is to document those within the specific modules.

PR-URL: https://github.com/nodejs/node/pull/6534
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Robert Lindstaedt <robert.lindstaedt@gmail.com>
2016-05-17 11:05:18 -07:00
James M Snell
f856234ffa process: internal/process/stdio.js cleanup / modernization
Avoid using deprecated getter syntax plus other
miscellaneous updates.

PR-URL: https://github.com/nodejs/node/pull/6766
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-05-17 10:45:20 -07:00
James M Snell
f293d0b0c8 lib: replace legacy uses of __defineGetter__
Minor clean up. There are still some places in core that use
the legacy __defineGetter__ syntax. This updates most of those.

PR-URL: https://github.com/nodejs/node/pull/6768
Reviewed-By: Rich Trott <rtrott@gmail.com>
2016-05-16 17:01:34 -07:00
Anna Henningsen
a4564f3649
util: adhere to noDeprecation set at runtime
Until now, the docs stated that `process.noDeprecation` could be set
at runtime, but before any modules were loaded. That was not true,
because `lib/internal/util.js` was loaded during the process startup
process, so setting the flag at runtime was pointless.

Minimal test case:

    process.noDeprecation = true;
    process.EventEmitter;

This patch moves checking `process.noDeprecation` to the place where
it was actually used.

PR-URL: https://github.com/nodejs/node/pull/6683
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-05-13 21:33:42 +02:00
Rich Trott
a56da51a38 benchmark,test,lib: remove extra spaces
In preparation for stricter linting, remove extra spaces.

PR-URL: https://github.com/nodejs/node/pull/6645
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Roman Reiss <me@silverwind.io>
2016-05-11 23:18:16 -07:00
Ali Ijaz Sheikh
4d4cfb27ca src,lib: minor --debug-brk cleanup
Minor cleanup of how --debug-brk works:
* We no longer need to use command line flags to expose the debug
  object.
* Do not depend on the existence of global.v8debug as a mechanism to
  determine if --debug-brk was specified.
* We no longer need to set a dummy listener with --debug-brk.

PR-URL: https://github.com/nodejs/node/pull/6599
Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: cjihrig - Colin Ihrig <cjihrig@gmail.com>
2016-05-07 05:23:47 +02:00
Steven R. Loomis
cd752e8463
intl: Don't crash if v8BreakIterator not available
If the undocumented v8BreakIterator does not have data available,
monkeypatch it to throw an error instead of crashing.

Fixes: https://github.com/nodejs/node/issues/3111
PR-URL: https://github.com/nodejs/node/pull/4253
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-05-04 15:02:25 -07:00
Rich Trott
1027b9447e lib,test: update in preparation for linter update
ESLint 2.9.0 fixes some bugs that resulted in minor issues not being
caught by ESLint 2.7.0. Update instances of our code that will be
flagged when we upgrade to ESLint 2.9.0.

PR-URL: https://github.com/nodejs/node/pull/6498
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
2016-05-04 10:24:47 -07:00
Carl Lei
b72d048a74
repl: create history file with mode 0600
Set the mode bits on the history file to 0o600 instead of leaving it
unspecified, which resulted in 0o755 on Unices.

Test code mostly written by Trott:
https://github.com/nodejs/node/issues/3392#issuecomment-148634126.

PR-URL: https://github.com/nodejs/node/pull/3394
Fixes: https://github.com/nodejs/node/issues/3392
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-05-04 19:06:02 +02:00
Patrick Mueller
52cb410402 process: add process.cpuUsage() - implementation, doc, tests
Add process.cpuUsage() method that returns the user and system
CPU time usage of the current process

PR-URL: https://github.com/nodejs/node/pull/6157
Reviewed-By: Robert Lindstaedt <robert.lindstaedt@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2016-04-29 16:07:06 -07:00
Dirceu Pereira Tiegs
02ac302b6d net: Validate port in createServer().listen()
Make sure we validate the port number in all kinds of `listen()` calls.

Fixes: https://github.com/nodejs/node/issues/5727
PR-URL: https://github.com/nodejs/node/pull/5732
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-04-20 15:41:18 -07:00
Rich Trott
4bbd41864a tools: enable linting for v8_prof_processor.js
`lib/internal/v8_prof_processor.js` was being excluded from linting, but
the only lint issue it has is that it cannot run in strict mode. Disable
the `strict` rule with a comment and remove the file from
`.eslintignore`.

PR-URL: https://github.com/nodejs/node/pull/6262
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Roman Klauke <romaaan.git@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-04-20 08:33:59 -07:00
Anna Henningsen
ebc8c37f70 repl: keep the built-in modules non-enumerable
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>
2016-04-18 15:31:51 -07:00
Anna Henningsen
39d905e293 node: make builtin libs available for --eval
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>
2016-04-18 15:31:32 -07:00
Rich Trott
b7f4b1ba4c process: fix incorrect usage of assert.fail()
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>
2016-04-18 09:55:41 -07:00