node_contextify: do not incept debug context
authorMyles Borins <mborins@us.ibm.com>
Mon, 1 Feb 2016 19:13:31 +0000 (11:13 -0800)
committerMyles Borins <mborins@us.ibm.com>
Mon, 15 Feb 2016 19:30:23 +0000 (11:30 -0800)
commit1b070e48e02c375bc9378881a8c3b561852b93bf
tree0218c598b446dbc41db71a7bb62118677992b731
parentf205e9920eb494fb5f7bb84c9f781ff06540acb2
node_contextify: do not incept debug context

Currently a debug context is created for various calls to util.

If the node debugger is being run the main context is the debug
context. In this case node_contextify was freeing the debug context
and causing everything to explode.

This change moves around the logic and no longer frees the context.

There is a concern about the dangling pointer

The regression test was adapted from code submitted by @3y3 in #4815

Fixes: https://github.com/nodejs/node/issues/4440
Fixes: https://github.com/nodejs/node/issues/4815
Fixes: https://github.com/nodejs/node/issues/4597
Fixes: https://github.com/nodejs/node/issues/4952
PR-URL: https://github.com/nodejs/node/issues/4815

Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Rich Trott <rtrott@gmail.com>
src/node_contextify.cc
test/fixtures/debugger-util-regression-fixture.js [new file with mode: 0644]
test/parallel/test-debugger-util-regression.js [new file with mode: 0644]