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

3483 Commits

Author SHA1 Message Date
Junliang Yan
4139f2a820 test: fix missing unistd.h on windows
PR-URL: https://github.com/nodejs/node/pull/3532
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-10-28 20:58:38 +01:00
Rich Trott
26e47efbca test: split independent tests into separate files
Move ENOENT related tests out of general fs.watch() test file and into
its own file. This may help diagnose
https://github.com/nodejs/node/issues/3541.

PR-URL: https://github.com/nodejs/node/pull/3548
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
2015-10-28 12:24:13 -07:00
Stefan Budeanu
c9e682d587 test: use port number from env in tls socket test
Tests normally use common.PORT to allow the user to select which port
number to listen on. Hardcoding the port number will cause parallel
instances of the test to fail.

PR-URL: https://github.com/nodejs/node/pull/3557
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
2015-10-28 12:03:33 +01:00
Sakthipriyan Vairamani
6cf19103b6 repl: handle comments properly
As it is, the comments are not handled properly in REPL. So, if the
comments have `'` or `"`, then they are treated as incomplete string
literals and the error is thrown in REPL.

This patch refactors the existing logic and groups everything in a
class.

Fixes: https://github.com/nodejs/node/issues/3421
PR-URL: https://github.com/nodejs/node/pull/3515
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2015-10-28 07:32:07 +05:30
Sakthipriyan Vairamani
aaf9b488e2 lib,test: update let to const where applicable
As per the `prefer-const` eslint rule, few instances of `let` have been
identified to be better with `const`. This patch updates all those
instances.

Refer: https://github.com/nodejs/node/issues/3118
PR-URL: https://github.com/nodejs/node/pull/3152
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
2015-10-27 23:03:33 +05:30
Rich Trott
da21dba1a0 lib: fix cluster handle leak
It is possible to cause a resource leak in SharedHandle. This commit
fixes the leak.

Fixes: https://github.com/nodejs/node/issues/2510
PR-URL: https://github.com/nodejs/node/pull/3510
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-10-27 09:55:15 -07:00
Michaël Zasso
29da8cf8d7 util: make inherits work with classes
The current implementation overwrites the prototype of the target
constructor. It is not allowed with ES2015 classes because the prototype
property is read only. Use Object.setPrototypeOf instead.

Fixes: https://github.com/nodejs/node/issues/3452
PR-URL: https://github.com/nodejs/node/pull/3455
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2015-10-27 06:40:05 +01:00
Sakthipriyan Vairamani
437930c0cc http{s}: don't connect to localhost on invalid URL
If the URL passed to `http{s}.request` or `http{s}.get` is not properly
parsable by `url.parse`, we fall back to use `localhost` and port 80.
This creates confusing error messages like in this question
http://stackoverflow.com/q/32675907/1903116.

This patch throws an error message, if `url.parse` fails to parse the
URL properly.

Previous Discussion: https://github.com/nodejs/node/pull/2966
PR-URL: https://github.com/nodejs/node/pull/2967

Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2015-10-27 08:47:23 +05:30
Trevor Norris
3308e5ea2a buffer: fix value check for writeUInt{B,L}E
Fixes: https://github.com/nodejs/node/issues/3497
PR-URL: https://github.com/nodejs/node/pull/3500
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-10-26 14:57:35 -06:00
Shigeki Ohtsu
802a2e79e1 tls, crypto: add ALPN Support
ALPN is added to tls according to RFC7301, which supersedes NPN.
When the server receives both NPN and ALPN extensions from the client,
ALPN takes precedence over NPN and the server does not send NPN
extension to the client. alpnProtocol in TLSSocket always returns
false when no selected protocol exists by ALPN.
In https server, http/1.1 token is always set when no
options.ALPNProtocols exists.

PR-URL: https://github.com/nodejs/node/pull/2564
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-10-27 01:31:47 +09:00
Michaël Zasso
df738ac56c test: improve tests for util.inherits
inherits is used in lib and tests but its functionality itself is not
tested yet.

PR-URL: https://github.com/nodejs/node/pull/3507
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
2015-10-26 09:37:33 +01:00
Evan Lucas
57359cd1e4 fs: don't throw in read if buffer too big
If the resulting buffer.toString() call in fs.read throws, catch the
error and pass it back in the callback.

