0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-29 23:16:30 +01:00
Commit Graph

5192 Commits

Author SHA1 Message Date
James M Snell
9f74184e98 crypto: upgrade pbkdf2 without digest to an error
Commit a1163582 added a deprecation warning when pbkdf2 was called without an
explicit `digest` argument. This was because the default digest is `sha1`,
which is not-recommended from a security point of view. This upgrades it
to a runtime error when `digest` is undefined per the plan discussed in
the original issue.

Ref: a1163582c5

PR-URL: https://github.com/nodejs/node/pull/11305
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2017-02-13 11:04:51 -08:00
Brian White
8bcc122349 test: improve querystring.parse assertion messages
PR-URL: https://github.com/nodejs/node/pull/11234
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Nicu Micleușanu <micnic90@gmail.com>
2017-02-13 10:40:45 -08:00
Brian White
ff785fd517 querystring: fix empty pairs and optimize parse()
This commit fixes handling of empty pairs that occur before the end
of the query string so that they are also ignored.

Additionally, some optimizations have been made, including:

* Avoid unnecessary code execution where possible
* Use a lookup table when checking for hex characters
* Avoid forced decoding when '+' characters are encountered and we
are using the default decoder

Fixes: https://github.com/nodejs/node/issues/10454
PR-URL: https://github.com/nodejs/node/pull/11234
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Nicu Micleușanu <micnic90@gmail.com>
2017-02-13 10:40:37 -08:00
cjihrig
d3be0f8818 test: cover cluster error during dgram socket bind
When a non-exclusive dgram socket is bound from a cluster
worker, a handle is requested from the cluster module. This
commit adds coverage for the case where an error occurs while
retrieving the handle.

PR-URL: https://github.com/nodejs/node/pull/11295
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-02-13 13:28:28 -05:00
Rich Trott
f2023d7b6f test: refactor test-repl-sigint
* remove debugging code that prints child stdout
* indexOf() -> includes()
* improved messages on assertion failures

PR-URL: https://github.com/nodejs/node/pull/11309
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
2017-02-13 08:14:52 -08:00
cjihrig
93982c0a3d test: increase setMulticastLoopback() coverage
PR-URL: https://github.com/nodejs/node/pull/11277
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-02-13 10:12:00 -05:00
cjihrig
3a1e67dcdc test: refactor test-dgram-address.js
- separate the IPv4 and IPv6 tests using block scopes
- use common.mustCall() and arrow functions for callbacks
- add coverage for case where address() throws

PR-URL: https://github.com/nodejs/node/pull/11271
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-02-13 10:04:10 -05:00
Matteo Collina
b1fc7745f2 fs: avoid emitting error EBADF for double close
Changed the logic in fs.ReadStream and fs.WriteStream so that
close always calls the prototype method rather than the internal
event listener.

Fixes: https://github.com/nodejs/node/issues/2950
PR-URL: https://github.com/nodejs/node/pull/11225
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
2017-02-13 09:08:47 +01:00
Rich Trott
6dd979e67c test: refactor test-readline-keys
* replace `util._extend()` with `Object.assign()`
* extract repeated map function to a single instance
* remove unneeded truthiness-check ternary on Objects

PR-URL: https://github.com/nodejs/node/pull/11281
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-02-12 23:54:31 -08:00
Rich Trott
dd1cf8bb37 test: refactor test-http-response-statuscode
* move repeated code to function
* use strings for expected error (exposes result for [] as empty string)
* remove unneeded `common.mustCall()` usage with function arguments that
  are not callbacks

PR-URL: https://github.com/nodejs/node/pull/11274
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2017-02-12 23:47:38 -08:00
Sam Roberts
4cafa60c99 child_process: align fork/spawn stdio error msg
fork()'s support for .stdio strings in 3268863eb used a different
TypeError string from spawn, unnecessarily.

PR-URL: https://github.com/nodejs/node/pull/11044
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
2017-02-11 14:06:26 -08:00
DavidCai
78182458e6 url: fix error message of url.format
PR-URL: https://github.com/nodejs/node/pull/11162
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
2017-02-11 13:59:34 -08:00
jobala
5f20d62c8f test: improve test-assert.js
Verify error message thrown from assert.ifError

