Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v4.5.0 proposal #7688

Merged
merged 261 commits into from
Aug 16, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
261 commits
Select commit Hold shift + click to select a range
75ecf8e
async_wrap: add parent uid to init hook
AndreasMadsen Jan 20, 2016
6f312b3
http_parser: use `MakeCallback`
trevnorris Feb 19, 2016
63356df
src,http: fix uncaughtException miss in http
trevnorris Mar 4, 2016
ee70405
src,http_parser: remove KickNextTick call
trevnorris Mar 11, 2016
c3d87ee
src: reword command and add ternary
trevnorris Mar 23, 2016
0642a14
async_wrap: setupHooks now accepts object
trevnorris Feb 22, 2016
c06e2b0
async_wrap: notify post if intercepted exception
trevnorris Feb 23, 2016
747f107
async_wrap: don't abort on callback exception
trevnorris Mar 14, 2016
271927f
async_wrap: pass uid to JS as double
trevnorris Jun 1, 2016
c807287
tls,https: respect address family when connecting
bnoordhuis May 9, 2016
e3f9bc8
test: use strictEqual consistently in agent test
bnoordhuis May 28, 2016
74a5e91
debugger: propagate --debug-port= to debuggee
bnoordhuis Oct 21, 2015
efdeb69
test: work around debugger not killing inferior
bnoordhuis May 28, 2016
13d0e46
build: enable compilation for linuxOne
mhdawson Mar 28, 2016
9606f76
test: run v8 tests from node tree
exinfinitum Mar 28, 2015
9809992
deps: backport 9c927d0f01 from V8 upstream
MylesBorins Jun 28, 2016
4c423e6
tools: explicit path for V8 test tap output
Jun 28, 2016
7d66752
zlib: release callback and buffer after processing
mdlavin May 24, 2016
b9dfdfe
vm: don't abort process when stack space runs out
addaleax May 20, 2016
5782ec2
module: don't cache uninitialized builtins
addaleax May 20, 2016
d9e9d9f
deps: backport e7cc609 from upstream V8
ofrobots Jun 15, 2016
1164f54
deps: fix segfault during gc
ofrobots Jun 15, 2016
0b8124f
child_process: emit IPC messages on next tick
cjihrig May 20, 2016
c0a42bc
test: verify IPC messages are emitted on next tick
santigimeno May 21, 2016
f152adf
cluster: close ownerless handles on disconnect()
cjihrig May 23, 2016
72fb281
util: improve util.format performance
evanlucas Feb 22, 2016
d0bf09d
util: improve format() performance further
mscdex Feb 23, 2016
9aec1dd
test: test cluster worker disconnection on error
santigimeno May 23, 2016
8513232
build: split CI rules in Makefile
joaocgreis Jun 15, 2016
e06ab64
deps: update to http-parser 2.7.0
indutny Jun 8, 2016
07fd52e
http: skip body and next message of CONNECT res
indutny Apr 19, 2016
55f8689
test: add test for responses to HTTP CONNECT req
slushie Apr 19, 2016
fb03e57
buffer: backport --zero-fill-buffers cli option
jasnell Mar 16, 2016
c237ac3
doc: git mv to .md
eljefedelrodeodeljefe Jul 1, 2016
0bfedd1
win,build: add creation of zip and 7z package
bzoz Mar 24, 2016
e544b1c
test,win: skip addons/load-long-path on WOW64
orangemocha Jul 8, 2016
200429e
buffer: ignore negative allocation lengths
addaleax May 29, 2016
7090481
buffer: backport new buffer constructor APIs to v4.x
ChALkeR Jun 19, 2016
4107b5d
deps: backport 22c5e46 from V8
Jul 6, 2016
9121e94
doc: note that process.config can and will be changed
jasnell Apr 19, 2016
b9136c0
src: add process.binding('config')
jasnell Apr 19, 2016
06327e5
tls: use process.binding('config') to detect fips mode
jasnell Jul 5, 2016
94eb980
deps: upgrade libuv to 1.9.0
saghul Apr 1, 2016
da7b74b
deps: upgrade libuv to 1.9.1
saghul May 16, 2016
7779639
unix,stream: fix getting the correct fd for a handle
saghul May 18, 2016
b07c3a6
tty: use blocking mode on OS X
Fishrock123 May 20, 2016
a1719a9
udp: use libuv API to get file descriptor
saghul May 20, 2016
01b314d
test: test TTY problems by fakeing a TTY using openpty
Fishrock123 May 20, 2016
b21d145
src: add node::FreeEnvironment public API
zcbenz Sep 28, 2015
f0edf87
doc: add vm example, be able to require modules
eljefedelrodeodeljefe Apr 21, 2016
a3fa5db
repl: copying tabs shouldn't trigger completion
ghaiklor May 13, 2016
5380743
doc: document socket.destroyed
tusharmath Apr 9, 2016
39e2474
assert: allow circular references
Trott Apr 27, 2016
5f444ed
test: add tests for stream3 buffering using cork
alexjeffburke May 12, 2016
2259e5d
test: avoid test-cluster-master-* flakiness
stefanmb May 2, 2016
3aef9b8
test: unmark test-http-regr-gh-2928 as flaky
Trott May 3, 2016
7813af7
doc: Add resolveNaptr and naptr rrtype docs
doug-wade May 5, 2016
7c55f59
test: make stdout buffer test more robust
Trott May 7, 2016
af4b56d
test: pass python path to node-gyp
hefangshi May 9, 2016
350f4cf
doc: server.listen truncates socket path on unix
jeanregisser May 9, 2016
140b84d
tools: print stderr on bad test.py `vmArch` check
Fishrock123 May 16, 2016
65b75b5
build: unbreak configure with python 2.6
bnoordhuis May 19, 2016
373ffc5
installer: don't install node_internals.h
bnoordhuis May 21, 2016
9cccaa3
test: fix component printing on windows
bnoordhuis May 21, 2016
426aa0a
src: fix Windows segfault with `--eval`
May 23, 2016
4ee863d
child_process: allow buffer encoding in spawnSync
cjihrig May 23, 2016
ecf5c1c
test: refactor spawnSync() cwd test
cjihrig May 23, 2016
5b807ac
doc: specify how to link issues in commit log
lpinca Jun 5, 2016
629a76f
doc: remove cluster.setupMaster() myth
cjihrig Jun 6, 2016
ece428e
http: fix no dumping after `maybeReadMore`
indutny Jun 4, 2016
6324723
doc,dgram: fix addMembership documentation
santigimeno Jun 9, 2016
0a85987
doc: update build instructions for Windows
joaocgreis Jun 13, 2016
7d6acef
test: listen on and connect to 127.0.0.1
bnoordhuis Jul 2, 2016
08cd81b
benchmark: add util.format benchmark
evanlucas Feb 22, 2016
d1a0a14
doc: Add CTC meeting minutes for 2016-05-04
mhdawson May 4, 2016
2ef0832
doc: add bmeck to collaborators
bmeck May 25, 2016
c5051ef
doc: add firedfox to collaborators
firedfox May 24, 2016
8cba3b2
cluster: guard against undefined message handlers
cjihrig May 20, 2016
f395f6f
doc: add yorkie to collaborators
yorkie May 26, 2016
8c412af
test: verify cluster worker exit
cjihrig May 26, 2016
e2e85ce
doc: clarified use of sexual language in the CoC
nebrius May 25, 2016
649d201
doc: improve `server.address()` doc text
Trott May 26, 2016
72e8ee5
doc: improve server.listen() documentation prose
Trott May 26, 2016
1c65f1e
doc: add info on what's used for fswatch on AIX
mhdawson May 18, 2016
cde3014
test: remove modifcation to common.PORT
Trott May 26, 2016
fbdc16a
doc: update labels and CI info in onboarding doc
Trott May 26, 2016
694e344
doc: fix typos in WORKING_GROUPS.md
joaosa May 28, 2016
146cba1
doc: improve debugger doc prose
Trott May 26, 2016
644bfe1
test: fix test-debug-port-numbers on OS X
santigimeno May 29, 2016
15bb0be
doc,test: add `How to write a Node.js test` guide
santigimeno May 26, 2016
44228df
test: remove `common.PORT` from gc tests
Trott May 27, 2016
6ece2a0
cluster: rewrite debug ports consistently
cjihrig May 29, 2016
5b1f546
test: remove non-incremental common.PORT changes
Trott May 29, 2016
96de3f8
doc: Add CII Best Practices badge to README.md
david-a-wheeler May 17, 2016
77325d5
test: remove disabled eio race test
Trott May 31, 2016
1bd62c7
benchmark: add benchmark for Buffer.concat
addaleax May 29, 2016
0013af6
doc: fix header depth of util.isSymbol
jasnell Jun 3, 2016
2a59e4e
test: improve debug-break-on-uncaught reliability
Trott May 16, 2016
8eb18e4
child_process: measure buffer length in bytes
Trott May 14, 2016
9d13337
http: wait for both prefinish/end to keepalive
indutny Jun 4, 2016
042e858
test: make test-child-process-fork-net more robust
Trott May 28, 2016
8724c44
test: add test for uid/gid setting in spawn
Trott May 31, 2016
c9ef04a
doc: fix events typo
greysonp Jun 17, 2016
ef37a2e
doc: add internal link in GOVERNANCE.md
Trott Jun 12, 2016
96ed883
test: enable test-debug-brk-no-arg
Trott Jun 3, 2016
65b5ccc
test: fix spawn on windows
mscdex May 29, 2016
57ba51e
doc: fix IRC link
imyller Jun 8, 2016
85f70b3
doc: clarify use of `0` port value
Trott Jun 7, 2016
4a7e333
doc: use `Buffer.byteLength` for Content-Length
kimown Jun 12, 2016
7182f5f
tools: fix license builder to work with icu-small
Jun 3, 2016
b95e5d7
benchmark: add benchmark for url.format()
Trott Jun 9, 2016
79b4588
test: add tests for some stream.Readable uses
addaleax Jun 10, 2016
3be5cdc
debugger: remove obsolete setTimeout
Trott Jun 4, 2016
f8fe474
doc: fixing minor typo in AtExit hooks section
danbev Jun 29, 2016
5129f3f
test: mark test-vm-timeout flaky on windows
Trott Jun 22, 2016
868af29
doc: add RReverser to collaborators
RReverser Jun 22, 2016
ccb278d
doc: mention http request "aborted" events
kemitchell Jun 10, 2016
9122b3b
doc: update "who to cc in issues" chart
Fishrock123 May 11, 2016
13d60ca
doc: add lance to collaborators
lance Jun 24, 2016
71ef71c
doc: add CTC meeting minutes 2016-06-15
joshgav Jun 16, 2016
c8e9adb
repl: fix tab completion for defined commands
princejwesley Jun 22, 2016
35ee35c
doc: clarify child_process stdout/stderr types
sartrey Jun 22, 2016
6c94c67
doc: fix "sign.verify" typo in crypto doc.
rus0000 Jun 24, 2016
a488892
assert: remove unneeded arguments special handling
Trott Jun 24, 2016
066cefb
doc: improve usage of `zero`/`0`
Trott Jun 28, 2016
8273824
test: remove common.PORT from http tests
Trott Jun 29, 2016
186af29
doc: fix detached child stdio example
cjihrig Jul 5, 2016
33a08b0
doc: add bartosz sosnowski to colaborators
bzoz Jul 6, 2016
537f333
doc: fix minor style issues in http.md
Trott Jul 4, 2016
db35efa
test: fix flaky test-net-write-slow
Trott Jul 6, 2016
700c6d9
doc: added information on how to run the linter.
diosney Jul 4, 2016
0f903bb
doc: add benchmark who-to-CC info
Trott Jul 8, 2016
de5e235
doc: dns.resolve fix callback argument description
qheaden Jul 4, 2016
242d6c7
tools: remove unused variable
Trott Jul 7, 2016
b5e516a
test: remove unused var in test-tls-server-verify
Trott Jul 7, 2016
4d36a67
test: remove unused var from child-process-fork
Trott Jul 7, 2016
7bd7c23
test: remove unused var from stream2 test
Trott Jul 7, 2016
3241536
test: remove unused var in net-server-try-ports
Trott Jul 7, 2016
4b464ce
benchmark: remove unused variables
Trott Jul 7, 2016
1d100f6
test: remove unused vars from http/https tests
Trott Jul 7, 2016
d7ce992
tools: update ESLint, fix unused vars bug
Trott Jul 7, 2016
f0b0fc4
test: update weak module for gc tests
Trott May 27, 2016
e3097b7
test: test isFullWidthCodePoint with invalid input
Trott Jun 25, 2016
75e4f74
doc: fix cluster worker 'message' event
cjihrig Jun 15, 2016
9c31c73
src: remove unused #include statement
bnoordhuis May 4, 2016
2b0dce5
src: don't use locale-sensitive strcasecmp()
bnoordhuis May 4, 2016
efadf76
tools: update certdata.txt
bnoordhuis Jun 22, 2016
1e0cede
crypto: update root certificates
bnoordhuis Jun 22, 2016
1baa145
test: remove internet/test-tls-connnect-cnnic
bnoordhuis Jun 23, 2016
c03bd57
src: check uv_async_init() return value
bnoordhuis Jun 22, 2016
67937bc
src: guard against starting fs watcher twice
bnoordhuis Jun 22, 2016
e103044
src: remove unused data member write_queue_size_
bnoordhuis Jun 22, 2016
38baf6a
src: remove unused md_ data members
bnoordhuis Jun 22, 2016
7305e7b
src: remove duplicate HMAC_Init calls
bnoordhuis Jun 22, 2016
61de6e9
src: remove deprecated HMAC_Init, use HMAC_Init_ex
bnoordhuis Jun 22, 2016
e6a27a7
src: fix use-after-return in zlib bindings
bnoordhuis Jun 22, 2016
53a67ed
src: fix bad logic in uid/gid checks
bnoordhuis Jun 22, 2016
b956635
tls: catch `certCbDone` exceptions
indutny May 20, 2016
79bd39c
build: add v8 requirement to test-v8* in Makefile
targos Jun 29, 2016
5290c9d
build: use BUILDTYPE when building V8 in Makefile
targos Jun 30, 2016
a31d316
test: add test for exec() known issue
Trott Jun 22, 2016
fd05b0b
Revert "child_process: measure buffer length in bytes"
Trott Jun 22, 2016
6a08535
child_process: preserve argument type
Trott Jun 23, 2016
09349a8
cluster: don't send messages if no IPC channel
santigimeno May 31, 2016
20d3378
cluster: reset handle index on close
santigimeno May 25, 2016
7dbb0d0
buffer: fix dataview-set benchmark
RReverser May 22, 2016
8557597
vm: don't print out arrow message for custom error
addaleax Jun 24, 2016
db2b23f
src: fix sporadic deadlock in SIGUSR1 handler
bnoordhuis Mar 25, 2016
dda81b4
src: unify implementations of Utf8Value etc.
addaleax Apr 23, 2016
391fc80
tools: update cpplint to r456
bnoordhuis Jun 28, 2016
e74f199
tools: disable unwanted cpplint rules again
bnoordhuis Jun 28, 2016
09e98a4
tools: add back --mode=tap to cpplint
bnoordhuis Jun 28, 2016
4a2bd2d
tools: allow cpplint to run outside git repo
bnoordhuis Jun 28, 2016
ccc701e
src: fix build/c++tr1 cpplint warnings
bnoordhuis Jun 28, 2016
c8f78a2
src: fix build/header_guard cpplint warnings
bnoordhuis Jun 28, 2016
16f2497
src: fix readability/braces cpplint warnings
bnoordhuis Jun 28, 2016
c90ae7f
src: fix readability/constructors cpplint warnings
bnoordhuis Jun 28, 2016
7852117
src: fix readability/inheritance cpplint warnings
bnoordhuis Jun 28, 2016
4748bed
src: fix readability/namespace cpplint warnings
bnoordhuis Jun 28, 2016
68db091
src: fix readability/nolint cpplint warnings
bnoordhuis Jun 28, 2016
d6595ad
src: fix runtime/indentation_namespace warnings
bnoordhuis Jun 28, 2016
f530a36
src: fix runtime/int cpplint warnings
bnoordhuis Jun 28, 2016
44cbe03
src: fix runtime/references cpplint warnings
bnoordhuis Jun 28, 2016
066064d
src: fix whitespace/blank_line cpplint warnings
bnoordhuis Jun 28, 2016
4f4d3e7
src: fix whitespace/indent cpplint warnings
bnoordhuis Jun 28, 2016
0db3aa9
build: remove unused files from CPPLINT_FILES
bnoordhuis Jun 28, 2016
27c2d25
src: lint node_win32_perfctr_provider.cc
bnoordhuis Jun 28, 2016
42e7c9d
src: lint node_lttng_tp.h
bnoordhuis Jun 28, 2016
5aff60e
src: lint v8abbr.h
bnoordhuis Jun 28, 2016
68e9fd4
tools: fix -Wunused-variable warning
bnoordhuis Jun 28, 2016
23797eb
src: remove obsolete NOLINT comments
bnoordhuis Jun 28, 2016
3eea551
src: fix memory leak in WriteBuffers() error path
bnoordhuis Jun 22, 2016
eab9ced
test: fix flaky test-vm-timeout
addaleax Jun 22, 2016
8404e34
Revert "test: mark test-vm-timeout flaky on windows"
addaleax Jun 22, 2016
e52b2b0
doc: add `added:` information for assert
Trott May 11, 2016
ec90384
doc: add `added:` information for child_process
addaleax May 23, 2016
eb08c17
doc: add `added: ` data for cli.md
Trott May 25, 2016
a0ca24b
doc: add `added:` information for console
edsadr May 26, 2016
1d99059
doc: add `added:` information for dns
julianduque May 27, 2016
b08ff33
doc: add `added:` information for https
addaleax Jun 23, 2016
78d361b
doc: add `added` information for net
italoacasas Jun 3, 2016
8b53f4b
doc: add `added:` information for os
bengl May 6, 2016
f1a37ad
doc: add `added:` information for path
julianduque May 26, 2016
a870cdc
doc: add `added:` information for punycode
firedfox May 17, 2016
eec0c63
doc: add `added:` information for querystring
bengl May 5, 2016
e6d7bfc
doc: add `added:` information for readline
julianduque May 26, 2016
4474e83
doc: add `added:` information for repl
addaleax Jun 10, 2016
5b50b1c
doc: add `added:` info for `string_decoder`
Trott May 13, 2016
3c8f19f
doc: add `added:` in for `tty`
Trott May 16, 2016
1758f02
doc: add `added:` information for url
bengl May 5, 2016
3e3471f
doc: add `added:` information for v8
Trott May 11, 2016
7abfb6e
doc: add `added:` information for vm
addaleax May 27, 2016
a53253a
doc: add `added:` information for zlib
addaleax May 18, 2016
88f46b8
doc: add `added:` information for timers
addaleax Jun 30, 2016
2244a3c
doc: adds 'close' events to fs.ReadStream and fs.WriteStream
May 1, 2016
1e9d27c
doc: add `added:` information for fs
addaleax May 12, 2016
fd4aa6c
doc: correct `added:` information for fs.access
richardlau Jun 14, 2016
9b8565c
doc: add `added:` information for tls
italoacasas May 27, 2016
fcb4e41
doc: add `added:` information for process
bengl May 5, 2016
1a5c025
doc: remove superfluos backticks in process.md
addaleax Jul 12, 2016
60c054b
doc: add information for IncomingMessage.destroy()
Trott Jun 8, 2016
5c1d8e1
doc: add `added:` information for http
addaleax Jun 23, 2016
1e86d16
doc: buffers are not sent over IPC with a socket
Jul 12, 2016
ec25f38
doc: add `added:` information for buffer
addaleax May 1, 2016
0149cb0
tools: add mock-y js-yaml dependency to doctool
addaleax May 1, 2016
2832a60
tools: parse documentation metadata
tflanagan Nov 14, 2015
8f76d7d
test,tools: test yaml parsing of doctool
addaleax Apr 30, 2016
ea13763
tools: allow multiple added: version entries
addaleax Apr 30, 2016
96b5aa8
tools: update marked dependency
firedfox Apr 25, 2016
8b88c38
tools: lint for object literal spacing
Trott May 5, 2016
686d7b3
test: build addons with V8_DEPRECATION_WARNINGS=1
bnoordhuis May 9, 2016
b869cdb
doc: fix deprecation warnings in addon examples
bnoordhuis May 9, 2016
ea20796
build,test: fix build-addons dependency chain
bnoordhuis May 9, 2016
ed193ad
tools: fix tools/doc/addon-verify.js regression
addaleax May 9, 2016
da1e13f
build: add Make `doc-only` target
jmm Nov 18, 2015
607173b
tools: fix regression in doctool
May 10, 2016
3681b9b
test: refactor doctool tests
Trott May 12, 2016
f9f85a0
tools: restore change of signatures to opts hashes
jmm May 10, 2016
9ef6e23
tools: make sure doctool anchors respect includes
addaleax May 23, 2016
d50f169
tools,doc: add example usage for REPLACEME tag
addaleax May 19, 2016
8a7c5fd
build: add REPLACEME tag for version info in docs
bnoordhuis May 13, 2016
223c0e2
test: skip doctool tests when js-yaml is missing
addaleax Jun 8, 2016
e9ff0f8
doc: make doc-only -> fallback to user binary
eljefedelrodeodeljefe May 20, 2016
6562444
crypto: allow GCM ciphers to have longer IV length
mwain Apr 25, 2016
d863327
src: clean up string_search
mscdex Jul 12, 2016
af4940d
deps: upgrade npm in LTS to 2.15.9
zkat Jul 12, 2016
9a8acad
test: use random ports where possible
mscdex May 29, 2016
236491e
build: update build-addons when node-gyp changes
lance May 16, 2016
046d651
benchmark: fix child-process-exec-stdout on win
bzoz May 31, 2016
50577fa
2016-08-15, Version 4.5.0 'Argon' (LTS)
Jul 12, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
async_wrap: notify post if intercepted exception
The second argument of the post callback is a boolean indicating whether
the callback threw and was intercepted by uncaughtException or a domain.

