summaryrefslogtreecommitdiff
path: root/src/cares_wrap.cc
diff options
context:
space:
mode:
authorTrevor Norris <trev.norris@gmail.com>2015-09-30 15:55:06 -0600
committerTrevor Norris <trev.norris@gmail.com>2015-10-01 13:56:25 -0600
commit3f476ada1eb581d849fc189aa9643054cebbb683 (patch)
tree00fe4be78e5415fe03aea0c52b747af7a13944c3 /src/cares_wrap.cc
parente52864b4b8b05fb91b77f22d24a8a4a05c6f43a0 (diff)
downloadnode-new-3f476ada1eb581d849fc189aa9643054cebbb683.tar.gz
async_wrap: ensure all objects have internal field
If the constructor can't assign a class id then the heap snapshot will not be able to report the object. So ensure that all AsyncWrap instances use a FunctionTemplate instance with an internal field count >= 1. PR-URL: https://github.com/nodejs/node/pull/3139 Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-by: Stephen Belanger <admin@stephenbelanger.com>
Diffstat (limited to 'src/cares_wrap.cc')
-rw-r--r--src/cares_wrap.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/cares_wrap.cc b/src/cares_wrap.cc
index b3181da135..b004e67c4e 100644
--- a/src/cares_wrap.cc
+++ b/src/cares_wrap.cc
@@ -85,6 +85,11 @@ static void NewGetNameInfoReqWrap(const FunctionCallbackInfo<Value>& args) {
}
+static void NewQueryReqWrap(const FunctionCallbackInfo<Value>& args) {
+ CHECK(args.IsConstructCall());
+}
+
+
static int cmp_ares_tasks(const ares_task_t* a, const ares_task_t* b) {
if (a->sock < b->sock)
return -1;
@@ -1312,6 +1317,14 @@ static void Initialize(Local<Object> target,
FIXED_ONE_BYTE_STRING(env->isolate(), "GetNameInfoReqWrap"));
target->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "GetNameInfoReqWrap"),
niw->GetFunction());
+
+ Local<FunctionTemplate> qrw =
+ FunctionTemplate::New(env->isolate(), NewQueryReqWrap);
+ qrw->InstanceTemplate()->SetInternalFieldCount(1);
+ qrw->SetClassName(
+ FIXED_ONE_BYTE_STRING(env->isolate(), "QueryReqWrap"));
+ target->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "QueryReqWrap"),
+ qrw->GetFunction());
}
} // namespace cares_wrap