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

16043 Commits

Author SHA1 Message Date
Michael Dawson
26b8c2127d test: mark test-tty-wrap as flaky for AIX
We have had https://github.com/nodejs/node/issues/9728
open for a while but the frequency of the failures
seems to be such that we should mark it as flaky
while we continue to investigate.

PR-URL: https://github.com/nodejs/node/pull/10618
Reviewed-by: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-01-05 14:43:32 -05:00
Sakthipriyan Vairamani (thefourtheye)
2306acfd94 test: fix process.title expectation
`process.title` would work properly only in FreeBSD, OSX, and Linux as
per test/parallel/test-setproctitle.js.

This patch makes sure that the test expects an empty string in other
platforms.

This patch helps fix the SmartOS failures in
https://ci.nodejs.org/job/node-test-commit/6962/ for
https://github.com/nodejs/node/pull/10456

PR-URL: https://github.com/nodejs/node/pull/10597
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
2017-01-05 11:19:29 -08:00
Adrian Estrada
6830849b2e test: improve test-fs-null-bytes
* use const instead of var
* use common.mustCall to control functions execution
* use assert.strictEqual instead of assert.equal
* use arrow functions
* remove console.error

PR-URL: https://github.com/nodejs/node/pull/10521
Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2017-01-05 18:34:26 +01:00
cjihrig
7f69972cf0 test: refactor test-beforeexit-event-exit.js
PR-URL: https://github.com/nodejs/node/pull/10577
Reviewed-By: Italo A. Casas <me@italoacasas.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-01-05 12:03:55 -05:00
Brian White
0a937280d8
stream: avoid additional validation for Buffers
These changes result in ~50% improvement in the included benchmark.

PR-URL: https://github.com/nodejs/node/pull/10580
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-01-05 02:58:05 -05:00
Brian White
aab1dd6ff4
events: improve removeListener() performance
array.shift() seems to be faster than arrayClone() when the item
to remove is at the front (at least with V8 5.4).

PR-URL: https://github.com/nodejs/node/pull/10572
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
2017-01-05 02:53:18 -05:00
Brian White
7889416b8a
benchmark: keep decimals in results
Some benchmarks' results are small values, so keeping decimals when
running them manually (not comparing) can be helpful.

PR-URL: https://github.com/nodejs/node/pull/10559
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-01-05 02:48:07 -05:00
Brian White
f955c734ba
benchmark: improve readability of net benchmarks
PR-URL: https://github.com/nodejs/node/pull/10446
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-01-05 02:42:01 -05:00
Brian White
d43b14495c
benchmark: move punycode benchmark out of net
punycode/ICU is not specific to any particular module, so move it to
a more generic location.

PR-URL: https://github.com/nodejs/node/pull/10446
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-01-05 02:41:22 -05:00
Teddy Katz
26f2a6e87c
util: avoid out-of-bounds arguments index access
This updates util.inspect() to avoid accessing out-of-range indices of
the `arguments` object, which is known to cause optimization bailout.

Based on an average of 10 runs of the benchmark in
`benchmark/util/inspect.js`, this change improves the performance of
`util.inspect` by about 10%.

Relates to https://github.com/nodejs/node/issues/10323

