summaryrefslogtreecommitdiff
path: root/src/handle_wrap.cc
diff options
context:
space:
mode:
authorC. Scott Ananian <cscott@cscott.net>2014-03-06 15:44:18 -0500
committerTrevor Norris <trev.norris@gmail.com>2014-04-02 01:48:34 -0700
commit08a5b442e42ff67bd5666604eebe69f1b4a1c919 (patch)
treeef08abc6ccc5fd1e07494b5074cf8b560c89f3cf /src/handle_wrap.cc
parentd4fcb23e38e74d21e04b3a17d10e52949b630ec0 (diff)
downloadandroid-node-v8-08a5b442e42ff67bd5666604eebe69f1b4a1c919.tar.gz
android-node-v8-08a5b442e42ff67bd5666604eebe69f1b4a1c919.tar.bz2
android-node-v8-08a5b442e42ff67bd5666604eebe69f1b4a1c919.zip
node: add signature to SET_PROTOTYPE_METHOD
This prevents segfaults when a native method is reassigned to a different object (which corrupts args.This()). When unwrapping, clients should use args.Holder() instead of args.This(). Closes #6690. Signed-off-by: Trevor Norris <trev.norris@gmail.com>
Diffstat (limited to 'src/handle_wrap.cc')
-rw-r--r--src/handle_wrap.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/handle_wrap.cc b/src/handle_wrap.cc
index 245c0e10ad..f713750d7f 100644
--- a/src/handle_wrap.cc
+++ b/src/handle_wrap.cc
@@ -47,7 +47,7 @@ void HandleWrap::Ref(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
- HandleWrap* wrap = Unwrap<HandleWrap>(args.This());
+ HandleWrap* wrap = Unwrap<HandleWrap>(args.Holder());
if (wrap != NULL && wrap->handle__ != NULL) {
uv_ref(wrap->handle__);
@@ -60,7 +60,7 @@ void HandleWrap::Unref(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
- HandleWrap* wrap = Unwrap<HandleWrap>(args.This());
+ HandleWrap* wrap = Unwrap<HandleWrap>(args.Holder());
if (wrap != NULL && wrap->handle__ != NULL) {
uv_unref(wrap->handle__);
@@ -73,7 +73,7 @@ void HandleWrap::Close(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
- HandleWrap* wrap = Unwrap<HandleWrap>(args.This());
+ HandleWrap* wrap = Unwrap<HandleWrap>(args.Holder());
// guard against uninitialized handle or double close
if (wrap == NULL || wrap->handle__ == NULL)