summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* src: add public API to expose the main V8 PlatformAllen Yonghuang Wang2018-05-062-0/+10
| | | | | | | | | | | Add an API to get MultiIsolatePlatform used in node main thread. PR-URL: https://github.com/nodejs/node/pull/20447 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
* http2: rename http2_state class to Http2StateDaniel Bevenius2018-05-064-8/+8
| | | | | | | | This commit renames the http2_state class to follow the guidelines in CPP_STYLE_GUIDE.md. PR-URL: https://github.com/nodejs/node/pull/20423 Reviewed-By: Anna Henningsen <anna@addaleax.net>
* src: removed unnecessary prototypes from Environment::SetProtoMethodBrandon Ruggles2018-05-052-4/+9
| | | | | | | | | | | | | | | | | Added an optional parameter of type v8::ConstructorBehavior to Environment::NewFunctionTemplate, defaulting to v8::ConstructorBehavior::kAllow. Also modified Environment::SetProtoMethod to pass v8::ConstructorBehavior::kThrow to its call to Environment::NewFunctionTemplate. Fixes: https://github.com/nodejs/node/issues/17668 Refs: https://github.com/nodejs/node/pull/20321 PR-URL: https://github.com/nodejs/node/pull/20321 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
* src: fix inconsistency in extern declarationYang Guo2018-05-051-1/+1
| | | | | | | | | | | | | | NodeCounterProvider is declared as extern but defined as EXTERN_C. This confuses clang-cl. PR-URL: https://github.com/nodejs/node/pull/20436 Refs: https://github.com/nodejs/node/issues/19630 Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
* src: more automatic memory management in node_crypto.ccAnna Henningsen2018-05-054-898/+725
| | | | | | | | | | | | | Prefer custom smart pointers fitted to the OpenSSL data structures over more manual memory management and lots of `goto`s. PR-URL: https://github.com/nodejs/node/pull/20238 Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
* crypto: allocate more memory for cipher.update()Yihong Wang2018-05-041-2/+16
| | | | | | | | | | | | | | For key wrapping algorithms, calling EVP_CipherUpdate() with null output could obtain the size for the ciphertext. Then use the returned size to allocate output buffer. Also add a test case to verify des3-wrap. Signed-off-by: Yihong Wang <yh.wang@ibm.com> PR-URL: https://github.com/nodejs/node/pull/20370 Fixes: https://github.com/nodejs/node/issues/19655 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
* src: refactor `BaseObject` internal field managementAnna Henningsen2018-05-0439-243/+142
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Instead of storing a pointer whose type refers to the specific subclass of `BaseObject`, just store a `BaseObject*` directly. This means in particular that one can cast to classes along the way of the inheritance chain without issues, and that `BaseObject*` no longer needs to be the first superclass in the case of multiple inheritance. In particular, this renders hack-y solutions to this problem (like ddc19be6de1ba263d9c175b2760696e7b9918b25) obsolete and addresses a `TODO` comment of mine. - Move wrapping/unwrapping methods to the `BaseObject` class. We use these almost exclusively for `BaseObject`s, and I hope that this gives a better idea of how (and for what) these are used in our code. - Perform initialization/deinitialization of the internal field in the `BaseObject*` constructor/destructor. This makes the code a bit more obviously correct, avoids explicit calls for this in subclass constructors, and in particular allows us to avoid crash situations when we previously called `ClearWrap()` during GC. This also means that we enforce that the object passed to the `BaseObject` constructor needs to have an internal field. This is the only reason for the test change. - Change the signature of `MakeWeak()` to not require a pointer argument. Previously, this would always have been the same as `this`, and no other value made sense. Also, the parameter was something that I personally found somewhat confusing when becoming familiar with Node’s code. - Add a `TODO` comment that motivates switching to real inheritance for the JS types we expose from the native side. This patch brings us a lot closer to being able to do that. - Some less significant drive-by cleanup. Since we *effectively* already store the `BaseObject*` pointer anyway since ddc19be6de1ba263d9c175b2760696e7b9918b25, I do not think that this is going to have any impact on diagnostic tooling. Fixes: https://github.com/nodejs/node/issues/18897 PR-URL: https://github.com/nodejs/node/pull/20455 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
* src: access `ContextifyContext*` more directly in property cbsAnna Henningsen2018-05-042-23/+23
| | | | | | | | PR-URL: https://github.com/nodejs/node/pull/20455 Fixes: https://github.com/nodejs/node/issues/18897 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
* src: remove `kFlagNoShutdown` flagAnna Henningsen2018-05-043-5/+3
| | | | | | | | | | | | | | | | | | | | This was originally introduced in 3446ff417ba1e, in order to fix a hard crash. However, since the libuv 1.18.0 update, that hard crash is gone, and since f2b9805f85d3f we do not throw an error in JS land anymore either, rendering the flag unnecessary. Also, the original test that checked this condition was added to `test/parallel/`. Since that typically runs without a TTY stdin, a duplicate test is being added to the pseudo-tty test suite in this commit. Refs: https://github.com/nodejs/node/commit/3446ff417ba1e11d35d1661b8788eac5af029360 Refs: https://github.com/nodejs/node/commit/f2b9805f85d3ff770892b37944a0890e0e60ca78 Refs: https://github.com/libuv/libuv/commit/0e2814179c9903423d058b095e84f48fcfb8f3d1 PR-URL: https://github.com/nodejs/node/pull/20388 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
* http2: remove unnecessary v8 qualified namesDaniel Bevenius2018-05-021-10/+10
| | | | | | | | | | This commit removes v8 qualified identifiers that have using directives to be consistent with the rest of the code in node_http2.cc. PR-URL: https://github.com/nodejs/node/pull/20420 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
* http2: remove unused using declarations node_http2Daniel Bevenius2018-05-021-1/+0
| | | | | | | PR-URL: https://github.com/nodejs/node/pull/20420 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
* crypto: use new OpenSSL constants in CipherBaseTobias Nießen2018-04-301-8/+3
| | | | | | | | | | | | | This change replaces some constants with better alternatives which were unavailable in OpenSSL 1.0.2. PR-URL: https://github.com/nodejs/node/pull/20339 Refs: https://github.com/nodejs/node/pull/19794 Refs: https://github.com/nodejs/node/pull/18138 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* src: avoid `std::make_unique`Anna Henningsen2018-04-293-7/+9
| | | | | | | | | | | | | | Work around https://github.com/nodejs/build/issues/1254, which effectively breaks stress test CI and CITGM, by avoiding `std::make_unique` for now. This workaround should be reverted once that issue is resolved. Refs: https://github.com/nodejs/build/issues/1254 PR-URL: https://github.com/nodejs/node/pull/20386 Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Matheus Marchini <matheus@sthima.com>
* http2: fix responses to long payload reqsAnatoli Papirovski2018-04-282-18/+61
| | | | | | | | | | | | | When a request with a long payload is received, http2 does not allow a response that does not process all the incoming payload. Add a conditional Http2Stream.close call that runs only if the user hasn't attempted to read the stream. PR-URL: https://github.com/nodejs/node/pull/20084 Fixes: https://github.com/nodejs/node/issues/20060 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
* tls: fix getEphemeralKeyInfo to support X25519Shigeki Ohtsu2018-04-282-5/+18
| | | | | | | | | | | | | `EVP_PKEY_EC` only covers ANSI X9.62 curves not IETF ones(curve25519 and curve448). This fixes to add support of X25519 in `tlsSocket.getEphemeralKeyInfo()`. X448 should be added in the future upgrade to OpenSSL-1.1.1. PR-URL: https://github.com/nodejs/node/pull/20273 Fixes: https://github.com/nodejs/node/issues/20262 Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
* src: remove unnecessary copy operations in tracingAnna Henningsen2018-04-281-2/+2
| | | | | | | PR-URL: https://github.com/nodejs/node/pull/20356 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
* src: improve fatal exceptionRuben Bridgewater2018-04-271-17/+8
| | | | | | | | | This is just some code cleanup. PR-URL: https://github.com/nodejs/node/pull/20294 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* inspector: allow concurrent inspector sessionsEugene Ostroukhov2018-04-267-189/+153
| | | | | | | | | | | | This change enables concurrent inspector sessions, through WebSocket interface as well as JS interface, in any combination. PR-URL: https://github.com/nodejs/node/pull/20137 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
* crypto: support authTagLength in GCM encryptionTobias Nießen2018-04-261-3/+4
| | | | | | | | | | | The authTagLength option can now be used to produce GCM authentication tags with a specific length. PR-URL: https://github.com/nodejs/node/pull/20235 Refs: https://github.com/nodejs/node/pull/20039 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Yihong Wang <yh.wang@ibm.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
* src: remove SecureContext `_external` getterAnna Henningsen2018-04-262-22/+0
| | | | | | | | | | | | | | This is unused inside Node core, so nothing good can come from keeping it around. PR-URL: https://github.com/nodejs/node/pull/20237 Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
* src: create per-isolate strings after platform setupUlan Degenbaev2018-04-261-32/+34
| | | | | | | | | | | | | | | | Allocation of strings may cause a garbage collection that uses the platform to post tasks. PR-URL: https://github.com/nodejs/node/pull/20175 Fixes: https://github.com/nodejs/node/issues/20171 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Yang Guo <yangguo@chromium.org> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
* process: migrate methods to throw errors with codeMichaël Zasso2018-04-261-70/+56
| | | | | | | | | | Migrate some methods from node.cc to JS in order to properly throw errors with codes. PR-URL: https://github.com/nodejs/node/pull/19973 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com>
* inspector: Use default uv_listen backlog sizeEugene Ostroukhov2018-04-261-1/+2
| | | | | | | | | PR-URL: https://github.com/nodejs/node/pull/20254 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
* crypto: add using directives for v8::Int32, Uint32Tobias Nießen2018-04-251-5/+7
| | | | | | | | PR-URL: https://github.com/nodejs/node/pull/20225 Refs: https://github.com/nodejs/node/pull/20039 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
* crypto: use kNoAuthTagLength in InitAuthenticatedTobias Nießen2018-04-252-12/+25
| | | | | | | | PR-URL: https://github.com/nodejs/node/pull/20225 Refs: https://github.com/nodejs/node/pull/20039 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
* src: assign ERR_SCRIPT_EXECUTION_* codes in C++Joyee Cheung2018-04-253-5/+21
| | | | | | | | | | | | | | | | | | Also modifies the error messages so they include more information and are more consistent. - The message of ERR_SCRIPT_EXECUTION_INTERRUPTED now mentions SIGINT and the trailing period is dropped for consistency. - Added ERR_SCRIPT_EXECUTION_TIMEOUT and include the timeout in the message. PR-URL: https://github.com/nodejs/node/pull/20147 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
* src: fix Systemtap node_gc_stop probeWilliam Cohen2018-04-251-1/+1
| | | | | | | | | | | | The process("node").mark("gc__stop") is actually process("node").mark("gc__done"). Use the proper name so that a developer can use SystemTap to determine the duration of garbage collection. PR-URL: https://github.com/nodejs/node/pull/20152 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Matheus Marchini <matheus@sthima.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com>
* src: limit foreground tasks draining loopUlan Degenbaev2018-04-253-7/+27
| | | | | | | | | | | | | | | | | | | Foreground tasks that repost themselves can force the draining loop to run indefinitely long without giving other tasks chance to run. This limits the foreground task draining loop to run only the tasks that were in the tasks queue at the beginning of the loop. PR-URL: https://github.com/nodejs/node/pull/19987 Fixes: https://github.com/nodejs/node/issues/19937 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Yang Guo <yangguo@chromium.org> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Khaidi Chu <i@2333.moe>
* 2018-04-24, Version 10.0.0 (Current)James M Snell2018-04-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Assert * Calling `assert.fail()` with more than one argument is deprecated. #70dcacd710 * Calling `assert.ok()` with no arguments will now throw. #3cd7977a42 * Calling `assert.ifError()` will now throw with any argument other than `undefined` or `null`. Previously the method would throw with any truthy value. #e65a6e81ef * The `assert.rejects()` and `assert.doesNotReject()` methods have been added for working with async functions. #599337f43e * Async_hooks * Older experimental async_hooks APIs have been removed. #1cc6b993b9 * Buffer * Uses of `new Buffer()` and `Buffer()` outside of the `node_modules` directory will now emit a runtime deprecation warning. #9d4ab90117 * `Buffer.isEncoding()` now returns `undefined` for falsy values, including an empty string. #452eed956e * `Buffer.fill()` will throw if an attempt is made to fill with an empty `Buffer`. #1e802539b2 * Child Process * Undefined properties of env are ignored. #38ee25e2e2, #85739b6c5b * Console * The `console.table()` method has been added. #97ace04492 * Crypto * The `crypto.createCipher()` and `crypto.createDecipher()` methods have been deprecated. Please use `crypto.createCipheriv()` and `crypto.createDecipheriv()` instead. #81f88e30dd * The `decipher.finaltol()` method has been deprecated. #19f3927d92 * The `crypto.DEFAULT_ENCODING` property has been deprecated. #6035beea93 * The `ECDH.convertKey()` method has been added. #f2e02883e7 * The `crypto.fips` property has been deprecated. #6e7992e8b8 * Dependencies * V8 has been updated to 6.6. #9daebb48d6 * OpenSSL has been updated to 1.1.0h. #66cb29e646 * EventEmitter * The `EventEmitter.prototype.off()` method has been added as an alias for `EventEmitter.prototype.removeListener()`. #3bb6f07d52 * File System * The `fs.promises` API provides experimental promisified versions of the `fs` functions. #329fc78e49 * Invalid path errors are now thrown synchronously. #d8f73385e2 * The `fs.readFile()` method now partitions reads to avoid thread pool exhaustion. #67a4ce1c6e * HTTP * Processing of HTTP Status codes `100`, `102-199` has been improved. #baf8495078 * Multi-byte characters in URL paths are now forbidden. #b961d9fd83 * N-API * The n-api is no longer experimental. #cd7d7b15c1 * Net * The `'close'` event will be emitted after `'end'`. #9b7a6914a7 * Perf_hooks * The `PerformanceObserver` class is now an `AsyncResource` and can be monitored using `async_hooks`. #009e41826f * Trace events are now emitted for performance events. #9e509b622b * The `performance` API has been simplified. #2ec6995555 * Performance milestone marks will be emitted as trace events. #96cb4fb795 * Process * Using non-string values for `process.env` is deprecated. #5826fe4e79 * The `process.assert()` method is deprecated. #703e37cf3f * REPL * REPL now experimentally supports top-level await when using the `--experimental-repl-await` flag. #eeab7bc068 * The previously deprecated "magic mode" has been removed. #4893f70d12 * The previously deprecated `NODE_REPL_HISTORY_FILE` environment variable has been removed. #60c9ad7979 * Proxy objects are shown as Proxy objects when inspected. #90a43906ab * Streams * The `'readable'` event is now always deferred with nextTick. #1e0f3315c7 * A new `pipeline()` method has been provided for building end-to-data stream pipelines. #a5cf3feaf1 * Experimental support for async for-await has been added to `stream.Readable`. #61b4d60c5d * Timers * The `enroll()` and `unenroll()` methods have been deprecated. #68783ae0b8 * TLS * The `tls.convertNONProtocols()` method has been deprecated. #9204a0db6e * Support for NPN (next protocol negotiation) has been dropped. #5bfbe5ceae * The `ecdhCurve` default is now `'auto'`. #af78840b19 * Trace Events * A new `trace_events` top-level module allows trace event categories to be enabled/disabld at runtime. #da5d818a54 * URL * The WHATWG URL API is now a global. #312414662b * Util * `util.types.is[…]` type checks have been added. #b20af8088a * Support for bigint formatting has been added to `util.inspect()`. #39dc947409
* src: fix node_crypto.cc compiler warningsDaniel Bevenius2018-04-241-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently the following compiler warnings are issued by clang: ../src/node_crypto.cc:2801:56: warning: '&&' within '||' [-Wlogical-op-parentheses] return tag_len == 4 || tag_len == 8 || tag_len >= 12 && tag_len <= 16; ~~ ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~ ../src/node_crypto.cc:2801:56: note: place parentheses around the '&&' expression to silence this warning return tag_len == 4 || tag_len == 8 || tag_len >= 12 && tag_len <= 16; ^ ../src/node_crypto.cc:2925:51: warning: '&&' within '||' [-Wlogical-op-parentheses] if (cipher->auth_tag_len_ != kNoAuthTagLength && ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~ ../src/node_crypto.cc:2925:51: note: place parentheses around the '&&' expression to silence this warning if (cipher->auth_tag_len_ != kNoAuthTagLength && ^ This commit adds parenthesis around these expressions to silence the warnings. PR-URL: https://github.com/nodejs/node/pull/20216 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* src: rename return var in VerifySpkac functionsDaniel Bevenius2018-04-241-7/+7
| | | | | | | | | | | | | | This commit renames the verification result variable, that is currently named i, to verify_result. PR-URL: https://github.com/nodejs/node/pull/20218 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Minwoo Jung <minwoo@nodesource.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* src: prefer false instead of bool zeroDaniel Bevenius2018-04-241-1/+1
| | | | | | | | | | | | | | This commit updates node_crypto.cc VerifySpkac function to use false instead of 0 for its return bool value i. PR-URL: https://github.com/nodejs/node/pull/20218 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Minwoo Jung <minwoo@nodesource.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* Revert "src: make process.env.TZ setter clear tz cache"Ruben Bridgewater2018-04-231-10/+0
| | | | | | | | | | This reverts commit 1d1ab76e1737da4229b3a0774c60a8fbead89040. PR-URL: https://github.com/nodejs/node/pull/20228 Fixes: https://github.com/nodejs/node/issues/20227 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* n-api: initialize a module via a special symbolGabriel Schulhof2018-04-234-6/+44
| | | | | | | | | Much like regular modules, N-API modules can also benefit from having a special symbol which they can expose. Fixes: https://github.com/nodejs/node/issues/19845 PR-URL: https://github.com/nodejs/node/pull/20161 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
* src: make process.env.TZ setter clear tz cacheBen Noordhuis2018-04-231-0/+10
| | | | | | | | | | | | | | Since the presence of the libc and V8 timezone caches seem to be a perennial source of confusion to users ("why doesn't it work?!"), let's try to support that pattern by intercepting assignments to the `TZ` environment variable and reset the caches as a side effect. PR-URL: https://github.com/nodejs/node/pull/20026 Fixes: https://github.com/nodejs/node/issues/19974 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* src: cover extra load-via-special-symbol scenarioGabriel Schulhof2018-04-231-0/+7
| | | | | | | | | We need to look for a special symbol even if the module self-registers when the module self-registers with the wrong version. PR-URL: https://github.com/nodejs/node/pull/20186 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
* fs: return stats to JS in sync methodsJoyee Cheung2018-04-233-18/+28
| | | | | | | | | | | | | | | - Reduce reference to the global `statValues` by returning the changed stats array from the synchronous methods. Having a local returned value also makes the future integration of BigInt easier. - Also returns the filled array from node::FillGlobalStatsArray and node::FillStatsArray in the C++ side. PR-URL: https://github.com/nodejs/node/pull/20167 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Khaidi Chu <i@2333.moe> Reviewed-By: Gus Caplan <me@gus.host>
* crypto: allow to restrict valid GCM tag lengthTobias Nießen2018-04-232-6/+30
| | | | | | | | | | | This change allows users to restrict accepted GCM authentication tag lengths to a single value. PR-URL: https://github.com/nodejs/node/pull/20039 Fixes: https://github.com/nodejs/node/issues/17523 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Yihong Wang <yh.wang@ibm.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
* crypto: fix explanation in CipherBase::SetAuthTagTobias Nießen2018-04-231-1/+1
| | | | | | | PR-URL: https://github.com/nodejs/node/pull/20197 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
* src: CancelTerminateExecution before throwing errorsJoyee Cheung2018-04-222-2/+4
| | | | | | | | | | | | | Terminating the execution of a script would create a pending exception, therefore we should cancel the termination *before* throwing a new exception, otherwise the attempt to create a custom error may fail. PR-URL: https://github.com/nodejs/node/pull/20146 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
* src: remove `MarkIndependent()` callsAnna Henningsen2018-04-225-6/+0
| | | | | | | | | | | | | | | The method has been deprecated in upstream V8, with messaging indicating that it is the default for handles to be independent now anyway. PR-URL: https://github.com/nodejs/node/pull/20108 Refs: https://github.com/v8/v8/commit/71ad48fb8f214e80518ba0419796e4c571351255 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
* Revert "process: add version constants and compare"Rod Vagg2018-04-201-11/+0
| | | | | | | | | | | | | This reverts commit 91e0f8db118b125e805a77ce31dc21af57ee7abf. PR-URL: https://github.com/nodejs/node/pull/20062 Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
* src: move v8::HandleScope call to EmitUjjwal Sharma2018-04-202-2/+1
| | | | | | | | | | | | | | | | Move v8::HandleScope call to Emit removing it from previous locations where it was added to avoid crashing (constructor and destructor of AsyncWrap) for a more general and fool-proof solution. Ref: https://github.com/nodejs/node/pull/19972#issuecomment-381353894 PR-URL: https://github.com/nodejs/node/pull/20045 Reviewed-By: Yang Guo <yangguo@chromium.org> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
* src: throw ERR_MISSING_ARGS in node_crypto.ccJoyee Cheung2018-04-192-15/+18
| | | | | | | | | PR-URL: https://github.com/nodejs/node/pull/20121 Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
* src: throw ERR_INVALID_ARG_VALUE in node_crypto.ccJoyee Cheung2018-04-192-3/+7
| | | | | | | | | PR-URL: https://github.com/nodejs/node/pull/20121 Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
* src: throw ERR_MISSING_MODULE in module_wrap.ccJoyee Cheung2018-04-192-2/+2
| | | | | | | | | PR-URL: https://github.com/nodejs/node/pull/20121 Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
* src: throw ERR_BUFFER_OUT_OF_BOUNDS in node_buffer.ccJoyee Cheung2018-04-192-2/+5
| | | | | | | | | PR-URL: https://github.com/nodejs/node/pull/20121 Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
* src: throw ERR_INVALID_ARG_TYPE in C++ argument checksJoyee Cheung2018-04-199-66/+73
| | | | | | | | | | | | | | | | | | | | | - Moves THROW_AND_RETURN_IF_NOT_BUFFER and THROW_AND_RETURN_IF_NOT_STRING from node_crypto.cc to node_errors.h so it can be reused. - Move THROW_AND_RETURN_UNLESS_BUFFER in util.h to node_buffer.cc and call THROW_AND_RETURN_IF_NOT_BUFFER there. The only other reference to THROW_AND_RETURN_UNLESS_BUFFER in node_i18n.cc can be safely replaced by an assertion since the argument will be checked in JS land. - Migrate ERR_INVALID_ARG_TYPE errors in C++. We can move the checks to JS land if possible later without having to go semver-major. PR-URL: https://github.com/nodejs/node/pull/20121 Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
* src: migrate ERR_INDEX_OUT_OF_RANGE in C++Joyee Cheung2018-04-192-5/+8
| | | | | | | | | | | | | This patch migrates the "Index out of range" errors in C++ to errors with the code `ERR_INDEX_OUT_OF_RANGE` which have equivalents in JavaScript. PR-URL: https://github.com/nodejs/node/pull/20121 Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
* src: add THROW_ERR_* helpersJoyee Cheung2018-04-191-0/+6
| | | | | | | | | PR-URL: https://github.com/nodejs/node/pull/20121 Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>