PR-URL: https://github.com/nodejs/node/pull/11193
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
2017-02-11 13:53:14 -08:00
Shubheksha Jalan
3d2bd7abda test: improve test-http-agent-destroyed-socket.js
* wrap callbacks in mustCall()
* Wrap the callbacks which make assertions in common.mustcall()
  to ensure they are called

PR-URL: https://github.com/nodejs/node/pull/11201
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-02-11 13:48:29 -08:00
toboid
1544d8f04b test: improve test-buffer-includes.js
* verify error message
* use arrow funcs

PR-URL: https://github.com/nodejs/node/pull/11203
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-02-11 13:40:15 -08:00
Michaël Zasso
f65aa08b52 util: improve inspect for (Async|Generator)Function
Use the constructor name in the output, if present.

PR-URL: https://github.com/nodejs/node/pull/11210
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
2017-02-11 13:29:10 -08:00
Daijiro Wachi
81ef56b3df test: querystring.escape with multibyte characters
Add a test case for querystring.parse with multibyte characters
under 0x800.

PR-URL: https://github.com/nodejs/node/pull/11251
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-02-11 10:16:21 -08:00
cjihrig
fe2b5f0dd2 test: refactor test-dgram-setBroadcast.js
This test wasn't actually working, as sockets were being closed,
allowing the test to exit before any assertions were actually
run. This commit refactors the test to maintain the same intended
semantics.

PR-URL: https://github.com/nodejs/node/pull/11252
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-02-11 10:05:32 -08:00
Franziska Hinkelmann
5cd9d76b02 test: add vm module edge cases
Add two, admittedly contrived, examples that test
edge cases of the vm module.
They demonstrate that the if statements `if (maybe_rv.IsEmpty())` and
`if (maybe_prop_attr.IsNothing())` in the GetterCallback
and the QueryCallback are observable.

Both GetterCallback and QueryCallback
explicitly check the global_proxy() if a property is
not found on the sandbox. In these tests, the explicit check
inside the callback yields different results than deferring the
check until after the callback. The check is deferred, if the
callbacks do not intercept, i.e., if args.GetReturnValue().Set() is
not called.

PR-URL: https://github.com/nodejs/node/pull/11265
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2017-02-11 09:48:11 -08:00
Franziska Hinkelmann
02371985f1 src: fix delete operator on vm context
In the implementation of the vm module,
if a property is successfully deleted
on the sandbox, we also need to delete it
on the global_proxy object. Therefore, we
must not call args.GetReturnValue().Set().

We only intercept, i.e., call
args.GetReturnValue().Set(), in the
DeleterCallback, if Delete() failed, e.g. because
the property was read only.

PR-URL: https://github.com/nodejs/node/pull/11266
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2017-02-11 09:01:15 -08:00
Vse Mozhet Byt
a29c85a28d test: adapt test-debugger-pid to localized Windows
PR-URL: https://github.com/nodejs/node/pull/11270
Fixes: https://github.com/nodejs/node/issues/11250
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-02-11 08:56:23 -08:00
Ben Noordhuis
291b599bba src: fix --icu-data-dir= regression
Commit a8734af ("src: make copies of startup environment variables")
from two weeks ago introduced a regression in the capturing of the
`--icu-data-dir=` switch: it captured the string up to the `=` instead
of what comes after it.

PR-URL: https://github.com/nodejs/node/pull/11255
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
2017-02-11 15:24:30 +01:00
Ben Noordhuis
46345b9374 src: make --icu-data-dir= switch testable
Move some code around so we can properly test whether the switch
actually does anything.

PR-URL: https://github.com/nodejs/node/pull/11255
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
2017-02-11 15:23:51 +01:00
Ben Noordhuis
75019dfa67 test: remove nan + weak
Since the previous commit obsoleted them, remove them.

PR-URL: https://github.com/nodejs/node/pull/11239
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
2017-02-11 14:21:32 +01:00
Ben Noordhuis
bae093a70b test: remove dependency on node-weak
Replace node-weak with a small hand-rolled add-on.  We can now drop
node-weak and nan, reducing the size of the source tree by about 750 kB
and the size of the tarball by about 150-300 kB.

PR-URL: https://github.com/nodejs/node/pull/11239
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
2017-02-11 14:21:29 +01:00
Ben Noordhuis
da52fcdcf5 test: don't call process.exit() in gc tests
Rewrite the tests in test/gc so that they no longer call process.exit().
Instead they exit gracefully now.