Currently node::MakeCallback has no way of retrieving a uid for the
object. This is coming in a future patch.

Ref: #7048
PR-URL: #5756
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Andreas Madsen <amwebdk@gmail.com>
  • Loading branch information
trevnorris authored and Myles Borins committed Jul 12, 2016
commit c06e2b07b6ed170ac771850afc5379618dded30d
5 changes: 4 additions & 1 deletion src/async-wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "v8-profiler.h"

using v8::Array;
using v8::Boolean;
using v8::Context;
using v8::Function;
using v8::FunctionCallbackInfo;
Expand Down Expand Up @@ -231,7 +232,9 @@ Local<Value> AsyncWrap::MakeCallback(const Local<Function> cb,
Local<Value> ret = cb->Call(context, argc, argv);

if (ran_init_callback() && !post_fn.IsEmpty()) {
if (post_fn->Call(context, 1, &uid).IsEmpty())
Local<Value> did_throw = Boolean::New(env()->isolate(), ret.IsEmpty());
Local<Value> vals[] = { uid, did_throw };
if (post_fn->Call(context, arraysize(vals), vals).IsEmpty())
FatalError("node::AsyncWrap::MakeCallback", "post hook threw");
}

Expand Down
7 changes: 6 additions & 1 deletion src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1172,7 +1172,12 @@ Local<Value> MakeCallback(Environment* env,
Local<Value> ret = callback->Call(recv, argc, argv);

if (ran_init_callback && !post_fn.IsEmpty()) {
if (post_fn->Call(object, 0, nullptr).IsEmpty())
Local<Value> did_throw = Boolean::New(env->isolate(), ret.IsEmpty());
// Currently there's no way to retrieve an uid from node::MakeCallback().
// This needs to be fixed.
Local<Value> vals[] =
{ Undefined(env->isolate()).As<Value>(), did_throw };
if (post_fn->Call(object, arraysize(vals), vals).IsEmpty())
FatalError("node::MakeCallback", "post hook threw");
}

Expand Down
34 changes: 34 additions & 0 deletions test/parallel/test-async-wrap-post-did-throw.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
'use strict';

require('../common');
const assert = require('assert');
const async_wrap = process.binding('async_wrap');
var asyncThrows = 0;
var uncaughtExceptionCount = 0;

process.on('uncaughtException', (e) => {
assert.equal(e.message, 'oh noes!', 'error messages do not match');
});

process.on('exit', () => {
process.removeAllListeners('uncaughtException');
assert.equal(uncaughtExceptionCount, 1);
assert.equal(uncaughtExceptionCount, asyncThrows);
});

function init() { }
function post(id, threw) {
if (threw)
uncaughtExceptionCount++;
}

async_wrap.setupHooks({ init, post });
async_wrap.enable();

// Timers still aren't supported, so use crypto API.
// It's also important that the callback not happen in a nextTick, like many
// error events in core.
require('crypto').randomBytes(0, () => {
asyncThrows++;
throw new Error('oh noes!');
});