Trivikram
2bdf3ca235
http2: callback valid check before closing request
...
Do not close the request if callback is not a function, and
throw ERR_INVALID_CALLBACK TypeError
Backport-PR-URL: https://github.com/nodejs/node/pull/19229
PR-URL: https://github.com/nodejs/node/pull/19061
Fixes: https://github.com/nodejs/node/issues/18855
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Shingo Inoue <leko.noor@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2018-04-04 16:40:56 +02:00
Joyee Cheung
45c477c2e6
lib: restructure cjs and esm loaders
...
Create `lib/internal/modules` and restructure the module loaders
to make the purpose of those files clearer.
Also make it clear in the code that the object exported by
`lib/internal/modules/cjs/loader.js` is `CJSModule` instead of the
ambiguous `Module`.
Before:
```
lib
├── ...
├── internal
│ ├── loaders
│ │ ├── CreateDynamicModule.js
│ │ ├── DefaultResolve.js
│ │ ├── Loader.js
│ │ ├── ModuleJob.js
│ │ ├── ModuleMap.js
│ │ ├── ModuleWrap.js
│ │ └── Translators.js
│ └── module.js
└── module.js
```
After:
```
lib
├── ...
├── internal
│ ├── ...
│ └── modules
│ ├── cjs
│ │ ├── helpers.js
│ │ └── loader.js
│ └── esm
│ ├── CreateDynamicModule.js
│ ├── DefaultResolve.js
│ ├── Loader.js
│ ├── ModuleJob.js
│ ├── ModuleMap.js
│ └── Translators.js
└── module.js # deleted in this commit to work with git file mode
```
Backport-PR-URL: https://github.com/nodejs/node/pull/19374
PR-URL: https://github.com/nodejs/node/pull/19177
Refs: https://github.com/nodejs/node/pull/19112
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2018-04-04 16:21:19 +02:00
Joyee Cheung
ebdcf91dcc
src: put bootstrappers in lib/internal/bootstrap/
...
Create `lib/internal/bootstrap/` and put bootstrappers there:
Before:
```
lib/internal
├── ...
├── bootstrap_loaders.js
└── bootstrap_node.js
```
After:
```
lib/internal
├── ...
└── bootstrap
├── loaders.js
└── node.js
```
Backport-PR-URL: https://github.com/nodejs/node/pull/19374
PR-URL: https://github.com/nodejs/node/pull/19177
Refs: https://github.com/nodejs/node/pull/19112
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2018-04-04 16:21:09 +02:00
Joyee Cheung
ff7a116ba3
src: move internal loaders out of bootstrap_node.js
...
- Moves the creation of `process.binding()`, `process._linkedBinding()`
`internalBinding()` and `NativeModule` into a separate file
`lib/internal/bootstrap_loaders.js`, and documents them there.
This file will be compiled and run before `bootstrap_node.js`, which
means we now bootstrap the internal module & binding system before
actually bootstrapping Node.js.
- Rename the special ID that can be used to require `NativeModule`
as `internal/bootstrap_loaders` since it is setup there. Also put
`internalBinding` in the object exported by `NativeModule.require`
instead of putting it inside the `NativeModule.wrapper`
- Use the original `getBinding()` to get the source code of native
modules instead of getting it from `process.binding('native')`
so that users cannot fake native modules by modifying the binding
object.
- Names the bootstrapping functions so their names show up
in the stack trace.
Backport-PR-URL: https://github.com/nodejs/node/pull/19374
PR-URL: https://github.com/nodejs/node/pull/19112
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
2018-04-04 16:20:45 +02:00
Mike Kaufman
152a86c6aa
lib: make isStackOverflowError() engine-agnostic
...
Assumption that stack overflow exception has name == "RangeError" is
v8-specific. Updated logic to dynamically capture error name when
capturing error message.
PR-URL: https://github.com/nodejs/node/pull/19705
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-04-03 11:10:33 +02:00
Guy Bedford
859b719927
module: skip preserveSymlinks for main
...
PR-URL: https://github.com/nodejs/node/pull/19388
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-04-02 16:09:28 +02:00
Anna Henningsen
a45f3f8fd2
lib: document nextTick queue internals
...
Make this code (a bit more) comprehensible by adding some
internals docs.
With diagrams and everything! 🎉
PR-URL: https://github.com/nodejs/node/pull/19469
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Weijia Wang <starkwang@126.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Gus Caplan <me@gus.host >
2018-04-02 14:20:48 +02:00
Sarat Addepalli
7b850a7565
http2: destroy() stream, upon errnoException
...
First steps towards #19060
PR-URL: https://github.com/nodejs/node/pull/19389
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2018-04-02 10:30:04 +02:00
Sergey Golovin
fdc51a1331
url: remove redundant function
...
PR-URL: https://github.com/nodejs/node/pull/19076
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2018-03-30 17:19:19 +02:00
Sergey Golovin
99e3c77808
url: refactor "escapeParam" function to make it common
...
PR-URL: https://github.com/nodejs/node/pull/19076
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2018-03-30 17:18:57 +02:00
Michaël Zasso
ee4390a167
repl: fix tab completion of inspector module
...
Correctly check for the presence of the inspector module before adding
it to the builtin libs list.
PR-URL: https://github.com/nodejs/node/pull/19505
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Yuta Hiroto <hello@hiroppy.me >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-03-30 17:18:47 +02:00
Anna Henningsen
441175c29a
http2: refer to stream errors by name
...
Display the constant name instead of a stream error code
in the error message, because the numerical codes give absolutely
no clue about what happened when an error is emitted.
Backport-PR-URL: https://github.com/nodejs/node/pull/19579
PR-URL: https://github.com/nodejs/node/pull/18966
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Minwoo Jung <minwoo@nodesource.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2018-03-30 15:17:15 +02:00
Dan Kaplun
6ead99aa73
console: don't swallow call stack exceeded errors
...
Fixes test/parallel/test-console-no-swallow-stack-exceeded.js
PR-URL: https://github.com/nodejs/node/pull/19423
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2018-03-27 16:07:53 +02:00
Rich Trott
419e88ea4a
lib,test: lint fixes for linter upgrade
...
ESLint 4.19.1 fixes some bugs in rules. These changes prepare us for the
upgrade.
PR-URL: https://github.com/nodejs/node/pull/19528
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-03-27 16:00:57 +02:00
James M Snell
49c0efd2a2
http2: remove some unnecessary next ticks
...
PR-URL: https://github.com/nodejs/node/pull/19451
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2018-03-24 17:52:34 +01:00
Sameer Srivastava
926214aefe
cluster: add support for NODE_OPTIONS="--inspect"
...
When using cluster and --inspect as cli argument it is correctly
handled and each worker will use a different port, this was
fixed by #13619 . But when env var NODE_OPTIONS="--inspect"
is set this logic doesn't apply and the workers will fail as they
try to attach to the same port.
Fixes: https://github.com/nodejs/node/issues/19026
PR-URL: https://github.com/nodejs/node/pull/19165
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
2018-03-24 11:42:37 +01:00
Matteo Collina
3914e97741
http2: fixes error handling
...
There should be no default error handling when using Http2Stream.
All errors will end up in `'streamError'` on the server anyway,
but they are emitted on `'stream'` as well, otherwise some error
conditions are impossible to debug.
See: https://github.com/nodejs/node/pull/14991
Backport-PR-URL: https://github.com/nodejs/node/pull/19478
PR-URL: https://github.com/nodejs/node/pull/19232
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-03-21 11:04:46 +00:00
Ruben Bridgewater
f4f0266bfe
errors: add comments about falsy error types
...
Some error types are not properly set. This adds comments which
ones are probably falty and to what they should be set instead.
Backport-PR-URL: https://github.com/nodejs/node/pull/19244
PR-URL: https://github.com/nodejs/node/pull/18857
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2018-03-21 10:50:31 +00:00
Ruben Bridgewater
ffa16aad60
errors: update all internal errors
...
This updates all internal errors to the new error type. While doing
so it removes unused errors.
A few errors currently seem to have the wrong type. To identify them
later, comments were added next to the error type.
Backport-PR-URL: https://github.com/nodejs/node/pull/19244
PR-URL: https://github.com/nodejs/node/pull/18857
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2018-03-21 10:50:26 +00:00
Ruben Bridgewater
d57a2421fc
errors: implement new error handling
...
This implements a function based system. Instead of passing in the
error code as first argument, the error code itself is a error class.
It already contains the correct error type, so while adding a new
error no one has to think about the error type anymore. In case a
single error code has more than one error type, the error class has
properties for the non default error types. Those can be used as
fallback.
This prevents typos, makes the implementation easier and it is less
verbose when writing the code for a new error.
The implementation itself does not interfere with the old
implementation. So the old and the new system can co-exist and it is
possible to slowly migrate the old ones to the new system.
Backport-PR-URL: https://github.com/nodejs/node/pull/19244
PR-URL: https://github.com/nodejs/node/pull/18857
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2018-03-21 10:50:22 +00:00
Sarat Addepalli
607b33cfcc
fs: support as and as+ flags in stringToFlags()
...
PR-URL: https://github.com/nodejs/node/pull/18801
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Matheus Marchini <matheus@sthima.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2018-03-20 12:04:09 +00:00
Trivikram
519850f21e
test: http2 client setNextStreamID errors
...
Backport-PR-URL: https://github.com/nodejs/node/pull/18848
PR-URL: https://github.com/nodejs/node/pull/18848
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Minwoo Jung <minwoo@nodesource.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-03-20 11:49:43 +00:00
Daniel Bevenius
f0f31d080a
async_hooks: add copyHooks function
...
This commit introduces a copyHooks function that can be used by
storeActiveHooks and restoreActiveHooks to remove some code duplication.
PR-URL: https://github.com/nodejs/node/pull/19391
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com >
2018-03-20 11:49:42 +00:00
Sergey Golovin
072adfea8c
url: replace "magic" numbers by constants
...
PR-URL: https://github.com/nodejs/node/pull/19035
Reviewed-By: Myles Borins <myles.borins@gmail.com >
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Khaidi Chu <i@2333.moe >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com >
2018-03-20 11:49:37 +00:00
cjihrig
f06622cd56
lib: define printErr() in script string
...
This commit moves the printErr() function, used by the
tick profiler processer, into the code string passed to
vm.runInThisContext().
PR-URL: https://github.com/nodejs/node/pull/19285
Fixes: https://github.com/nodejs/node/issues/19260
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2018-03-20 11:34:00 +00:00
Gus Caplan
9613e02ff7
tools,bootstrap: preprocess gypi files to json
...
PR-URL: https://github.com/nodejs/node/pull/19140
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2018-03-20 11:33:52 +00:00
Rich Trott
563bed00f5
benchmark,lib,test,tools: use consistent quotes
...
In preparation for a linting rule, use consistent quotation for
properties in objects.
PR-URL: https://github.com/nodejs/node/pull/19156
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Teddy Katz <teddy.katz@gmail.com >
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Roman Reiss <me@silverwind.io >
2018-03-20 11:33:44 +00:00
Luigi Pinca
152c931f53
stream: make Duplex inherits from DuplexBase
...
Add ability to subclass `stream.Duplex` without inheriting the
"no-half-open enforcer" regardless of the value of the `allowHalfOpen`
option.
PR-URL: https://github.com/nodejs/node/pull/18974
Reviewed-By: Benjamin Gruenbaum <benjamingr@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: Chen Gang <gangc.cxy@foxmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2018-03-20 11:33:42 +00:00
Ruben Bridgewater
8d33e5c214
assert: improve error check
...
Minor performance improvement.
PR-URL: https://github.com/nodejs/node/pull/17574
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com >
Reviewed-By: Jon Moss <me@jonathanmoss.me >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2018-03-20 11:33:41 +00:00
Ruben Bridgewater
5e6b42ec9c
assert: show proper differences
...
Right now it is possible to get an AssertionError from input that has
the customInspect function set to always return the same value.
That way the error message is actually misleading because the output
is going to look the same. This fixes it by deactivating the custom
inspect function.
Backport-PR-URL: https://github.com/nodejs/node/pull/19230
PR-URL: https://github.com/nodejs/node/pull/18611
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2018-03-20 11:33:39 +00:00
Ruben Bridgewater
9abbb6b857
assert: fix infinite loop
...
In rare cirumstances it is possible to get a identical error diff.
In such a case the advances diffing runs into a infinite loop.
This fixes it by properly checking for extra entries.
Backport-PR-URL: https://github.com/nodejs/node/pull/19230
PR-URL: https://github.com/nodejs/node/pull/18611
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2018-03-20 11:33:39 +00:00
Ruben Bridgewater
ead727c274
tty: add getColorDepth function
...
Right now it is very difficult to determine if a terminal supports
colors or not. This function adds this functionality by detecting
environment variables and checking process.
Backport-PR-URL: https://github.com/nodejs/node/pull/19230
PR-URL: https://github.com/nodejs/node/pull/17615
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2018-03-20 11:33:37 +00:00
Ruben Bridgewater
5aa3a2d172
assert: improve error messages
...
From now on all error messages produced by `assert` in strict mode
will produce a error diff.
Backport-PR-URL: https://github.com/nodejs/node/pull/19230
PR-URL: https://github.com/nodejs/node/pull/17615
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2018-03-20 11:33:36 +00:00
Ruben Bridgewater
db73d1c13b
assert: use object argument in innerFail
...
Right now it is difficult to know what argument stands for what
property. By refactoring the arguments into a object it is clear
what stands for what.
Backport-PR-URL: https://github.com/nodejs/node/pull/19230
PR-URL: https://github.com/nodejs/node/pull/17582
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Jon Moss <me@jonathanmoss.me >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com >
2018-03-20 11:33:32 +00:00
Guy Bedford
f3e3429296
module: support main w/o extension, pjson cache
...
This adds support for ensuring that the top-level main into Node is
supported loading when it has no extension for backwards-compat with
NodeJS bin workflows.
In addition package.json caching is implemented in the module lookup
process.
Backport-PR-URL: https://github.com/nodejs/node/pull/18923
PR-URL: https://github.com/nodejs/node/pull/18728
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2018-03-07 09:32:36 -08:00
Bradley Farias
95f6467ffd
module: fix cyclical dynamic import
...
ensures that instantiation result is only used during initial loading
PR-URL: https://github.com/nodejs/node/pull/18965
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Guy Bedford <guybedford@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com >
Reviewed-By: Jan Krems <jan.krems@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2018-03-07 09:29:50 -08:00
Anna Henningsen
e584113b66
lib: re-fix v8_prof_processor
...
Make the script not error out immediately because of a missing
pseudo-global.
(Note that it seems like tests are still broken on `master`.)
PR-URL: https://github.com/nodejs/node/pull/19059
Fixes: https://github.com/nodejs/node/issues/19044
Refs: https://github.com/nodejs/node/pull/18623
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Evan Lucas <evanlucas@me.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matheus Marchini <matheus@sthima.com >
Reviewed-By: Minwoo Jung <minwoo@nodesource.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2018-03-05 10:07:17 +00:00
Anna Henningsen
5b8c97f6bc
events: show throw stack trace for uncaught exception
...
Show the stack trace for the `eventemitter.emit('error')` call
in the case of an uncaught exception.
Previously, there would be no clue in Node’s output about where
the actual `throw` comes from.
PR-URL: https://github.com/nodejs/node/pull/19003
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-03-05 10:07:17 +00:00
Ruben Bridgewater
db8d197e79
lib,test: remove yoda statements
...
PR-URL: https://github.com/nodejs/node/pull/18746
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-03-05 10:07:17 +00:00
Anna Henningsen
aa0fca9426
http2: use original error for cancelling pending streams
...
Previously, if `session.destroy()` was called with an error object,
the information contained in it would be discarded and a generic
`ERR_HTTP2_STREAM_CANCEL` would be used for all pending streams.
Instead, make the information from the original error object
available.
PR-URL: https://github.com/nodejs/node/pull/18988
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2018-03-05 10:07:17 +00:00
Anna Henningsen
447136999d
http2: send error text in case of ALPN mismatch
...
Send a human-readable HTTP/1 response in case of an unexpected
ALPN protocol. This helps with debugging this condition,
since previously the only result of it would be a closed socket.
PR-URL: https://github.com/nodejs/node/pull/18986
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2018-03-05 10:07:17 +00:00
Daniel Bevenius
12856b0dd2
lib: change hook -> hooks in code comment
...
PR-URL: https://github.com/nodejs/node/pull/19053
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2018-03-05 10:07:17 +00:00
Gus Caplan
59547cc438
loader: fix --inspect-brk
...
PR-URL: https://github.com/nodejs/node/pull/18949
Fixes: https://github.com/nodejs/node/issues/18948
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: Guy Bedford <guybedford@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-03-05 10:07:17 +00:00
Matteo Collina
ef8f90f34e
http2: fix condition where data is lost
...
PR-URL: https://github.com/nodejs/node/pull/18895
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2018-03-05 10:07:17 +00:00
Anna Henningsen
91694497ba
src: refactor WriteWrap and ShutdownWraps
...
Encapsulate stream requests more:
- `WriteWrap` and `ShutdownWrap` classes are now tailored to the
streams on which they are used. In particular, for most streams
these are now plain `AsyncWrap`s and do not carry the overhead
of unused libuv request data.
- Provide generic `Write()` and `Shutdown()` methods that wrap
around the actual implementations, and make *usage* of streams
easier, rather than implementing; for example, wrap objects
don’t need to be provided by callers anymore.
- Use `EmitAfterWrite()` and `EmitAfterShutdown()` handlers to
call the corresponding JS handlers, rather than always trying
to call them. This makes usage of streams by other C++ code
easier and leaner.
Also fix up some tests that were previously not actually testing
asynchronicity when the comments indicated that they would.
PR-URL: https://github.com/nodejs/node/pull/18676
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-02-27 17:56:01 +01:00
Anna Henningsen
fa691f7d95
src: only set JSStreamWrap write req after write()
...
Otherwise `this[kCurrentWriteRequest]` is set to a value even
if one of the `write` calls throws.
This is needed in order not to break tests in a later commit.
PR-URL: https://github.com/nodejs/node/pull/18676
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-02-27 17:56:00 +01:00
Mathias Buus
cfb78bc1df
process: use linked reusable queue for ticks
...
PR-URL: https://github.com/nodejs/node/pull/18617
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com >
Reviewed-By: Benedikt Meurer <benedikt.meurer@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
2018-02-27 17:55:58 +01:00
Anatoli Papirovski
b4c933dd44
promises: refactor rejection handling
...
Remove the unnecessary microTasksTickObject for scheduling microtasks
and instead use TickInfo to keep track of whether promise rejections
exist that need to be emitted. Consequently allow the microtasks to
execute on average fewer times, in more predictable manner than
previously.
Simplify unhandled & handled rejection tracking to do more in C++ to
avoid needing to expose additional info in JS.
When new unhandledRejections are emitted within an unhandledRejection
handler, allow the event loop to proceed first instead. This means
that if the end-user code handles all promise rejections on nextTick,
rejections within unhandledRejection now won't spiral into an infinite
loop.
PR-URL: https://github.com/nodejs/node/pull/18207
Fixes: https://github.com/nodejs/node/issues/17913
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2018-02-27 17:40:39 +01:00
Joyee Cheung
1246902bae
errors: move error creation helpers to errors.js
...
This commit moves error creation helpers scattered around
under lib/ into lib/internal/errors.js in the hope of being clearer
about the differences of errors that we throw into the user land.
- Move util._errnoException and util._exceptionWithHostPort
into internal/errors.js and simplify their logic so it's
clearer what the properties these helpers create.
- Move the errnoException helper in dns.js to internal/errors.js
into internal/errors.js and rename it to dnsException. Simplify
it's logic so it no longer calls errnoException and skips
the unnecessary argument checks.
Backport-PR-URL: https://github.com/nodejs/node/pull/18916
PR-URL: https://github.com/nodejs/node/pull/18546
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-02-26 18:39:49 -05:00
Joyee Cheung
8e31bf42cf
util: skip type checks in internal getSystemErrorName
...
Backport-PR-URL: https://github.com/nodejs/node/pull/18916
PR-URL: https://github.com/nodejs/node/pull/18546
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-02-26 18:39:49 -05:00