This issue only presents itself when fs.read is called using the legacy
string interface:

fs.read(fd, length, position, encoding, callback)

PR-URL: https://github.com/nodejs/node/pull/3503
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2015-10-25 21:24:12 -05:00
Junliang Yan
f4c0ed4af2 test: print helpful err msg on test-dns-ipv6.js
The test sometimes fail on an assertion but no useful error message
was generated for debugging. Modify the test to generate useful
debugging message.

PR-URL: https://github.com/nodejs/node/pull/3501
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2015-10-25 09:39:02 -07:00
Myles Borins
28e9a022df test: wrap assert.fail when passed to callback
Currently there are many instances where assert.fail is directly passed
to a callback for error handling. Unfortunately this will swallow the
error as it is the third argument of assert.fail that sets the message
not the first.

This commit adds a new function to test/common.js that simply wraps
assert.fail and calls it with the provided message.

Tip of the hat to @trott for pointing me in the direction of this.

PR-URL: https://github.com/nodejs/node/pull/3453
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2015-10-24 14:42:41 -07:00
Evan Lucas
b6207906c4 fs: pass err to callback if buffer is too big
In fs.readFile, if an encoding is specified and toString fails, do not
throw an error. Instead, pass the error to the callback.

Fixes: https://github.com/nodejs/node/issues/2767
PR-URL: https://github.com/nodejs/node/pull/3485
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2015-10-23 16:09:46 -05:00
Ben Noordhuis
594500f9f1 buffer: don't CHECK on zero-sized realloc
malloc(0) and realloc(ptr, 0) have implementation-defined behavior in
that the standard allows them to either return a unique pointer or a
nullptr for zero-sized allocation requests.  Normalize by always using
a nullptr.

Fixes: https://github.com/nodejs/node/issues/3496
PR-URL: https://github.com/nodejs/node/pull/3499
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2015-10-23 21:47:50 +02:00
Ben Noordhuis
3a091d29bf test: add node::MakeCallback() test coverage
PR-URL: https://github.com/nodejs/node/pull/3478
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2015-10-23 18:43:06 +02:00
Michael Dawson
5f3fb1c0a1 test: disable test-tick-processor - aix and be ppc
This test is already partially disabled for several platforms with
the comment that the required info is not provided at the C++ level.
I'm adding AIX as and PPC BE linux as they currently fall into
the same category.  We are working to see if we can change that
in v8 but it will be non-trivial if is possible at all so I don't
want to leave the CI with failing tests until that point.

PR-URL: https://github.com/nodejs/node/pull/3491
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2015-10-23 11:21:22 -04:00
Trevor Norris
494227bb03 node: improve GetActiveRequests performance
v8 is faster at setting object properties in JS than C++. Even when it
requires calling into JS from native code. Make
process._getActiveRequests() faster by doing this when populating the
array containing request objects.

Simple benchmark:

    for (let i = 0; i < 22; i++)
      fs.open(__filename, 'r', function() { });
    let t = process.hrtime();
    for (let i = 0; i < 1e6; i++)
      process._getActiveRequests();
    t = process.hrtime(t);
    console.log((t[0] * 1e9 + t[1]) / 1e6);

Results between the two:

    Previous:  4406 ns/op
    Patched:    690 ns/op     5.4x faster

PR-URL: https://github.com/nodejs/node/pull/3375
Reviewed-By: James Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <ben@strongloop.com>
2015-10-21 16:57:05 -06:00
Rich Trott
b354be7761 lib: avoid REPL exit on completion error
If a tab completion is attempted on an undefined reference inside of a
function, the REPL was exiting without reporting an error or anything
else. This change results in the REPL reporting the ReferenceError and
continuing.

