Add files in test/addon to the `make cpplint` rule and fix up existing
style issues. Tests scraped from doc/api/addon.md are filtered out
because those are predominantly for illustrative purposes.
PR-URL: https://github.com/nodejs/node/pull/2427
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
The test no longer waits about 5 seconds between callback invocations.
It now writes to the tmp directory rather than the fixtures directory.
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/2393
Errors might be injected into OpenSSL's error stack
without the return value of `PEM_read_bio_PrivateKey` being set to
`nullptr`. See the test of `test_bad_rsa_privkey.pem` for an
example.
PR-URL: https://github.com/nodejs/node/pull/2342
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Currently, v8 native deps must be built in order to run the log
processor on node profiling output. These scripts use node instead
of d8 to remove this dependency.
This change was originally proposed to the v8 team but since the
changes are not v8 specific, we have moved the proposal here. See:
https://codereview.chromium.org/1179173009/
PR-URL: https://github.com/nodejs/node/pull/2090
Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
The exponent value was already in hex, but missing the 0x prefix which
could be confusing.
PR-URL: https://github.com/nodejs/io.js/pull/2320
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
v8 introduced the new flag `total_available_size` in version 4.4
and upwards. This flag is now available on `v8.getHeapStatistics`
with the name `total_available_size`. It contains the total
available heap size of v8.
Introduced with commit: v8/v8-git-mirror@0a1352a7
PR-URL: https://github.com/nodejs/io.js/pull/2348
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
According to docs, dropMembership() is automatically called
by the kernel when the socket is closed, and most apps will
never need to call it. It's called here as a sanity check
only so let's note that with a comment.
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
PR-URL: https://github.com/nodejs/io.js/pull/2062
Remove dead code paths that are created by assertions that will never
trigger. They may only trigger if either the `splitDeviceRe` or
`splitPathRe` regular expressions are modified. If at some point they
are modified, current unit tests will catch most of the resulting
errors and this commit adds extra tests to catch the remaining errors.
PR-URL: https://github.com/nodejs/io.js/pull/2282
Reviewed-By: Roman Reiss <me@silverwind.io>
This commit modifies util.inspect(obj) to additionally show the name of
the function that constructed the object. This often reveals useful
information about the object's prototype. In other words, instead of
> new Cls
{}
we have
> new Cls
Cls {}
This also works with exotic objects:
> class ArrayCls extends Array {}
> new ArrayCls(1, 2, 3)
ArrayCls [ 1, 2, 3 ]
The names of "trivial" constructors like Object and Array are not shown,
unless there is a mismatch between the object representation and the
prototype:
> Object.create([])
Array {}
This feature is inspired by browser devtools.
PR-URL: https://github.com/nodejs/io.js/pull/1935
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
When TLS Session Ticket is renewed by server - no Certificate record is
to the client. We are prepared for empty certificate in this case, but
this relies on the session reuse check, which was implemented
incorrectly and was returning false when the TLS Session Ticket was
renewed.
Use session reuse check provided by OpenSSL instead.
Fix: https://github.com/nodejs/io.js/issues/2304
PR-URL: https://github.com/nodejs/io.js/pull/2312
Reviewed-By: Shigeki Ohtsu <ohtsu@iij.ad.jp>
- eliminate unnecessary intermediate process ("parent")
- children exit if runner dies unexpectedly (killed on a test timeout,
for example)
- use explicit messaging from children to parents to indicate when
worker is ready to accept http requests, rather than racing to see
whether runner will make request before worker is listening
PR-URL: https://github.com/nodejs/io.js/pull/1944
Reviewed-By: Johan Bergstrom <bugs@bergstroem.nu>
Reviewed-By: Ben Noordhuis <ben@strongloop.com>
Any time the connection state or the underlying handle itself changes,
the socket's name (aka, local address) can change.
To deal with this we need to reset the cached sockname any time we
set or unset the internal handle or an existing handle establishes a
connection.
PR-URL: https://github.com/nodejs/io.js/pull/2095
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
simple tests test-http-request-end.js, test-http-default-encoding.js
hangs in AIX. The root cause for both the failures is related to the
timing with which packets are sent between the client and server.
On the client side, one factor that affects the timing is Nagle's
algorithm. With Nagle enabled there may be a delay between two packets
as the stack may wait until either:
a. An acknowledgement for the first packet is received, or
b. 200 ms elapses.
before sending the second packet.
Similarly at the server side 2 sequential packages can be delivered to
the application either together or separatly.
On AIX we see that they are delivered separately to the server, while on
Linux delivered together. If we change the timing, for example disabling
Nagle on AIX we see the 2 packets delivered together and the tests pass.
In the test case simple/test-http-request-end.js, the client request
handler of the server receives and stores the data in a data callback,
closes the server in a request end callback, and writes to the client
and ends the response, in-line with the request receipt. An HTTP parser
module parses the incoming message, and invokes callback routines which
are registered for HTTP events (such as header, body, end etc.)
Because the termination sequence arrive in a separate packet, there is a
delay in parsing that message and identify that the client request ended
(and thereby invoke the request end call backhandler). Due to this delay,
the response close happens first, which in-turn destroys the server
socket leading to the fd and watcher removal from the uv loop abandoning
further events on this connection, and end call back never being called,
causing the reported hang. simple/test-http-default-encoding.js suffers
from the same problem.
Also, remove the timer logic from the test case. Test harness anyways
contain a timer which controls the individual tests so remove such
controls from the test case, as suggested by @tjfontaine
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
PR-URL: https://github.com/joyent/node/pull/9432
PORT-FROM: joyent/node @ 13e1131406
PR-URL: https://github.com/nodejs/io.js/pull/2294
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
This commit fixes agent.getName(), which returned an extra colon
according to the docs, and adds tests (it was previously not unit
tested).
PR-URL: https://github.com/nodejs/io.js/pull/1617
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
If tab completion is not being used, allow user to enter tab
characters.
PR-URL: https://github.com/nodejs/io.js/pull/1761
Reviewed-By: Brendan Ashworth <brendan.ashworth@me.com>
The new implementation of Buffer missed the check for null/undefined as
the first argument to new Buffer(). Reintroduce the check and add test.
Fix: e8734c0 "buffer: implement Uint8Array backed Buffer"
Fix: https://github.com/nodejs/io.js/issues/2194
PR-URL: https://github.com/nodejs/io.js/pull/2195
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rod Vagg <rod@vagg.org>
Remove two tests that assume creating big buffers fails. The size limit
is twice as big on 64 bits architectures now and is going to be removed
completely in the not too distant future.
PR-URL: https://github.com/nodejs/io.js/pull/2022
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Fix a strict mode violation that made the test fail to run. It appears
to be a regression that was introduced in commit f29762f ("test: enable
linting for tests") which I was the sole reviewer of, so mea culpa.
PR-URL: https://github.com/nodejs/io.js/pull/2022
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Upgrade the bundled V8 and update code in src/ and lib/ to the new API.
Notable backwards incompatible changes are the removal of the smalloc
module and dropped support for CESU-8 decoding. CESU-8 support can be
brought back if necessary by doing UTF-8 decoding ourselves.
This commit includes https://codereview.chromium.org/1192973004 to fix
a build error on python 2.6 systems. The original commit log follows:
Use optparse in js2c.py for python compatibility
Without this change, V8 won't build on RHEL/CentOS 6 because the
distro python is too old to know about the argparse module.
PR-URL: https://github.com/nodejs/io.js/pull/2022
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Starting in V8 v4.3 the maximum array index of a typed array is the same
as the largest Smi supported on a given architecture. To compensate for
these differences export kMaxLength from the buffer module with the
correct size for the given architecture.
PR-URL: https://github.com/nodejs/io.js/pull/2003
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
Currently, each cluster worker is assigned an ever increasing
--debug-port argument. A long running cluster application that
does not use the debugger can run into errors related to the
port range. This commit mitigates the problem by only setting
the debug port if the master is started with debug arguments, or
the user explicitly defines debug arguments for the worker. This
commit also adds a new debug port offset counter that is only
incremented when a worker is created that utilizes debugging.
Fixes: https://github.com/joyent/node/issues/8159
Refs: https://github.com/nodejs/io.js/pull/1524
PR-URL: https://github.com/nodejs/io.js/pull/1949
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Oleg Elifantiev <oleg@elifantiev.ru>
Fix Buffer.concat() so a copy is always returned regardless of the
number of buffers that were passed.
Previously if the array length was one then the same same buffer was
returned. This created a special case for the user where there was a
chance mutating the buffer returned by .concat() could mutate the buffer
passed in.
Also fixes an inconsistency when throwing if an array member was not a
Buffer instance. For example:
Buffer.concat([42]); // Returns 42
Buffer.concat([42, 1]); // Throws a TypeError
Now .concat() will always throw if an array member is not a Buffer
instance.
See: https://github.com/nodejs/io.js/issues/1891
PR-URL: https://github.com/nodejs/io.js/pull/1937
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
By using the new SetHandler API instead of SetNamedPropertyHandler, we can
intercept symbols now. This forces us to use Maybes and MaybeLocals more,
since this new API does not have a non-maybe variant.
Fixes: https://github.com/nodejs/io.js/issues/884
PR-URL: https://github.com/nodejs/io.js/pull/1773
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
New Buffer implementation allows greater than kMaxLength to be created.
So instead check if the passed value is a valid Smi.
PR-URL: https://github.com/nodejs/io.js/pull/1825
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
With V8 4.4 removing the external array data API currently used by
Buffer, the new implementation uses the Uint8Array to back Buffer.
Buffers now have a maximum size of Smi::kMaxLength, as defined by V8.
Which is ~2 GB on 64 bit and ~1 GB on 32 bit.
The flag --use-old-buffer allows using the old Buffer implementation.
This flag will be removed once V8 4.4 has landed.
The two JS Buffer implementations have been split into two files for
simplicity.
Use getter to return expected .parent/.offset values for backwards
compatibility.
PR-URL: https://github.com/nodejs/io.js/pull/1825
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
As per the discussion in
https://github.com/nodejs/io.js/pull/2093#discussion_r34343965, this
patch documents the behavior of calling fs.watchFile() with a path that
does not yet exist.
This patch also includes a test which checks if a file not present, the
callback is invoked at least once and if the file is created after
the callback is invoked, it will be invoked again with new stat
objects.
PR-URL: https://github.com/nodejs/io.js/pull/2169
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Brendan Ashworth <brendan.ashworth@me.com>
In REPL, if we evaluate the `RegExp` object's predefined properties,
and if they happen to have the same expression, for example,
> RegExp.$1
'RegExp.$1'
then doing `eval(RegExp.$1)` would evaluate `RegExp.$1` recursively and
eventually throw `RangeError: Maximum call stack size exceeded`.
This patch stores the old values of `RegExp`'s predefined proprties in
an array and restores them just before the current expression entered
by user is evaluated.
Fixes: https://github.com/nodejs/io.js/issues/597
PR-URL: https://github.com/nodejs/io.js/pull/2137
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
In my Ubuntu 14.04.2 LTS machine, it tries to resolve the name
'blah.blah' and it fails with ETIMEOUT instead of ENOTFOUND. This patch
changes the hostname to "...", an invalid name, so that it will fail
immediately.
PR-URL: https://github.com/nodejs/io.js/pull/2287
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Evan Lucas <evanlucas@me.com>
This is a followup of https://github.com/nodejs/io.js/pull/2109.
The tests which didn't make it in #2109, are included in this patch.
The skip messages are supposed to follow the format
1..0 # Skipped: [Actual reason why the test is skipped]
and the tests should be skipped with the return statement.
PR-URL: https://github.com/nodejs/io.js/pull/2290
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
In the tests, we use "process.platform === 'win32'" in some places.
This patch replaces them with the "common.isWindows" for consistency.
PR-URL: https://github.com/nodejs/io.js/pull/2269
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Add ref() and unref() stub methods to the faux handle in round-robin
mode. Fixes the following TypeError when calling `server.unref()` in
the worker:
net.js:1521
this._handle.unref();
^
TypeError: this._handle.unref is not a function
at Server.unref (net.js:1521:18)
No actual reference counting is implemented. It would effectively be
a no-op because the control channel would still keep the worker alive.
Fixes: https://github.com/nodejs/node/issues/73
PR-URL: https://github.com/nodejs/io.js/pull/2274
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
The tests were creating the temp fixture file in both the parent
and the child process, leading to interesting race conditions on
the slower buildbots.
Rod notes that the tests started failing after putting the build
directory on a NFS mount.
Fixes: https://github.com/nodejs/io.js/issues/2261
PR-URL: https://github.com/nodejs/io.js/pull/2265
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Rod Vagg <rod@vagg.org>
Record the start time so we can make the return value of Timer.now()
relative to it, increasing the chances that it fits in a tagged integer
instead of a heap-allocated double, at least for the first one or two
billion milliseconds.
PR-URL: https://github.com/nodejs/io.js/pull/2256
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Fixes regression introduced in af249fa8a1.
With connect being deferred to the next tick, Socket.destroy could be
called before connect. Socket.destroy sets _connecting to false which
would cause an assertion error.
Fixes: https://github.com/nodejs/io.js/issues/2250
PR-URL: https://github.com/nodejs/io.js/pull/2251
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
parallel/test-buffer called `Buffer.prototype.toString()` on a buffer
with uninitialized memory. Call `Buffer.prototype.fill()` on it first.
PR-URL: https://github.com/nodejs/io.js/pull/2193
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
In REPL, if we try to evaluate an empty line, we get `undefined`.
> process.version
'v2.3.4'
>
undefined
>
undefined
>
This patch prevents `undefined` from printing if the string is empty.
> process.version
'v2.3.5-pre'
>
>
>
PR-URL: https://github.com/nodejs/io.js/pull/2163
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
As it is, REPL doesn't honour the line continuation feature very well.
This patch
1. keeps track of the beginning of the string literals and if they
don't end or current line doesn't end with line continuation, then
error out.
2. monitors if the line continuation character is used without the
string literal and errors out if that happens.
PR-URL: https://github.com/nodejs/io.js/pull/2163
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
When an inherited property is used as a REPL keyword, the REPL crashes.
➜ Desktop iojs
> process.version
'v2.3.4'
> .toString
readline.js:913
stream[ESCAPE_DECODER].next(r[i]);
^
TypeError: Cannot read property 'call' of undefined
at REPLServer.parseREPLKeyword (repl.js:746:15)
at REPLServer.<anonymous> (repl.js:284:16)
at emitOne (events.js:77:13)
at REPLServer.emit (events.js:169:7)
at REPLServer.Interface._onLine (readline.js:210:10)
at REPLServer.Interface._line (readline.js:549:8)
at REPLServer.Interface._ttyWrite (readline.js:826:14)
at ReadStream.onkeypress (readline.js:105:10)
at emitTwo (events.js:87:13)
at ReadStream.emit (events.js:172:7)
➜ Desktop
This patch makes the internal `commands` object inherit from `null` so
that there will be no inherited properties.
> process.version
'v2.3.5-pre'
> .toString
Invalid REPL keyword
>
PR-URL: https://github.com/nodejs/io.js/pull/2163
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>