Skip to content
This repository
Browse code

MakeCallback: Use in node_crypto

  • Loading branch information...
commit 35c0cd219d0810c9e5324cf7d48cd6724b4e767b 1 parent 91701c2
Isaac Z. Schlueter isaacs authored

Showing 1 changed file with 9 additions and 20 deletions. Show diff stats Hide diff stats

  1. +9 20 src/node_crypto.cc
29 src/node_crypto.cc
@@ -861,16 +861,10 @@ int Connection::SelectSNIContextCallback_(SSL *s, int *ad, void* arg) {
861 861 Local<Value> argv[1] = {*p->servername_};
862 862 Local<Function> callback = *p->sniCallback_;
863 863
864   - TryCatch try_catch;
865   -
866 864 // Call it
867   - Local<Value> ret = callback->Call(Context::GetCurrent()->Global(),
868   - 1,
869   - argv);
870   -
871   - if (try_catch.HasCaught()) {
872   - FatalException(try_catch);
873   - }
  865 + Local<Value> ret;
  866 + ret = Local<Value>::New(MakeCallback(Context::GetCurrent()->Global(),
  867 + callback, 1, argv));
874 868
875 869 // If ret is SecureContext
876 870 if (secure_context_constructor->HasInstance(ret)) {
@@ -4121,12 +4115,9 @@ EIO_PBKDF2After(uv_work_t* req) {
4121 4115 argv[1] = Local<Value>::New(Undefined());
4122 4116 }
4123 4117
4124   - TryCatch try_catch;
4125   -
4126   - request->callback->Call(Context::GetCurrent()->Global(), 2, argv);
4127   -
4128   - if (try_catch.HasCaught())
4129   - FatalException(try_catch);
  4118 + MakeCallback(Context::GetCurrent()->Global(),
  4119 + request->callback,
  4120 + 2, argv);
4130 4121
4131 4122 delete[] request->pass;
4132 4123 delete[] request->salt;
@@ -4314,11 +4305,9 @@ void RandomBytesAfter(uv_work_t* work_req) {
4314 4305 Local<Value> argv[2];
4315 4306 RandomBytesCheck(req, argv);
4316 4307
4317   - TryCatch tc;
4318   - req->callback_->Call(Context::GetCurrent()->Global(), 2, argv);
4319   -
4320   - if (tc.HasCaught())
4321   - FatalException(tc);
  4308 + MakeCallback(Context::GetCurrent()->Global(),
  4309 + req->callback_,
  4310 + 2, argv);
4322 4311
4323 4312 delete req;
4324 4313 }

0 comments on commit 35c0cd2

Please sign in to comment.
Something went wrong with that request. Please try again.