Fixes: https://github.com/nodejs/node/issues/3346
PR-URL: https://github.com/nodejs/node/pull/3358
Reviewed-By: James M Snell <jasnell@gmail.com>
2015-10-21 15:30:49 -07:00
Michael Dawson
e9e837c64c test: harden test-child-process-fork-regr-gh-2847
test-child-process-fork-regr-gh-2847 could fail depending
on timing and how messages were packed into tcp packets.
If all of the requests fit into one packet then the test
worked otherwise, otherwise errors could occur.  This PR
modifies the test to be tolerant while still validating that
some of the connection can be made succesfully

Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/3459
2015-10-21 14:20:13 -07:00
Imran Iqbal
87d42b08ca test: fix test-net-keepalive for AIX
Fixed an intermittent issue on AIX where the 100ms timeout was reached
before the 'connection' event was fired. This resulted in a failure as
serverConnection would be undefined and the assert.equal would throw an
error. Changed the flow of the test so that the timeout is only set
after a connection has been made.

Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
PR-URL: https://github.com/nodejs/node/pull/3458
2015-10-21 12:43:04 -07:00
Rich Trott
d89bc7bc97 test: fix flaky test-child-process-emfile
Require the test setup to obtain an EMFILE error and not ENFILE as
ENFILE means there is a race condition with other processes that may
close files before `spawn()` is called by the test.

Fixes: https://github.com/nodejs/node/issues/2666
PR-URL: https://github.com/nodejs/node/pull/3430
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
2015-10-20 15:41:37 -07:00
Yuval Brik
adfd20b6fd tls: TLSSocket options default isServer false
Upon creating a TLSSocket object, set the default isServer option to false
Updated tls docs and added test-tls-socket-default-options

PR-URL: https://github.com/nodejs/node/pull/2614
Reviewed-By: Fedor Indutny <fedor@indutny.com>
2015-10-20 16:14:22 -04:00
Rich Trott
7cb89f515d test: remove flaky status from eval_messages test
This test has not failed on armv7-wheezy in over 6 weeks. Let's remove its
"flaky" status.

Fixes: https://github.com/nodejs/node/issues/2672
Reviewed-By: Rod Vagg <r@va.gg>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/3420
2015-10-20 12:16:00 -07:00
Junliang Yan
a1886cf1be test: skip test-dns-ipv6.js if ipv6 is unavailable
Test should be skipped if ipv6 is unavailable on the running system.

Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/3444
2015-10-20 12:07:22 -07:00
Fedor Indutny
3eecdf9f14 timers: reuse timer in setTimeout().unref()
Instead of creating new timer - reuse the timer from the freelist. This
won't make the freelist timer active for the duration of `uv_close()`,
and will let the event-loop exit properly.

Fix: #1264
PR-URL: https://github.com/nodejs/node/pull/3407
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2015-10-20 14:20:24 -04:00
Rich Trott
1c57845118 test: fix flaky test for symlinks
If the symlink portion of the test was being skipped due to a
combination of OS support and user privileges, then an assertion would
always fail. This fixes that problem, improves assertion error reporting
and splits the test to make it clear that it is a test for links and
symlinks.

Fixes: https://github.com/nodejs/node/issues/3311
PR-URL: https://github.com/nodejs/node/pull/3418
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
2015-10-20 09:20:21 -07:00
Jeremiah Senkpiel
5923dee07e test: repl-persistent-history is no longer flaky
The race conditions were fixed in
286ef1daca

PR-URL: https://github.com/nodejs/node/pull/3437
Reviewed By: Evan Lucas <evanlucas@me.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
2015-10-20 10:44:06 -04:00
Yuval Brik
0fc0902c21 zlib: decompression throw on truncated input
Check for unexpected end-of-file error when decompressing. If the output
buffer still has space after decompressing and deflate returned Z_OK or
Z_BUF_ERROR - that means unexpected end-of-file. Added
test-zlib-truncated.js for the case of truncated input. Fixed the zlib
dictionary test to not end the inflate stream on a truncated output (no
crc) of deflate

Fixes: https://github.com/nodejs/node/issues/2043
PR-URL: https://github.com/nodejs/node/pull/2595
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2015-10-19 15:06:05 -06:00
Wyatt Preul
8b4adb267b util: Remove p, has been deprecated for years
Update deprecation test to use another method.

Ref: https://github.com/nodejs/node/pull/2529
PR-URL: https://github.com/nodejs/node/pull/3432
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2015-10-19 20:52:56 +02:00
Jeremiah Senkpiel
73b7e052c0 repl: limit persistent history correctly on load
Previously the wrong end of the history was limited on load.