PR-URL: https://github.com/nodejs/node/pull/10569
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Jackson Tian <shyvo1987@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-01-05 01:49:57 -05:00
Kai Cataldo
398229ac71 assert: update comments
Remove the numbers from the comments to make it clear that
assert does not follow the
[CJS spec](http://wiki.commonjs.org/wiki/Unit_Testing/1.0).
Additionally, clean up the existing comments for consistent
formatting/language and ease of reading.

PR-URL: https://github.com/nodejs/node/pull/10579
Fixes: https://github.com/nodejs/node/issues/9063
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
2017-01-04 11:07:34 -08:00
Evan Lucas
b8f6c1fff5 2017-01-04, Version 7.4.0 (Current)
Notable changes:

* buffer:
  - Improve performance of Buffer allocation by ~11% (Brian White) https://github.com/nodejs/node/pull/10443
  - Improve performance of Buffer.from() by ~50% (Brian White) https://github.com/nodejs/node/pull/10443
* events: Improve performance of EventEmitter.once() by ~27% (Brian White) https://github.com/nodejs/node/pull/10445
* fs: Allow passing Uint8Array to fs methods where Buffers are supported. (Anna Henningsen) https://github.com/nodejs/node/pull/10382
* http: Improve performance of http server by ~7% (Brian White) https://github.com/nodejs/node/pull/6533
* npm: Upgrade to v4.0.5 (Kat Marchán) https://github.com/nodejs/node/pull/10330

PR-URL: https://github.com/nodejs/node/pull/10589
2017-01-04 12:42:04 -06:00
Sakthipriyan Vairamani (thefourtheye)
26bf9545e0
Revert "test: test.py add option to use node in path"
This reverts commit 4198253a18.

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

Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-01-04 23:17:59 +05:30
Jan Krems
59a61a2ba7 doc: deprecate debug protocol
Due to changes in V8, the debug protocol will no longer work in Node.js
8.0.0. Note this in the documentation.

PR-URL: https://github.com/nodejs/node/pull/10320
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
2017-01-04 09:28:07 -08:00
Joyee Cheung
2826e6324c benchmark: allow benchmarks to specify flags
* Give createBenchmark and the Benchmark constructor
  a third argument for specifying the command line flags
  that this benchmark should be run with.
  The benchmarks are no longer run with --expose-internals
  by default, they will need to explicitly pass the flags.
* Rename options to configs in createBenchmark and the Benchmark
  constructor to match the documentation since they are not optional.
* Comment the properties of a Benchmark object

Also improve the documentation about creating benchmarks

* Add detailed description of the arguments of `createBenchmark`
* Describe the two passes of running the benchmarks
* Suggest what kind of code should go where in the benchmark example

PR-URL: https://github.com/nodejs/node/pull/10448
Reviewed-By: Andreas Madsen <amwebdk@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
2017-01-04 22:45:34 +08:00
Benedikt Meurer
f2f997ad1e events: optimize arrayClone by copying forward
Optimize arrayClone by copying forward.

It's slightly faster (and more readable) to copy array elements
in forward direction. This way it also avoids the ToBoolean and
the postfix count operation.

PR-URL: https://github.com/nodejs/node/pull/10571
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
2017-01-04 14:56:41 +01:00
George Adams
4198253a18 test: test.py add option to use node in path
This pr adds the ability to run `tools/test.py --path`. This means that
instead of defaulting to out/Release we can use the node version from
the path.

PR-URL: https://github.com/nodejs/node/pull/9674
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-01-04 12:18:50 +00:00
AnnaMag
c57caf5c69 doc: clarify the statement in vm.createContext()
PR-URL: https://github.com/nodejs/node/pull/10519
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
2017-01-04 10:35:56 +01:00
Joyee Cheung
f44f509da4 doc: add joyeecheung to collaborators
PR-URL: https://github.com/nodejs/node/pull/10603
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-01-04 14:11:36 +08:00
Myles Borins
b26a469211 2017-01-03, Version 4.7.1 'Argon' (LTS)
This LTS release comes with 180 commits. This includes 117 which are
test related, 34 which are doc related, 15 which are build / tool
related, and 1 commit which is an update to dependencies.

Notable Changes:

* build:
  - shared library support is now working for AIX builds
    (Stewart Addison) https://github.com/nodejs/node/pull/9675
* repl:
  - Passing options to the repl will no longer overwrite defaults
    (cjihrig) https://github.com/nodejs/node/pull/7826
* timers:
  - Re canceling a cancelled timers will no longer throw
    (Jeremiah Senkpiel) https://github.com/nodejs/node/pull/9685

PR-URL: https://github.com/nodejs/node/pull/10395
2017-01-03 19:10:36 -05:00
Myles Borins
2bf1c24f6a 2017-01-03, Version 6.9.3 'Boron' (LTS) Release
This LTS release comes with 312 commits. This includes 229 that are
test related, 62 that are docs related, 17 which are build / tools
related, and 4 commits which are updates to dependencies.

Notable Changes:

* build:
  - shared library support is now working for AIX builds
    (Stewart Addison) https://github.com/nodejs/node/pull/9675
* deps:
    - *npm*: upgrade npm to 3.10.10 (Rebecca Turner)
             https://github.com/nodejs/node/pull/9847
    - *V8*: Destructuring of arrow function arguments via computed
            property no longer throws (Michaël Zasso)
            https://github.com/nodejs/node/pull/10386)
* inspector:
  - /json/version returns object, not an object wrapped in an array
    (Ben Noordhuis) https://github.com/nodejs/node/pull/9762
* module:
  - using --debug-brk and --eval together now works as expected
    (Kelvin Jin) https://github.com/nodejs/node/pull/8876
* process:
  - improve performance of nextTick up to 20% (Evan Lucas)
    https://github.com/nodejs/node/pull/8932
* repl:
    - the division operator will no longer be accidentally parsed as
      regex (Teddy Katz) https://github.com/nodejs/node/pull/10103
    - improved support for generator functions (Teddy Katz)
      https://github.com/nodejs/node/pull/9852
* timers:
  - Re canceling a cancelled timers will no longer throw
    (Jeremiah Senkpiel) https://github.com/nodejs/node/pull/9685

PR-URL: https://github.com/nodejs/node/pull/10394
2017-01-03 18:55:26 -05:00
Josh Gavant
6ff3b03240 src, inspector: add --inspect-brk option
add an --inspect-brk option which breaks on
first line of user script. same behavior as old
--debug-brk flag.

PR-URL: https://github.com/nodejs/node/pull/8979
Reviewed-By: Eugene Ostroukhov <eostroukhov@chromium.org>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@keybase.io>
2017-01-03 15:47:40 -08:00
James M Snell
f5d92f3563 url: set toStringTag for the URL class
PR-URL: https://github.com/nodejs/node/pull/10562
Fixes: https://github.com/nodejs/node/issues/10554
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2017-01-03 15:33:03 -08:00
Sam Roberts
134481dbe9 doc: unify dirname and filename description
__dirname is path.dirname(__filename), but its docs, specifically the
attempt to describe javascript scope in terms of "running" and
"executing" had drifted apart. Rework to describe one as a variation of
the other, move the example, and just describe the names in terms of the
module, and it's local variables rather than the ill defined execution
concepts.

Fix: https://github.com/nodejs/node/issues/5525
PR-URL: https://github.com/nodejs/node/pull/10527
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
2017-01-03 13:39:32 -08:00
Myles Borins
6e2f8a421b doc: update TheAlphaNerd to MylesBorins
new year new alias

PR-URL: https://github.com/nodejs/node/pull/10586
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2017-01-03 10:47:18 -08:00
Joyee Cheung
2177a38178 url: TupleOrigin#toString use unicode by default
See: https://url.spec.whatwg.org/#dom-url-origin

Also moves the tests for origins to the parsing tests
since now URL#origin matches the test cases by default.

PR-URL: https://github.com/nodejs/node/pull/10552
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-01-03 10:37:15 -08:00
James M Snell
ac90d298d4 url: fix accidental filemode change
PR-URL: https://github.com/nodejs/node/pull/10549
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
2017-01-03 10:23:39 -08:00
Eugene Ostroukhov
3196faedab test: fix Coverity warning in inspector test
PR-URL: https://github.com/nodejs/node/pull/10510
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2017-01-03 10:09:00 -08:00
Beth Griggs
7c77932fa2 test: refactor several parallel/test-timer tests
Change var to const/let. Simplify test-timers-uncaught-exception.

PR-URL: https://github.com/nodejs/node/pull/10524
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2017-01-03 17:18:36 +00:00
Adrian Estrada
7a46b992d2 test: improve the code in test-fs-read-stream
* use const and let instead of var
* use assert.strictEqual instead of assert.equal
* use arrow functions

PR-URL: https://github.com/nodejs/node/pull/10556
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Italo A. Casas <me@italoacasas.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
2017-01-03 07:48:14 -05:00
Safia Abdalla
275362ae3b test: add tests for clearBuffer state machine
This checks to see that clearBuffer appropriately decrements the
correct values in _writableState when clearBuffer is invoked in
end.

Fixes: https://github.com/nodejs/node/issues/8687
PR-URL: https://github.com/nodejs/node/pull/9922
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Italo A. Casas <me@italoacasas.com>
2017-01-03 07:45:22 -05:00
BethGriggs
5a51955480 test: refactor test-timer-close
Refactor and simplify parallel/test-timer-close.js. Add comment to
describe the test case.

PR-URL: https://github.com/nodejs/node/pull/10517
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
2017-01-03 12:39:59 +00:00
David Goussev
e1fedfb6ae test: refactor test-stream2-readable-wrap.js
Use common.mustCall() where appropriate, var to const/let,
assert.equal() -> assert.strictEqual(), explicit time provided to
setTimeout()

PR-URL: https://github.com/nodejs/node/pull/10551
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
2017-01-02 22:03:43 -08:00
cjihrig
ff1efa6087 test: use const for all require() calls
PR-URL: https://github.com/nodejs/node/pull/10550
Reviewed-By: Rich Trott <rtrott@gmail.com>
2017-01-02 18:28:18 -05:00
William Kapke
1605a2e02a doc: redirect 'Start a Working Group' to TSC repo
PR-URL: https://github.com/nodejs/node/pull/9655
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
2017-01-02 12:47:14 -08:00
cjihrig
b978aff719 test: update test-cluster-shared-handle-bind-error
- Remove assignment of this to variable.
- Add common.mustCall() as needed.
- Move from var to const.

PR-URL: https://github.com/nodejs/node/pull/10547
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2017-01-02 10:08:29 -05:00
cjihrig
1d11b47aa7 test: avoid assigning this to variables
This commit removes assignments of this to a variable in the
tests.

PR-URL: https://github.com/nodejs/node/pull/10548
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2017-01-02 10:04:13 -05:00
cjihrig
6540fb9f1f test: s/ASSERT/assert/
This commit addresses an inconsistency with eight tests. These
tests use the assert module, but named the variable ASSERT. This
goes against the project's typical coding style, and negatively
impacts global find and replace updates.

PR-URL: https://github.com/nodejs/node/pull/10544
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Jackson Tian <shyvo1987@gmail.com>
Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2017-01-02 09:52:31 -05:00
cjihrig
746a46ebdd test: increase usage of assert.ifError()
PR-URL: https://github.com/nodejs/node/pull/10543
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2017-01-02 09:48:52 -05:00
Sakthipriyan Vairamani (thefourtheye)
152bd82de9
test: refactor test-debugger-remote
1. The test doesn't attach an event listener for `exit` events and
   removes them before killing. The intention is to fail the tests if
   the processes exit normally. This patch attaches the `exit` event
   handlers.

2. Replace `var`s with `let`s and `const`s.

3. Replace `==` based assertion with `strictEqual` assertion.

4. Use `common.PORT` instead of `5959`.

5. The test used to expect only one string "connecting to
   localhost:5959 ... ok", but the debugger actually emits another
   string, "break in test/fixtures/empty.js:2". This patch asserts if
   both of them are received in the same order.

Refer: https://github.com/nodejs/node/issues/10361
PR-URL: https://github.com/nodejs/node/pull/10455

Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2017-01-02 18:11:29 +05:30
Rich Trott
55f530159f test: refactor test-stream-unshift-read-race
* add RegExp as second argument to assert.throws()
* replace process.on('exit', ...) boolean checks with common.mustCall()
* assert.equal() -> assert.strictEqual()
* add 1 ms duration as second argument to setTimeout()
* var -> const

PR-URL: https://github.com/nodejs/node/pull/10532
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-01-01 21:12:52 -08:00
Rich Trott
e5674e1c04 test: refactor test-stream-pipe-error-handling
* provide a RegExp for second argument to `assert.throws()`
* remove unused function arguments
* provide duration of 1 ms for `setTimeout()` calls that do not have a
  duration

PR-URL: https://github.com/nodejs/node/pull/10530
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2017-01-01 21:10:45 -08:00
Michaël Zasso
b465cd07fe url: fix URL query update if searchParams changes
If searchParams becomes empty, query must be set to null.
Add missing update of context flags.

Fixes: https://github.com/nodejs/node/issues/10480
PR-URL: https://github.com/nodejs/node/pull/10486
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-01-01 11:04:55 +01:00
Michaël Zasso
db18dd8356 url: improve spec compliance of WHATWG URL
This patch contains the following changes:

url: make IPv4 parser more spec compliant

* Return int64_t from ParseNumber to prevent overflow for valid big numbers
* Don't throw when there are more than 4 parts (it cannot be an IP
address)
* Correctly interpret the address and don't always throw when there are
numbers > 255