PR-URL: https://github.com/nodejs/node/pull/11239
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
2017-02-11 14:20:50 +01:00
Sebastian Roeder
f8cdaaa16a test: validate error message from buffer.equals
Adding regular expression as an argument to an assert.throws().

PR-URL: https://github.com/nodejs/node/pull/11215
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
2017-02-11 14:58:50 +09:00
cjihrig
b32ae9e74d test: add coverage for dgram send() errors
This commit adds code coverage for emitted and callback errors
for dgram's Socket#send() method.

PR-URL: https://github.com/nodejs/node/pull/11248
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
2017-02-10 16:34:32 -05:00
Josh Gavant
dfdd911e17 lib: deprecate node --debug at runtime
Fixes: https://github.com/nodejs/node/issues/9789
PR-URL: https://github.com/nodejs/node/pull/10970
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2017-02-10 12:41:09 -08:00
cjihrig
df14956ca0 test: add coverage for string array dgram send()
This commit adds code coverage for dgram's Socket#send() where
the data is an array of strings.

PR-URL: https://github.com/nodejs/node/pull/11247
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
2017-02-10 15:26:04 -05:00
cjihrig
b471392f8c test: increase dgram ref()/unref() coverage
This commit completes code coverage for dgram's Socket#ref() and
Socket#unref() methods.

PR-URL: https://github.com/nodejs/node/pull/11240
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-02-10 12:42:20 -05:00
cjihrig
1683299c33 test: add coverage to dgram receive error case
This commit adds coverage for the case where a dgram socket
handle receives a message, but nread < 0, indicating an error.

PR-URL: https://github.com/nodejs/node/pull/11241
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
2017-02-10 12:17:19 -05:00
Rich Trott
05be62307d test: refactor test-fs-buffer
* Remove unneeded temp dir cleanup
* Add check for error in `.close()` callback
* Improve error reporting

On that last bullet point, the previous version of the test reported
errors like this:

```
AssertionError: [ '.empty-repl-history-file',
  '.node_repl_history',
  'GH-1899-output.js',
  'GH-892-request.js',
  'a.js',
  'a1.js',
  'agen deepStrictEqual [ '.empty-repl-history-file',
  '.node_repl_history',
  'GH-1899-output.js',
  'GH-892-request.js',
  'a.js',
  'a1.js',
  'agen
```

Now, they look like this:

```
AssertionError: expected *, got ! by hex decoding 2a
```

PR-URL: https://github.com/nodejs/node/pull/11232
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-02-09 20:48:48 -08:00
James M Snell
159749d522 errors: add internal/errors.js
Add the internal/errors.js core mechanism.

PR-URL: https://github.com/nodejs/node/pull/11220
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2017-02-09 13:46:14 -08:00
Sam Roberts
59afa275ad crypto: support OPENSSL_CONF again
A side-effect of https://github.com/nodejs/node-private/pull/82
was to remove support for OPENSSL_CONF, as well as removing the default
read of a configuration file on startup.

Partly revert this, allowing OPENSSL_CONF to be used to specify a
configuration file to read on startup, but do not read a file by
default.

If the --openssl-config command line option is provided, its value is
used, not the OPENSSL_CONF environment variable.

Fix: https://github.com/nodejs/node/issues/10938
PR-URL: https://github.com/nodejs/node/pull/11006
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2017-02-09 12:26:39 -08:00
Gireesh Punathil
46edd940e8 fs: re-enable watch facility in AIX
On AIX, watch feature depends on AHAFS based Event infrastructure.
While in principle the watch use case is same across platforms, there
are subtle differences in the way AIX deals with this, with few
behavioral changes (external).

This commit addresses an assertion failure on folder watch, enabling the
AIX code for watch feature which was masked under a macro, open up
relevant test cases, skip tests which comes under the AIX limitation,
and make the document changes as appropriate.

Refs: https://github.com/nodejs/node/pull/11094
Refs: https://github.com/nodejs/node/issues/5085
PR-URL: https://github.com/nodejs/node/pull/10085
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2017-02-09 13:53:45 -05:00
cjihrig
0700927832 test: improve checks in test-path-parse-format
- validate full error messages
- use assert.throws() instead of try...catch

PR-URL: https://github.com/nodejs/node/pull/11223
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
2017-02-09 13:17:36 -05:00
cjihrig
a4bb9fdb89 http: include provided status code in range error
ServerResponse#writeHead() coerces the user provided status code
to a number and then performs a range check. If the check fails,
a range error is thrown. The coerced status code is included in
the error message. This commit uses the user provided status code
instead.