PR-URL: https://github.com/nodejs/node/pull/2356
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed By: Evan Lucas <evanlucas@me.com>
2015-10-19 11:53:54 -04:00
Jeremiah Senkpiel
286ef1daca test: cleanup, improve repl-persistent-history
- Now cleans up the history file unless told otherwise.
- Now also logs which test case failed.
- Waits for flush after repl close if necessary.

Fixes: https://github.com/nodejs/node/issues/2319
PR-URL: https://github.com/nodejs/node/pull/2356
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed By: Evan Lucas <evanlucas@me.com>
2015-10-19 11:53:54 -04:00
Коренберг Марк
d8db75730f tls: add options argument to createSecurePair
Helps in implementation of #6204, where some options passed to
`createSecurePair()` are ignored before this patch.

These options are very helpful if someone wants to pass
`options.servername` or `options.SNICallback` to securepair.

PR-URL: https://github.com/nodejs/node/pull/2441
Reviewed-By: Fedor Indutny <fedor@indutny.com>
2015-10-17 11:53:45 -04:00
Johannes Wüller
0803962860 fs: add file descriptor support to *File() funcs
These changes affect the following functions and their synchronous
counterparts:

 * fs.readFile()
 * fs.writeFile()
 * fs.appendFile()

If the first parameter is a uint32, it is treated as a file descriptor.
In all other cases, the original implementation is used to ensure
backwards compatibility. File descriptor ownership is never taken from
the user.

The documentation was adjusted to reflect these API changes. A note was
added to make the user aware of file descriptor ownership and the
conditions under which a file descriptor can be used by each of these
functions.

Tests were extended to test for file descriptor parameters under the
conditions noted in the relevant documentation.

PR-URL: https://github.com/nodejs/node/pull/3163
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2015-10-16 17:14:21 -06:00
Rich Trott
0f99320aa0 test: add Symbol test for assert.deepEqual()
The existing test never ran because typeof Symbol === 'function' and not
'symbol'. We have Symbols now so remove the check and just run the test.

PR-URL: https://github.com/nodejs/node/pull/3327
Reviewed-By: James M Snell <jasnell@gmail.com>
2015-10-16 14:31:59 -07:00
Michaël Zasso
419f7d4726 console: sub-millisecond accuracy for console.time
This makes the output of console.timeEnd in line with major browsers.

PR-URL: https://github.com/nodejs/node/pull/3166
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2015-10-16 21:00:51 +02:00
Jonas Dohse
642928b502 test: port domains regression test from v0.10
f2a45caf2e contained a test for a
regression that had been introduced by the original change that
77a10ed05f ported. While
77a10ed05f did not contain that
regression, the test that f2a45caf2e
contained should still be in the code base to prevent any regression
from happening in the future.

Original message for the commit that contained the test:

  domains: fix stack clearing after error handled

  caeb67735b introduced a regression where
  the domains stack would not be cleared after an error had been handled
  by the top-level domain.

  This change clears the domains stack regardless of the position of the
  active domain in the stack.

  PR: #9364
  PR-URL: https://github.com/joyent/node/pull/9364
  Reviewed-By: Trevor Norris <trev.norris@gmail.com>
  Reviewed-By: Julien Gilli <julien.gilli@joyent.com>

PR: #3356
PR-URL: https://github.com/nodejs/node/pull/3356
Reviewed-By: Ben Noordhuis <ben@strongloop.com>
2015-10-16 11:21:02 -07:00
Rich Trott
676e61872f test: apply correct assert.fail() arguments
The assert.fail function signature has the message as the third argument
but, understandably, it is often assumed that it is the first argument
(or at least the first argument if no other arguments are passed).

This corrects the assert.fail() invocations in the Node.js tests.

Before:
assert.fail('message');
// result: AssertionError: 'message' undefined undefined

After:
assert.fail(null, null, 'message');
// result: AssertionError: message

PR-URL: https://github.com/nodejs/node/pull/3378
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2015-10-16 00:31:04 -07:00
Shigeki Ohtsu
f72e178a78 tls: add minDHSize option to tls.connect()
Add a new option to specifiy a minimum size of an ephemeral DH
parameter to accept a tls connection. Default is 1024 bit.