Ref: https://url.spec.whatwg.org/#concept-ipv4-parser
Fixes: https://github.com/nodejs/node/issues/10306

url: percent encode fragment to follow spec change

Ref: https://github.com/whatwg/url/issues/150
Ref: 373dbedbbf

url: fix URL#search setter

The check for empty string must be done before removing the leading '?'.

Ref: https://url.spec.whatwg.org/#dom-url-search

url: set port to null if an empty string is given

This is to follow a spec change.

Ref: https://github.com/whatwg/url/pull/113

url: fix parsing of paths with Windows drive letter

test: update WHATWG URL test fixtures

PR-URL: https://github.com/nodejs/node/pull/10317
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2017-01-01 10:52:35 +01:00
Hitesh Kanwathirtha
ee9df357ff test, win: fix up symlink tests
On Windows, creating a symlink requires admin privileges.
There were two tests which created symlinks which were failing when run
as non-admin.

test-fs-symlink.js already had a check for privileges on Windows
but it had a couple issues:
1. It assumed that whoami was the one that came with windows.
   However, whoami also ships with Win32 Unix utility ports
   like the distribution with git, which can cause this to get check
   tripped up.
2. On failure, the check would just return from the callback instead of
   exiting
3. whoami was executed asynchronously so the test would run regardless
   of privilege state.

