Skip to content

Commit 109f73b

Browse files
committed
src: pass node_isolate to True() and False()
1 parent 01c3d0a commit 109f73b

7 files changed

Lines changed: 75 additions & 59 deletions

File tree

src/node.cc

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ static void Tick(void) {
176176
TryCatch try_catch;
177177

178178
// Let the tick callback know that this is coming from the spinner
179-
Handle<Value> argv[] = { True() };
179+
Handle<Value> argv[] = { True(node_isolate) };
180180
cb->Call(process, ARRAY_SIZE(argv), argv);
181181

182182
if (try_catch.HasCaught()) {
@@ -2078,9 +2078,9 @@ static Handle<Boolean> EnvDeleter(Local<String> property,
20782078
HandleScope scope;
20792079
#ifdef __POSIX__
20802080
String::Utf8Value key(property);
2081-
if (!getenv(*key)) return False();
2081+
if (!getenv(*key)) return False(node_isolate);
20822082
unsetenv(*key); // can't check return value, it's void on some platforms
2083-
return True();
2083+
return True(node_isolate);
20842084
#else
20852085
String::Value key(property);
20862086
WCHAR* key_ptr = reinterpret_cast<WCHAR*>(*key);
@@ -2091,7 +2091,7 @@ static Handle<Boolean> EnvDeleter(Local<String> property,
20912091
GetLastError() != ERROR_SUCCESS;
20922092
return scope.Close(Boolean::New(rv));
20932093
}
2094-
return True();
2094+
return True(node_isolate);
20952095
#endif
20962096
}
20972097

@@ -2146,14 +2146,14 @@ static Handle<Object> GetFeatures() {
21462146
Local<Object> obj = Object::New();
21472147
obj->Set(String::NewSymbol("debug"),
21482148
#if defined(DEBUG) && DEBUG
2149-
True()
2149+
True(node_isolate)
21502150
#else
2151-
False()
2151+
False(node_isolate)
21522152
#endif
21532153
);
21542154

2155-
obj->Set(String::NewSymbol("uv"), True());
2156-
obj->Set(String::NewSymbol("ipv6"), True()); // TODO ping libuv
2155+
obj->Set(String::NewSymbol("uv"), True(node_isolate));
2156+
obj->Set(String::NewSymbol("ipv6"), True(node_isolate)); // TODO ping libuv
21572157
obj->Set(String::NewSymbol("tls_npn"), Boolean::New(use_npn));
21582158
obj->Set(String::NewSymbol("tls_sni"), Boolean::New(use_sni));
21592159
obj->Set(String::NewSymbol("tls"),
@@ -2283,22 +2283,22 @@ Handle<Object> SetupProcessObject(int argc, char *argv[]) {
22832283

22842284
// -p, --print
22852285
if (print_eval) {
2286-
process->Set(String::NewSymbol("_print_eval"), True());
2286+
process->Set(String::NewSymbol("_print_eval"), True(node_isolate));
22872287
}
22882288

22892289
// -i, --interactive
22902290
if (force_repl) {
2291-
process->Set(String::NewSymbol("_forceRepl"), True());
2291+
process->Set(String::NewSymbol("_forceRepl"), True(node_isolate));
22922292
}
22932293

22942294
// --no-deprecation
22952295
if (no_deprecation) {
2296-
process->Set(String::NewSymbol("noDeprecation"), True());
2296+
process->Set(String::NewSymbol("noDeprecation"), True(node_isolate));
22972297
}
22982298

22992299
// --trace-deprecation
23002300
if (trace_deprecation) {
2301-
process->Set(String::NewSymbol("traceDeprecation"), True());
2301+
process->Set(String::NewSymbol("traceDeprecation"), True(node_isolate));
23022302
}
23032303

23042304
size_t size = 2*PATH_MAX;
@@ -2911,7 +2911,7 @@ void AtExit(void (*cb)(void* arg), void* arg) {
29112911

29122912
void EmitExit(v8::Handle<v8::Object> process_l) {
29132913
// process.emit('exit')
2914-
process_l->Set(String::NewSymbol("_exiting"), True());
2914+
process_l->Set(String::NewSymbol("_exiting"), True(node_isolate));
29152915
Local<Value> emit_v = process_l->Get(String::New("emit"));
29162916
assert(emit_v->IsFunction());
29172917
Local<Function> emit = Local<Function>::Cast(emit_v);

src/node_crypto.cc

Lines changed: 43 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ Handle<Value> SecureContext::Init(const Arguments& args) {
217217
SSL_CTX_sess_set_new_cb(sc->ctx_, NewSessionCallback);
218218

219219
sc->ca_store_ = NULL;
220-
return True();
220+
return True(node_isolate);
221221
}
222222

223223

@@ -333,7 +333,7 @@ Handle<Value> SecureContext::SetKey(const Arguments& args) {
333333
}
334334

335335
BIO *bio = LoadBIO(args[0]);
336-
if (!bio) return False();
336+
if (!bio) return False(node_isolate);
337337

338338
String::Utf8Value passphrase(args[1]);
339339

@@ -356,7 +356,7 @@ Handle<Value> SecureContext::SetKey(const Arguments& args) {
356356
EVP_PKEY_free(key);
357357
BIO_free(bio);
358358

359-
return True();
359+
return True(node_isolate);
360360
}
361361

362362

@@ -437,7 +437,7 @@ Handle<Value> SecureContext::SetCert(const Arguments& args) {
437437
}
438438

439439
BIO* bio = LoadBIO(args[0]);
440-
if (!bio) return False();
440+
if (!bio) return False(node_isolate);
441441

442442
int rv = SSL_CTX_use_certificate_chain(sc->ctx_, bio);
443443

@@ -454,7 +454,7 @@ Handle<Value> SecureContext::SetCert(const Arguments& args) {
454454
return ThrowException(Exception::Error(String::New(string)));
455455
}
456456

457-
return True();
457+
return True(node_isolate);
458458
}
459459

460460

@@ -474,7 +474,7 @@ Handle<Value> SecureContext::AddCACert(const Arguments& args) {
474474
}
475475

476476
X509* x509 = LoadX509(args[0]);
477-
if (!x509) return False();
477+
if (!x509) return False(node_isolate);
478478

479479
X509_STORE_add_cert(sc->ca_store_, x509);
480480
SSL_CTX_add_client_CA(sc->ctx_, x509);
@@ -485,7 +485,7 @@ Handle<Value> SecureContext::AddCACert(const Arguments& args) {
485485
SSL_CTX_set_cert_store(sc->ctx_, sc->ca_store_);
486486
}
487487

488-
return True();
488+
return True(node_isolate);
489489
}
490490

491491

@@ -499,13 +499,13 @@ Handle<Value> SecureContext::AddCRL(const Arguments& args) {
499499
}
500500

501501
BIO *bio = LoadBIO(args[0]);
502-
if (!bio) return False();
502+
if (!bio) return False(node_isolate);
503503

504504
X509_CRL *x509 = PEM_read_bio_X509_CRL(bio, NULL, NULL, NULL);
505505

506506
if (x509 == NULL) {
507507
BIO_free(bio);
508-
return False();
508+
return False(node_isolate);
509509
}
510510

511511
X509_STORE_add_crl(sc->ca_store_, x509);
@@ -516,7 +516,7 @@ Handle<Value> SecureContext::AddCRL(const Arguments& args) {
516516
BIO_free(bio);
517517
X509_CRL_free(x509);
518518

519-
return True();
519+
return True(node_isolate);
520520
}
521521

522522

@@ -536,14 +536,14 @@ Handle<Value> SecureContext::AddRootCerts(const Arguments& args) {
536536

537537
if (!BIO_write(bp, root_certs[i], strlen(root_certs[i]))) {
538538
BIO_free(bp);
539-
return False();
539+
return False(node_isolate);
540540
}
541541

542542
X509 *x509 = PEM_read_bio_X509(bp, NULL, NULL, NULL);
543543

544544
if (x509 == NULL) {
545545
BIO_free(bp);
546-
return False();
546+
return False(node_isolate);
547547
}
548548

549549
X509_STORE_add_cert(root_cert_store, x509);
@@ -556,7 +556,7 @@ Handle<Value> SecureContext::AddRootCerts(const Arguments& args) {
556556
sc->ca_store_ = root_cert_store;
557557
SSL_CTX_set_cert_store(sc->ctx_, sc->ca_store_);
558558

559-
return True();
559+
return True(node_isolate);
560560
}
561561

562562

@@ -572,7 +572,7 @@ Handle<Value> SecureContext::SetCiphers(const Arguments& args) {
572572
String::Utf8Value ciphers(args[0]);
573573
SSL_CTX_set_cipher_list(sc->ctx_, *ciphers);
574574

575-
return True();
575+
return True(node_isolate);
576576
}
577577

578578
Handle<Value> SecureContext::SetOptions(const Arguments& args) {
@@ -586,7 +586,7 @@ Handle<Value> SecureContext::SetOptions(const Arguments& args) {
586586

587587
SSL_CTX_set_options(sc->ctx_, args[0]->IntegerValue());
588588

589-
return True();
589+
return True(node_isolate);
590590
}
591591

592592
Handle<Value> SecureContext::SetSessionIdContext(const Arguments& args) {
@@ -618,14 +618,14 @@ Handle<Value> SecureContext::SetSessionIdContext(const Arguments& args) {
618618
return ThrowException(Exception::TypeError(message));
619619
}
620620

621-
return True();
621+
return True(node_isolate);
622622
}
623623

624624
Handle<Value> SecureContext::Close(const Arguments& args) {
625625
HandleScope scope;
626626
SecureContext *sc = ObjectWrap::Unwrap<SecureContext>(args.Holder());
627627
sc->FreeCTXMem();
628-
return False();
628+
return False(node_isolate);
629629
}
630630

631631
//Takes .pfx or .p12 and password in string or buffer format
@@ -702,7 +702,7 @@ Handle<Value> SecureContext::LoadPKCS12(const Arguments& args) {
702702
return ThrowException(Exception::Error(String::New(str)));
703703
}
704704

705-
return True();
705+
return True(node_isolate);
706706
}
707707

708708

@@ -948,11 +948,11 @@ void Connection::SetShutdownFlags() {
948948
int flags = SSL_get_shutdown(ssl_);
949949

950950
if (flags & SSL_SENT_SHUTDOWN) {
951-
handle_->Set(String::New("sentShutdown"), True());
951+
handle_->Set(String::New("sentShutdown"), True(node_isolate));
952952
}
953953

954954
if (flags & SSL_RECEIVED_SHUTDOWN) {
955-
handle_->Set(String::New("receivedShutdown"), True());
955+
handle_->Set(String::New("receivedShutdown"), True(node_isolate));
956956
}
957957
}
958958

@@ -1082,7 +1082,7 @@ int Connection::SelectNextProtoCallback_(SSL *s,
10821082
*outlen = 8;
10831083

10841084
// set status unsupported
1085-
p->selectedNPNProto_ = Persistent<Value>::New(False());
1085+
p->selectedNPNProto_ = Persistent<Value>::New(False(node_isolate));
10861086

10871087
return SSL_TLSEXT_ERR_OK;
10881088
}
@@ -1103,7 +1103,7 @@ int Connection::SelectNextProtoCallback_(SSL *s,
11031103
));
11041104
break;
11051105
case OPENSSL_NPN_NO_OVERLAP:
1106-
p->selectedNPNProto_ = Persistent<Value>::New(False());
1106+
p->selectedNPNProto_ = Persistent<Value>::New(False(node_isolate));
11071107
break;
11081108
default:
11091109
break;
@@ -1660,7 +1660,7 @@ Handle<Value> Connection::SetSession(const Arguments& args) {
16601660
return ThrowException(Exception::Error(eStr));
16611661
}
16621662

1663-
return True();
1663+
return True(node_isolate);
16641664
}
16651665

16661666
Handle<Value> Connection::LoadSession(const Arguments& args) {
@@ -1684,16 +1684,19 @@ Handle<Value> Connection::LoadSession(const Arguments& args) {
16841684

16851685
ss->hello_parser_.Finish();
16861686

1687-
return True();
1687+
return True(node_isolate);
16881688
}
16891689

16901690
Handle<Value> Connection::IsSessionReused(const Arguments& args) {
16911691
HandleScope scope;
16921692

16931693
Connection *ss = Connection::Unwrap(args);
16941694

1695-
if (ss->ssl_ == NULL) return False();
1696-
return SSL_session_reused(ss->ssl_) ? True() : False();
1695+
if (ss->ssl_ == NULL || SSL_session_reused(ss->ssl_) == false) {
1696+
return False(node_isolate);
1697+
}
1698+
1699+
return True(node_isolate);
16971700
}
16981701

16991702

@@ -1724,7 +1727,7 @@ Handle<Value> Connection::Shutdown(const Arguments& args) {
17241727

17251728
Connection *ss = Connection::Unwrap(args);
17261729

1727-
if (ss->ssl_ == NULL) return False();
1730+
if (ss->ssl_ == NULL) return False(node_isolate);
17281731
int rv = SSL_shutdown(ss->ssl_);
17291732
ss->HandleSSLError("SSL_shutdown", rv, kZeroIsNotAnError);
17301733
ss->SetShutdownFlags();
@@ -1738,12 +1741,12 @@ Handle<Value> Connection::ReceivedShutdown(const Arguments& args) {
17381741

17391742
Connection *ss = Connection::Unwrap(args);
17401743

1741-
if (ss->ssl_ == NULL) return False();
1744+
if (ss->ssl_ == NULL) return False(node_isolate);
17421745
int r = SSL_get_shutdown(ss->ssl_);
17431746

1744-
if (r & SSL_RECEIVED_SHUTDOWN) return True();
1747+
if (r & SSL_RECEIVED_SHUTDOWN) return True(node_isolate);
17451748

1746-
return False();
1749+
return False(node_isolate);
17471750
}
17481751

17491752

@@ -1752,8 +1755,11 @@ Handle<Value> Connection::IsInitFinished(const Arguments& args) {
17521755

17531756
Connection *ss = Connection::Unwrap(args);
17541757

1755-
if (ss->ssl_ == NULL) return False();
1756-
return SSL_is_init_finished(ss->ssl_) ? True() : False();
1758+
if (ss->ssl_ == NULL || SSL_is_init_finished(ss->ssl_) == false) {
1759+
return False(node_isolate);
1760+
}
1761+
1762+
return True(node_isolate);
17571763
}
17581764

17591765

@@ -1929,7 +1935,7 @@ Handle<Value> Connection::Close(const Arguments& args) {
19291935
SSL_free(ss->ssl_);
19301936
ss->ssl_ = NULL;
19311937
}
1932-
return True();
1938+
return True(node_isolate);
19331939
}
19341940

19351941
#ifdef OPENSSL_NPN_NEGOTIATED
@@ -1945,7 +1951,7 @@ Handle<Value> Connection::GetNegotiatedProto(const Arguments& args) {
19451951
SSL_get0_next_proto_negotiated(ss->ssl_, &npn_proto, &npn_proto_len);
19461952

19471953
if (!npn_proto) {
1948-
return False();
1954+
return False(node_isolate);
19491955
}
19501956

19511957
return String::New((const char*) npn_proto, npn_proto_len);
@@ -1970,7 +1976,7 @@ Handle<Value> Connection::SetNPNProtocols(const Arguments& args) {
19701976
}
19711977
ss->npnProtos_ = Persistent<Object>::New(args[0]->ToObject());
19721978

1973-
return True();
1979+
return True(node_isolate);
19741980
};
19751981
#endif
19761982

@@ -1983,7 +1989,7 @@ Handle<Value> Connection::GetServername(const Arguments& args) {
19831989
if (ss->is_server_ && !ss->servername_.IsEmpty()) {
19841990
return ss->servername_;
19851991
} else {
1986-
return False();
1992+
return False(node_isolate);
19871993
}
19881994
}
19891995

@@ -2004,7 +2010,7 @@ Handle<Value> Connection::SetSNICallback(const Arguments& args) {
20042010
ss->sniObject_ = Persistent<Object>::New(Object::New());
20052011
ss->sniObject_->Set(String::New("onselect"), args[0]);
20062012

2007-
return True();
2013+
return True(node_isolate);
20082014
}
20092015
#endif
20102016

0 commit comments

Comments
 (0)