PR-URL: https://github.com/nodejs/node/pull/1831
Reviewed-By: indutny - Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl>
2015-10-16 11:39:54 +09:00
Shigeki Ohtsu
6d92ebac11 tls: add TLSSocket.getEphemeralKeyInfo()
Returns an object representing a type, name and size of an ephemeral
key exchange in a client connection. Currently only DHE and ECHE are
supported.

This api only works on on a client connection. When it is called on a
server connection, null is returned. When its key exchange is not
ephemeral, an empty object is returned.

PR-URL: https://github.com/nodejs/node/pull/1831
Reviewed-By: indutny - Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl>
2015-10-16 11:39:45 +09:00
Michaël Zasso
bbdbef9274 test: fix tests after V8 upgrade
Some error messages have changed and the --debugger flag does
not exist in V8 anymore.

PR-URL: https://github.com/nodejs/node/pull/3351
Reviewed-By: indutny - Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl>
2015-10-14 11:20:35 -07:00
Myles Borins
6c032a8333 test: replace util with backtick strings
Now that we have backticks we no longer need to use util.format
to template strings!

This commit was inspired by #3324, and it replaces instances of
util.format with backtick strings in a number of tests

Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/3359
2015-10-14 10:02:47 -07:00
Fedor Indutny
ab03635fb1 http: fix stalled pipeline bug
This is a two-part fix:

- Fix pending data notification in `OutgoingMessage` to notify server
  about flushed data too
- Fix pause/resume behavior for the consumed socket. `resume` event is
  emitted on a next tick, and `socket._paused` can already be `true` at
  this time. Pause the socket again to avoid PAUSED error on parser.

Fix: https://github.com/nodejs/node/issues/3332
PR-URL: https://github.com/nodejs/node/pull/3342
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2015-10-14 12:16:18 -04:00
Julien Gilli
f45c315763 test: fix domain with abort-on-uncaught on PPC
Add SIGTRAP and the corresponding exit code to the list of signals/exit
codes that are expected when running tests that throw an uncaught error
and have --abort-on-uncaught-exception enabled.

Also refactor a bit related comments so that they better reflect what's
actually happening.

Fixes #3239.

PR: #3354
PR-URL: https://github.com/nodejs/node/pull/3354
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
2015-10-13 22:56:47 -07:00
Rich Trott
e3d9d25083 test: add test-child-process-emfile fail message
When the test fails (as it does frequently on FreeBSD unfortunately)
provide a non-cryptic error message that also provides a line number.

PR-URL: https://github.com/nodejs/node/pull/3335
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-10-13 18:27:47 -07:00
Rich Trott
6f14b3a7db test: remove util from common
util is loaded just for one use of util.format(). Replace it with a
string template. While we're at it, delete nearby lengthy comment
justifying use of fs.readFileSync().

PR-URL: https://github.com/nodejs/node/pull/3324
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed By: Evan Lucas <evanlucas@me.com>
2015-10-12 21:08:53 -07:00
Fedor Indutny
931118c9d7 buffer: fix assertion error in WeakCallback
`CallbackInfo` is now bound to `ArrayBuffer` instance, not `Uint8Array`,
therefore `SPREAD_ARG` will abort with:

    Assertion failed: ((object)->IsUint8Array())

Make changes necessary to migrate it to `ArrayBuffer`.

See: https://github.com/nodejs/node/pull/3080#issuecomment-147502167

Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/3329
2015-10-12 20:47:10 -07:00
Rich Trott
7d94611ac9 test: split up buffer tests for reliability
The Pi 1's in CI don't always fail on the buffer.toString() tests. But
they time out sometimes, so let's split the tests up so they don't.

PR-URL: https://github.com/nodejs/node/pull/3323
Reviewed By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed By: Trevor Norris <trev.norris@gmail.com>
2015-10-12 20:28:33 -07:00
Ryan Graham
bde32f8a4d lib: fix undefined timeout regression
63644dd1cd introduced a regression caused by everyone's favourite
JavaScript feature: undefined < 0 === undefined >= 0.

Add a case to the existing tests to cover this scenario and then add
the check for undefined that makes the test pass.

PR-URL: https://github.com/nodejs/node/pull/3331
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Reviewed By: Evan Lucas <evanlucas@me.com>
2015-10-12 19:25:14 -04:00