Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Change InstanceTemplate SetAccessor to SetAccessorProperty
  • Loading branch information
jure committed Dec 14, 2017
commit 26ffff19c0f785a5caf93cba3a000d7c59cae888
37 changes: 21 additions & 16 deletions src/node_crypto.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4785,14 +4785,17 @@ void DiffieHellman::Initialize(Environment* env, Local<Object> target) {
env->SetProtoMethod(t, "setPublicKey", SetPublicKey);
env->SetProtoMethod(t, "setPrivateKey", SetPrivateKey);

t->InstanceTemplate()->SetAccessor(
Local<FunctionTemplate> verify_error_getter_templ =
FunctionTemplate::New(env->isolate(),
DiffieHellman::VerifyErrorGetter,
Local<Value>(),
Signature::New(env->isolate(), t));

t->InstanceTemplate()->SetAccessorProperty(
env->verify_error_string(),
DiffieHellman::VerifyErrorGetter,
nullptr,
env->as_external(),
DEFAULT,
attributes,
AccessorSignature::New(env->isolate(), t));
verify_error_getter_templ,
Local<FunctionTemplate>(),
attributes);

target->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "DiffieHellman"),
t->GetFunction());
Expand All @@ -4807,14 +4810,17 @@ void DiffieHellman::Initialize(Environment* env, Local<Object> target) {
env->SetProtoMethod(t2, "getPublicKey", GetPublicKey);
env->SetProtoMethod(t2, "getPrivateKey", GetPrivateKey);

t2->InstanceTemplate()->SetAccessor(
Local<FunctionTemplate> verify_error_getter_templ2 =
FunctionTemplate::New(env->isolate(),
DiffieHellman::VerifyErrorGetter,
Local<Value>(),
Signature::New(env->isolate(), t2));

t2->InstanceTemplate()->SetAccessorProperty(
env->verify_error_string(),
DiffieHellman::VerifyErrorGetter,
nullptr,
env->as_external(),
DEFAULT,
attributes,
AccessorSignature::New(env->isolate(), t2));
verify_error_getter_templ2,
Local<FunctionTemplate>(),
attributes);

target->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "DiffieHellmanGroup"),
t2->GetFunction());
Expand Down Expand Up @@ -5130,8 +5136,7 @@ void DiffieHellman::SetPrivateKey(const FunctionCallbackInfo<Value>& args) {
}


void DiffieHellman::VerifyErrorGetter(Local<String> property,
const PropertyCallbackInfo<Value>& args) {
void DiffieHellman::VerifyErrorGetter(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(args.GetIsolate());

DiffieHellman* diffieHellman;
Expand Down
4 changes: 1 addition & 3 deletions src/node_crypto.h
Original file line number Diff line number Diff line change
Expand Up @@ -693,9 +693,7 @@ class DiffieHellman : public BaseObject {
static void ComputeSecret(const v8::FunctionCallbackInfo<v8::Value>& args);
static void SetPublicKey(const v8::FunctionCallbackInfo<v8::Value>& args);
static void SetPrivateKey(const v8::FunctionCallbackInfo<v8::Value>& args);
static void VerifyErrorGetter(
v8::Local<v8::String> property,
const v8::PropertyCallbackInfo<v8::Value>& args);
static void VerifyErrorGetter(const v8::FunctionCallbackInfo<v8::Value>& args);

DiffieHellman(Environment* env, v8::Local<v8::Object> wrap)
: BaseObject(env, wrap),
Expand Down