PR-URL: https://github.com/nodejs/node/pull/11221
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-02-09 12:38:06 -05:00
cjihrig
c239581e64 test: fix incorrect indentation
Indentation is off in test-http-server-unconsume-consume.js.
The linter isn't complaining, but it probably should be.

PR-URL: https://github.com/nodejs/node/pull/11219
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-02-09 12:11:03 -05:00
ALJCepeda
89f8ef2bf4 test: remove obsolete comment from dgram test
Refs: https://github.com/nodejs/node/issues/4640
PR-URL: https://github.com/nodejs/node/pull/8689
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2017-02-09 11:44:57 -05:00
abouthiroppy
2db3b941a9 test: add test cases to test-readline-keys.js
PR-URL: https://github.com/nodejs/node/pull/10772
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2017-02-08 08:33:15 -08:00
Rich Trott
62f513a9c8 test: add missing initialization in test-assert
test-assert contains Boolean checks without initializing the Boolean to
false. It will be true thanks to previous tests in the file.

Block-scope all instances of `threw` so that side effects like this are
not an issue. Add missing initializations for `threw` in the tests
where it is missing.

PR-URL: https://github.com/nodejs/node/pull/11191
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2017-02-07 23:01:24 -08:00
Rich Trott
73f219fb97 test: increase specificity in dgram test
Expand error message checking to include the entire error string in
test-dgram-membership.

PR-URL: https://github.com/nodejs/node/pull/11187
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2017-02-07 20:11:59 -08:00
Sebastian Van Sande
ddbfdba4da test: improve crypto.setEngine coverage to check for errors
PR-URL: https://github.com/nodejs/node/pull/11143
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-02-07 15:45:52 -08:00
Rich Trott
4334658635 tools: enable no-throw-literal ESLint rule
Only throw the Error object itself or an object using the Error object
as base objects for user-defined exceptions.

PR-URL: https://github.com/nodejs/node/pull/11168
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
2017-02-07 14:17:52 -08:00
Rich Trott
78ba4943c5 test: throw Error objects instead of literals
test-tls-econnreset and test-http-response-status-message throw literals
instead of Error objects. Use common.fail() which throws an
AssertionError.

PR-URL: https://github.com/nodejs/node/pull/11168
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
2017-02-07 14:17:25 -08:00
Kirill Fomichev
e90f38270c
crypto: throw error in CipherBase::SetAutoPadding
Throw error after calling CipherBase#final

PR-URL: https://github.com/nodejs/node/pull/9405
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2017-02-07 13:07:55 +01:00
cjihrig
7dd82dd1c3 test: add common.mustNotCall()
This commit adds a mustNotCall() helper for testing. This provides
an alternative to using common.fail() as a callback, or creating
a callback function for the sole purpose of calling common.fail().

PR-URL: https://github.com/nodejs/node/pull/11152
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
2017-02-06 14:07:55 -05:00
James M Snell
9549329158 fs: allow WHATWG URL and file: URLs as paths
Updates the fs module APIs to allow 'file://' URL objects
to be passed as the path.

For example:

```js
const URL = require('url').URL;
const myURL = new URL('file:///C:/path/to/file');
fs.readFile(myURL, (err, data) => {});
```

On Windows, file: URLs with a hostname convert to UNC paths,
while file: URLs with drive letters convert to local absolute
paths:

```
file://hostname/a/b/c => \\hostname\a\b\c
file:///c:/a/b/c => c:\a\b\c
```

On all other platforms, file: URLs with a hostname are unsupported
and will result in a throw:

```
file://hostname/a/b/c => throw!
file:///a/b/c => /a/b/c
```

The documentation for the fs API is intentionally not updated in
this commit because the URL API is still considered experimental
and is not officially documented *at this time*

Note that file: URLs are *required* by spec to always be absolute
paths from the file system root.

This is a semver-major commit because it changes error handling
on the fs APIs.

PR-URL: https://github.com/nodejs/node/pull/10739
Ref: https://github.com/nodejs/node/issues/10703
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2017-02-06 11:03:37 -08:00
Rich Trott
3fffebbde3 doc: add common.WPT to test README
PR-URL: https://github.com/nodejs/node/pull/11127
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-02-05 21:17:32 -08:00