Skip to content

Commit fcfec07

Browse files
committed
internal fs functions called with this == ReqWrap
1 parent 39ea274 commit fcfec07

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/node_file.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ typedef class ReqWrap<uv_fs_t> FSReqWrap;
5454
static Persistent<String> encoding_symbol;
5555
static Persistent<String> errno_symbol;
5656
static Persistent<String> buf_symbol;
57-
static Persistent<String> callback_sym;
57+
static Persistent<String> oncomplete_sym;
5858

5959
static inline bool SetCloseOnExec(int fd) {
6060
#ifdef __POSIX__
@@ -77,7 +77,7 @@ static void After(uv_fs_t *req) {
7777

7878
FSReqWrap* req_wrap = (FSReqWrap*) req->data;
7979
assert(&req_wrap->req_ == req);
80-
Local<Value> callback_v = req_wrap->object_->Get(callback_sym);
80+
Local<Value> callback_v = req_wrap->object_->Get(oncomplete_sym);
8181
assert(callback_v->IsFunction());
8282
Local<Function> callback = Local<Function>::Cast(callback_v);
8383

@@ -192,7 +192,7 @@ static void After(uv_fs_t *req) {
192192

193193
TryCatch try_catch;
194194

195-
callback->Call(v8::Context::GetCurrent()->Global(), argc, argv);
195+
callback->Call(req_wrap->object_, argc, argv);
196196

197197
if (try_catch.HasCaught()) {
198198
FatalException(try_catch);
@@ -218,7 +218,7 @@ struct fs_req_wrap {
218218
int r = uv_fs_##func(uv_default_loop(), &req_wrap->req_, \
219219
__VA_ARGS__, After); \
220220
assert(r == 0); \
221-
req_wrap->object_->Set(callback_sym, callback); \
221+
req_wrap->object_->Set(oncomplete_sym, callback); \
222222
req_wrap->Dispatched(); \
223223
return scope.Close(req_wrap->object_);
224224

@@ -991,7 +991,7 @@ void InitFs(Handle<Object> target) {
991991
stats_constructor_template->GetFunction());
992992
File::Initialize(target);
993993

994-
callback_sym = NODE_PSYMBOL("callback");
994+
oncomplete_sym = NODE_PSYMBOL("oncomplete");
995995

996996
#ifdef __POSIX__
997997
StatWatcher::Initialize(target);

0 commit comments

Comments
 (0)