test-fs-options-immutable had no check.

As part of this change, I refactored the privilege checking to
a function in common, and changed both above tests to use the
refactored function.

Also documented this function in test\README.md

PR-URL: https://github.com/nodejs/node/pull/10477
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: João Reis <reis@janeasystems.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
2016-12-31 22:45:23 +02:00
Rich Trott
a6ca94a5f5 test: refactor test-tls-alert-handling
* process.on('exit',...) checks -> common.mustCall()
* remove unused function parameters
* var -> const/let

PR-URL: https://github.com/nodejs/node/pull/10482
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Italo A. Casas <me@italoacasas.com>
2016-12-30 22:35:01 -08:00
Rich Trott
0b33ef80f1 test: fix flaky test-http-client-timeout-with-data
test-http-client-timeout-with-data has failed here and there in CI on
FreeBSD and OS X. The test has a socket timeout set to 50ms and a timer
set for 100ms. However, they are not necessarily set in the same tick of
the event loop and their ordering is therefore not guaranteed.

Instead of using a timer, this change listens for an event on the
listener to know when the socket timeout has occurred and then runs the
code originally in the timer.

Additional refactoring: Replaced `process.on('exit', ...)` checks with
`common.mustCall()` and replaced usage of `assert.equal()` with
`assert.strictEqual()`.

PR-URL: https://github.com/nodejs/node/pull/10431
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-12-30 22:33:31 -08:00
James M Snell
abc1633de6 url: move originFor, domainToAscii and domainToUnicode
Move non-standard methods to `url` module instead of exposing as
static methods on the `URL` object.

PR-URL: https://github.com/nodejs/node/pull/10512
Reviewed-By: Italo A. Casas <me@italoacasas.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2016-12-30 10:14:10 -08:00
James M Snell
2213f3640a url: performance improvement in URL implementation
Yields about a 25% average performance improvement

PR-URL: https://github.com/nodejs/node/pull/10469
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2016-12-30 09:49:12 -08:00
Adrian Estrada
509ff1b9e4 test: improve test-http-allow-req-after-204-res
* use const instead of var
* use common.mustCall to control functions execution
* use assert.strictEqual instead of assert.equal
* use arrow functions

PR-URL: https://github.com/nodejs/node/pull/10503
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Italo A. Casas <me@italoacasas.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2016-12-30 09:29:57 -08:00