Yoshiki
69f487efc7
lib: fix typos in lib code comments
...
PR-URL: https://github.com/nodejs/node/pull/40792
Reviewed-By: Voltrex <mohammadkeyvanzade94@gmail.com >
Reviewed-By: Qingyu Deng <i@ayase-lab.com >
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2021-11-12 23:26:20 +01:00
wwwzbwcom
4a31ea0367
events: fix duplicate require which cause performance penalty
...
PR-URL: https://github.com/nodejs/node/pull/39892
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Nitzan Uziely <linkgoron@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Darshan Sen <raisinten@gmail.com >
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com >
Reviewed-By: Qingyu Deng <i@ayase-lab.com >
2021-09-15 09:44:59 +00:00
Voltrex
5ce015ec72
typings: add JSDoc typings for events
...
Added JSDoc typings for the `events` lib module.
PR-URL: https://github.com/nodejs/node/pull/38712
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Masashi Hirano <shisama07@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-05-21 14:18:28 -07:00
Akhil Marsonya
13ec3176ac
events: refactor to use primordials in lib/events
...
Replace code that's vulnerable to Prototype Pollution with Primordials.
PR-URL: https://github.com/nodejs/node/pull/38117
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Darshan Sen <raisinten@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-05-21 12:55:43 -07:00
Rongjian Zhang
5d7b6c2497
lib: refactor to reuse validators
...
PR-URL: https://github.com/nodejs/node/pull/38608
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-05-19 09:22:56 -07:00
Voltrex
6e6663b8a4
events: use nullish coalencing operator
...
PR-URL: https://github.com/nodejs/node/pull/38328
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2021-05-17 12:26:29 -07:00
Antoine du Hamel
ee9e2a2eb6
lib: revert primordials in a hot path
...
Evidence has shown that use of primordials have sometimes an impact of
performance. This commit reverts the changes who are most likely to be
responsible for performance regression in the HTTP response path.
PR-URL: https://github.com/nodejs/node/pull/38248
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2021-04-19 10:23:01 +02:00
James M Snell
886516a14c
lib: use AbortError consistently
...
Signed-off-by: James M Snell <jasnell@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/37715
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2021-03-13 11:17:48 -08:00
Antoine du Hamel
f34d8de65a
lib: remove use of array destructuring
...
PR-URL: https://github.com/nodejs/node/pull/36818
Reviewed-By: Rich Trott <rtrott@gmail.com >
2021-03-03 19:53:24 +01:00
Benjamin Gruenbaum
5ef4c64e5b
lib: add weak event handlers
...
PR-URL: https://github.com/nodejs/node/pull/36607
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
2021-02-06 19:01:53 +02:00
ZiJian Liu
064a7070c7
lib: refactor to use validateFunction
...
add validateFunction and refactor to use validateFunction
PR-URL: https://github.com/nodejs/node/pull/37045
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Darshan Sen <raisinten@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-01-27 20:46:54 +02:00
ZiJian Liu
06c46934c1
events: remove error listener on signal abort
...
Fixes: https://github.com/nodejs/node/issues/36949
PR-URL: https://github.com/nodejs/node/pull/36969
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2021-01-18 10:53:03 -08:00
ZiJian Liu
eb8422c022
events: refactor to use optional chaining
...
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/36763
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2021-01-11 11:38:54 +01:00
Antoine du Hamel
997f2fcbbc
events: refactor to use more primordials
...
PR-URL: https://github.com/nodejs/node/pull/36304
Reviewed-By: Rich Trott <rtrott@gmail.com >
2020-12-25 18:10:56 +00:00
James M Snell
dc79f3f37c
events: add max listener warning for EventTarget
...
Signed-off-by: James M Snell <jasnell@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/36001
Fixes: https://github.com/nodejs/node/issues/35990
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2020-11-16 09:48:18 +00:00
Benjamin Gruenbaum
1a6d4dce6d
events: getEventListeners static
...
PR-URL: https://github.com/nodejs/node/pull/35991
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2020-11-09 07:39:31 +00:00
Antoine du Hamel
1da672994a
lib: use primordials when calling methods of Error
...
This is to unsure that code using those methods won't crash if the
methods are deleted in userland.
PR-URL: https://github.com/nodejs/node/pull/35837
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Shingo Inoue <leko.noor@gmail.com >
2020-10-30 11:08:20 +00:00
Sebastien Ahkrin
b79829c5f5
lib: replace String global with primordials
...
PR-URL: https://github.com/nodejs/node/pull/35397
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Jiawen Geng <technicalcute@gmail.com >
Reviewed-By: Pranshu Srivastava <rexagod@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com >
Reviewed-By: Ujjwal Sharma <ryzokuken@disroot.org >
2020-10-04 09:40:56 +02:00
Denys Otrishko
b1831fed3a
events: simplify event target agnostic logic in on and once
...
PR-URL: https://github.com/nodejs/node/pull/34997
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com >
2020-09-11 18:04:40 +03:00
James M Snell
df1023bb22
events: allow use of AbortController with on
...
Signed-off-by: James M Snell <jasnell@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/34912
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Denys Otrishko <shishugi@gmail.com >
2020-09-02 07:53:47 -07:00
James M Snell
883fc779b6
events: allow use of AbortController with once
...
Allows an AbortSignal to be passed in to events.once() to cancel
waiting on an event.
Signed-off-by: James M Snell <jasnell@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/34911
Reviewed-By: Denys Otrishko <shishugi@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2020-08-31 15:09:57 +00:00
Benjamin Gruenbaum
4b3654e923
events: fix EventTarget support
...
Remove support for multiple arguments (which don't actually work for
EventTarget). Use our EventTarget implementation rather than a mock.
Refactor `once` code in preparation of `on` using shared code for
supporting `on` with `EventTarget`s.
Support EventTarget in the `events.on` static method
PR-URL: https://github.com/nodejs/node/pull/34015
Reviewed-By: Denys Otrishko <shishugi@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2020-06-23 17:08:09 -07:00
Brian White
a4f3206b76
events: improve listeners() performance
...
PR-URL: https://github.com/nodejs/node/pull/33863
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com >
2020-06-17 12:12:49 -07:00
Brian White
4ba90809ed
events: improve arrayClone performance
...
PR-URL: https://github.com/nodejs/node/pull/33774
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Zeyu Yang <himself65@outlook.com >
2020-06-08 15:21:13 -04:00
fuxingZhang
c45f881b92
events: variable originalListener is useless
...
PR-URL: https://github.com/nodejs/node/pull/33596
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2020-05-30 10:22:00 -07:00
Luigi Pinca
b533fb3508
tools: enable no-else-return lint rule
...
Refs: https://github.com/nodejs/node/pull/32644
Refs: https://github.com/nodejs/node/pull/32662
PR-URL: https://github.com/nodejs/node/pull/32667
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
2020-05-16 06:42:16 +02:00
zfx
1b3dbc9635
events: fix removeListener for Symbols
...
Fix removeListener when eventName type is 'symbol'.
```js
const EventEmitter = require('events');
const myEmitter = new EventEmitter();
const sym = Symbol('symbol');
const fn = () => { };
myEmitter.on(sym, fn);
myEmitter.on('removeListener', (...args) => {
console.log('removeListener');
console.log(args, args[0] === sym, args[1] === fn);
});
myEmitter.removeAllListeners()
```
When the listener's eventName type is 'symbol' and removeListener is
called with no parameters, removeListener should be emitted.
PR-URL: https://github.com/nodejs/node/pull/31847
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Shelley Vohr <codebytere@gmail.com >
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2020-03-07 10:47:12 -08:00
Gerhard Stoebich
ed8007af0b
events: convert errorMonitor to a normal property
...
Convert property errorMonitor to a normal property as non-writable
caused unwanted side effects.
Refs: https://github.com/nodejs/node/pull/30932#discussion_r379679982
PR-URL: https://github.com/nodejs/node/pull/31848
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matheus Marchini <mat@mmarchini.me >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2020-03-02 14:04:50 -08:00
Sebastien Ahkrin
c9b93e2344
lib: replace use of Error with primordials
...
PR-URL: https://github.com/nodejs/node/pull/31163
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: David Carlier <devnexen@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
2020-01-04 14:50:18 -08:00
Matteo Collina
38a593b0f3
events: add EventEmitter.on to async iterate over events
...
Fixes: https://github.com/nodejs/node/issues/27847
PR-URL: https://github.com/nodejs/node/pull/27994
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2019-12-23 09:29:01 +01:00
David Newman
312f3086c2
lib: improve spelling and grammar in comment
...
PR-URL: https://github.com/nodejs/node/pull/31026
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
2019-12-21 21:29:32 -08:00
Gerhard Stoebich
fcd4c2e37d
events: allow monitoring error events
...
Installing an error listener has a side effect that emitted errors are
considered as handled. This is quite bad for monitoring/logging tools
which tend to be interested in errors but don't want to cause side
effects like swallow an exception.
There are some workarounds in the wild like monkey patching emit or
remit the error if monitoring tool detects that it is the only listener
but this is error prone and risky.
This PR allows to install a listener to monitor errors with the side
effect to consume the error. To avoid conflicts with other events it
exports a symbol on EventEmitter which owns this special meaning.
Refs: https://github.com/open-telemetry/opentelemetry-js/issues/225
PR-URL: https://github.com/nodejs/node/pull/30932
Refs: https://github.com/open-telemetry/opentelemetry-js/issues/225
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-12-20 01:42:51 +01:00
Michaël Zasso
7e5bf80fd1
lib: enforce use of Promise from primordials
...
PR-URL: https://github.com/nodejs/node/pull/30936
Refs: https://github.com/nodejs/node/issues/30697
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: David Carlier <devnexen@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2019-12-16 08:40:14 +01:00
Sebastien Ahkrin
11465d3b0e
lib: replace every Symbol.for by SymbolFor primordials
...
PR-URL: https://github.com/nodejs/node/pull/30857
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
2019-12-11 11:02:13 +01:00
jens-cappelle
f393d66881
lib: replace var with let/const
...
PR-URL: https://github.com/nodejs/node/pull/30384
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: Beth Griggs <Bethany.Griggs@uk.ibm.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2019-12-10 01:43:53 +01:00
Sebastien Ahkrin
eac3f0adc4
lib: replace Symbol global by the primordials Symbol
...
PR-URL: https://github.com/nodejs/node/pull/30737
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2019-12-08 13:38:58 +01:00
Matteo Collina
ae8f20ec5e
events: add captureRejection option
...
PR-URL: https://github.com/nodejs/node/pull/27867
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2019-12-03 12:14:46 +01:00
Michaël Zasso
1f9a5ae7aa
lib: use static Number properties from primordials
...
PR-URL: https://github.com/nodejs/node/pull/30686
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2019-11-30 13:45:38 +01:00
Michaël Zasso
141a6e34ee
lib: enforce use of Array from primordials
...
PR-URL: https://github.com/nodejs/node/pull/30635
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2019-11-27 19:29:01 +01:00
jens-cappelle
03bb272c5a
lib: replace var with let/const
...
PR-URL: https://github.com/nodejs/node/pull/30391
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
2019-11-26 19:07:59 +05:30
Michaël Zasso
0646eda4fc
lib: flatten access to primordials
...
Store all primordials as properties of the primordials object.
Static functions are prefixed by the constructor's name and prototype
methods are prefixed by the constructor's name followed by "Prototype".
For example: primordials.Object.keys becomes primordials.ObjectKeys.
PR-URL: https://github.com/nodejs/node/pull/30610
Refs: https://github.com/nodejs/node/issues/29766
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
2019-11-25 10:28:15 +01:00
guzhizhou
e5cbbe05ef
events: improve performance caused by primordials
...
PR-URL: https://github.com/nodejs/node/pull/30577
Refs: https://github.com/nodejs/code-and-learn/issues/97
Refs: https://github.com/nodejs/node/issues/29766
Refs: https://github.com/nodejs/node/pull/29633
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com >
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
2019-11-22 19:39:40 -08:00
Matteo Collina
c5f5f84a33
events: improve performance of EventEmitter.emit
...
This restore some performance we lost when we introduced primordialias.
Improvements are up to +100%.
PR-URL: https://github.com/nodejs/node/pull/29633
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: David Carlier <devnexen@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2019-09-24 09:12:59 +02:00
Jenia
34a61d5630
events: add support for EventTarget in once
...
PR-URL: https://github.com/nodejs/node/pull/29498
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Minwoo Jung <minwoo@nodesource.com >
2019-09-22 17:48:21 -07:00
Brian White
5ba3a2c4b6
events: improve once() performance
...
PR-URL: https://github.com/nodejs/node/pull/29307
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com >
2019-08-27 20:06:09 +08:00
Anna Henningsen
4c9fb0b706
events: give subclass name in unhandled 'error' message
...
For unhandled `'error'` events, include the constructor name for
subclasses of EventEmitter, if possible. This makes tracing errors
easier when both creation of the `Error` object and emitting it
happen in code that does not refer back to the event emitter.
PR-URL: https://github.com/nodejs/node/pull/28952
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-08-06 19:28:12 -07:00
Joyee Cheung
94454927f6
process: split routines used to enhance fatal exception stack traces
...
Previously the enhancement were done right after emitting
`'uncaughtException'`, which meant by the time we knew the
exception was fatal in C++, the error.stack had already been
patched.
This patch moves those routines to be called later during the
fatal exception handling, and split them into two stages:
before and after the inspector is notified by the invocation of
`V8Inspector::exceptionThrown`. We now expand the stack to include
additional informations about unhandled 'error' events before
the inspector is notified, but delay the highlighting of the
frames until after the inspector is notified, so that the
ANSI escape sequences won't show up in the inspector console.
PR-URL: https://github.com/nodejs/node/pull/28308
Fixes: https://github.com/nodejs/node/issues/28287
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2019-06-27 20:22:08 +08:00
Ruben Bridgewater
9375088bd3
events: improve max listeners warning
...
This adds the constructor name of the event target to the emitted
warning. Right now it's difficult to identify where the leak is
actually coming from and having some further information about the
source will likely help to identify the source.
PR-URL: https://github.com/nodejs/node/pull/27694
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2019-05-17 05:39:00 +02:00
Michaël Zasso
908292cf1f
lib: enforce the use of Object from primordials
...
PR-URL: https://github.com/nodejs/node/pull/27146
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
2019-04-12 05:38:45 +02:00
Michaël Zasso
0817840f77
lib: force using primordials for JSON, Math and Reflect
...
Use the "no-restricted-globals" ESLint rule to lint for it.
PR-URL: https://github.com/nodejs/node/pull/27027
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2019-04-03 21:36:08 +08:00