diff options
author | Trevor Norris <trev.norris@gmail.com> | 2016-06-01 12:33:33 -0600 |
---|---|---|
committer | Trevor Norris <trev.norris@gmail.com> | 2016-06-01 15:39:21 -0600 |
commit | f81f0c351ab4461be0dc74c266995e4690f89f35 (patch) | |
tree | ba321147627e2b69cb291e019d7cc0c399a520ab /src | |
parent | 8c1d5e58d4ddfbac20dfd3b0816d7593fad5d256 (diff) | |
download | android-node-v8-f81f0c351ab4461be0dc74c266995e4690f89f35.tar.gz android-node-v8-f81f0c351ab4461be0dc74c266995e4690f89f35.tar.bz2 android-node-v8-f81f0c351ab4461be0dc74c266995e4690f89f35.zip |
async_wrap: pass uid to JS as double
Passing the uid via v8::Integer::New() converts it to a uint32_t. Which
will trim the value early. Instead use v8::Number::New() to convert the
int64_t to a double so that JS can see the full 2^53 range of uid's.
PR-URL: https://github.com/nodejs/node/pull/7096
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Andreas Madsen <amwebdk@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/async-wrap-inl.h | 6 | ||||
-rw-r--r-- | src/async-wrap.cc | 3 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/async-wrap-inl.h b/src/async-wrap-inl.h index 372af07310..85e31b1ed0 100644 --- a/src/async-wrap-inl.h +++ b/src/async-wrap-inl.h @@ -42,14 +42,14 @@ inline AsyncWrap::AsyncWrap(Environment* env, v8::HandleScope scope(env->isolate()); v8::Local<v8::Value> argv[] = { - v8::Integer::New(env->isolate(), get_uid()), + v8::Number::New(env->isolate(), get_uid()), v8::Int32::New(env->isolate(), provider), Null(env->isolate()), Null(env->isolate()) }; if (parent != nullptr) { - argv[2] = v8::Integer::New(env->isolate(), parent->get_uid()); + argv[2] = v8::Number::New(env->isolate(), parent->get_uid()); argv[3] = parent->object(); } @@ -74,7 +74,7 @@ inline AsyncWrap::~AsyncWrap() { v8::Local<v8::Function> fn = env()->async_hooks_destroy_function(); if (!fn.IsEmpty()) { v8::HandleScope scope(env()->isolate()); - v8::Local<v8::Value> uid = v8::Integer::New(env()->isolate(), get_uid()); + v8::Local<v8::Value> uid = v8::Number::New(env()->isolate(), get_uid()); v8::TryCatch try_catch(env()->isolate()); v8::MaybeLocal<v8::Value> ret = fn->Call(env()->context(), v8::Null(env()->isolate()), 1, &uid); diff --git a/src/async-wrap.cc b/src/async-wrap.cc index 79631b1ec1..405b9d1701 100644 --- a/src/async-wrap.cc +++ b/src/async-wrap.cc @@ -18,6 +18,7 @@ using v8::Integer; using v8::Isolate; using v8::Local; using v8::MaybeLocal; +using v8::Number; using v8::Object; using v8::RetainedObjectInfo; using v8::TryCatch; @@ -197,7 +198,7 @@ Local<Value> AsyncWrap::MakeCallback(const Local<Function> cb, Local<Function> pre_fn = env()->async_hooks_pre_function(); Local<Function> post_fn = env()->async_hooks_post_function(); - Local<Value> uid = Integer::New(env()->isolate(), get_uid()); + Local<Value> uid = Number::New(env()->isolate(), get_uid()); Local<Object> context = object(); Local<Object> domain; bool has_domain = false; |