Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorC. Scott Ananian <cscott@cscott.net>2014-03-07 00:44:18 +0400
committerTrevor Norris <trev.norris@gmail.com>2014-04-02 12:48:34 +0400
commit08a5b442e42ff67bd5666604eebe69f1b4a1c919 (patch)
treeef08abc6ccc5fd1e07494b5074cf8b560c89f3cf /src/timer_wrap.cc
parentd4fcb23e38e74d21e04b3a17d10e52949b630ec0 (diff)
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/timer_wrap.cc')
-rw-r--r--src/timer_wrap.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/timer_wrap.cc b/src/timer_wrap.cc
index a9d642461f8..9f0b1fdf05e 100644
--- a/src/timer_wrap.cc
+++ b/src/timer_wrap.cc
@@ -99,7 +99,7 @@ class TimerWrap : public HandleWrap {
static void Start(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
- TimerWrap* wrap = Unwrap<TimerWrap>(args.This());
+ TimerWrap* wrap = Unwrap<TimerWrap>(args.Holder());
int64_t timeout = args[0]->IntegerValue();
int64_t repeat = args[1]->IntegerValue();
@@ -110,7 +110,7 @@ class TimerWrap : public HandleWrap {
static void Stop(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
- TimerWrap* wrap = Unwrap<TimerWrap>(args.This());
+ TimerWrap* wrap = Unwrap<TimerWrap>(args.Holder());
int err = uv_timer_stop(&wrap->handle_);
args.GetReturnValue().Set(err);
@@ -119,7 +119,7 @@ class TimerWrap : public HandleWrap {
static void Again(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
- TimerWrap* wrap = Unwrap<TimerWrap>(args.This());
+ TimerWrap* wrap = Unwrap<TimerWrap>(args.Holder());
int err = uv_timer_again(&wrap->handle_);
args.GetReturnValue().Set(err);
@@ -128,7 +128,7 @@ class TimerWrap : public HandleWrap {
static void SetRepeat(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
- TimerWrap* wrap = Unwrap<TimerWrap>(args.This());
+ TimerWrap* wrap = Unwrap<TimerWrap>(args.Holder());
int64_t repeat = args[0]->IntegerValue();
uv_timer_set_repeat(&wrap->handle_, repeat);
@@ -138,7 +138,7 @@ class TimerWrap : public HandleWrap {
static void GetRepeat(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate());
HandleScope scope(env->isolate());
- TimerWrap* wrap = Unwrap<TimerWrap>(args.This());
+ TimerWrap* wrap = Unwrap<TimerWrap>(args.Holder());
int64_t repeat = uv_timer_get_repeat(&wrap->handle_);
args.GetReturnValue().Set(static_cast<double>(repeat));