Browse Source

src: pass node_isolate to True() and False()

v0.9.6-release
Ben Noordhuis 12 years ago
parent
commit
109f73b2c0
  1. 26
      src/node.cc
  2. 80
      src/node_crypto.cc
  3. 7
      src/node_http_parser.cc
  4. 6
      src/node_os.cc
  5. 4
      src/tcp_wrap.cc
  6. 7
      src/tty_wrap.cc
  7. 4
      src/udp_wrap.cc

26
src/node.cc

@ -176,7 +176,7 @@ static void Tick(void) {
TryCatch try_catch; TryCatch try_catch;
// Let the tick callback know that this is coming from the spinner // Let the tick callback know that this is coming from the spinner
Handle<Value> argv[] = { True() }; Handle<Value> argv[] = { True(node_isolate) };
cb->Call(process, ARRAY_SIZE(argv), argv); cb->Call(process, ARRAY_SIZE(argv), argv);
if (try_catch.HasCaught()) { if (try_catch.HasCaught()) {
@ -2078,9 +2078,9 @@ static Handle<Boolean> EnvDeleter(Local<String> property,
HandleScope scope; HandleScope scope;
#ifdef __POSIX__ #ifdef __POSIX__
String::Utf8Value key(property); String::Utf8Value key(property);
if (!getenv(*key)) return False(); if (!getenv(*key)) return False(node_isolate);
unsetenv(*key); // can't check return value, it's void on some platforms unsetenv(*key); // can't check return value, it's void on some platforms
return True(); return True(node_isolate);
#else #else
String::Value key(property); String::Value key(property);
WCHAR* key_ptr = reinterpret_cast<WCHAR*>(*key); WCHAR* key_ptr = reinterpret_cast<WCHAR*>(*key);
@ -2091,7 +2091,7 @@ static Handle<Boolean> EnvDeleter(Local<String> property,
GetLastError() != ERROR_SUCCESS; GetLastError() != ERROR_SUCCESS;
return scope.Close(Boolean::New(rv)); return scope.Close(Boolean::New(rv));
} }
return True(); return True(node_isolate);
#endif #endif
} }
@ -2146,14 +2146,14 @@ static Handle<Object> GetFeatures() {
Local<Object> obj = Object::New(); Local<Object> obj = Object::New();
obj->Set(String::NewSymbol("debug"), obj->Set(String::NewSymbol("debug"),
#if defined(DEBUG) && DEBUG #if defined(DEBUG) && DEBUG
True() True(node_isolate)
#else #else
False() False(node_isolate)
#endif #endif
); );
obj->Set(String::NewSymbol("uv"), True()); obj->Set(String::NewSymbol("uv"), True(node_isolate));
obj->Set(String::NewSymbol("ipv6"), True()); // TODO ping libuv obj->Set(String::NewSymbol("ipv6"), True(node_isolate)); // TODO ping libuv
obj->Set(String::NewSymbol("tls_npn"), Boolean::New(use_npn)); obj->Set(String::NewSymbol("tls_npn"), Boolean::New(use_npn));
obj->Set(String::NewSymbol("tls_sni"), Boolean::New(use_sni)); obj->Set(String::NewSymbol("tls_sni"), Boolean::New(use_sni));
obj->Set(String::NewSymbol("tls"), obj->Set(String::NewSymbol("tls"),
@ -2283,22 +2283,22 @@ Handle<Object> SetupProcessObject(int argc, char *argv[]) {
// -p, --print // -p, --print
if (print_eval) { if (print_eval) {
process->Set(String::NewSymbol("_print_eval"), True()); process->Set(String::NewSymbol("_print_eval"), True(node_isolate));
} }
// -i, --interactive // -i, --interactive
if (force_repl) { if (force_repl) {
process->Set(String::NewSymbol("_forceRepl"), True()); process->Set(String::NewSymbol("_forceRepl"), True(node_isolate));
} }
// --no-deprecation // --no-deprecation
if (no_deprecation) { if (no_deprecation) {
process->Set(String::NewSymbol("noDeprecation"), True()); process->Set(String::NewSymbol("noDeprecation"), True(node_isolate));
} }
// --trace-deprecation // --trace-deprecation
if (trace_deprecation) { if (trace_deprecation) {
process->Set(String::NewSymbol("traceDeprecation"), True()); process->Set(String::NewSymbol("traceDeprecation"), True(node_isolate));
} }
size_t size = 2*PATH_MAX; size_t size = 2*PATH_MAX;
@ -2911,7 +2911,7 @@ void AtExit(void (*cb)(void* arg), void* arg) {
void EmitExit(v8::Handle<v8::Object> process_l) { void EmitExit(v8::Handle<v8::Object> process_l) {
// process.emit('exit') // process.emit('exit')
process_l->Set(String::NewSymbol("_exiting"), True()); process_l->Set(String::NewSymbol("_exiting"), True(node_isolate));
Local<Value> emit_v = process_l->Get(String::New("emit")); Local<Value> emit_v = process_l->Get(String::New("emit"));
assert(emit_v->IsFunction()); assert(emit_v->IsFunction());
Local<Function> emit = Local<Function>::Cast(emit_v); Local<Function> emit = Local<Function>::Cast(emit_v);

80
src/node_crypto.cc

@ -217,7 +217,7 @@ Handle<Value> SecureContext::Init(const Arguments& args) {
SSL_CTX_sess_set_new_cb(sc->ctx_, NewSessionCallback); SSL_CTX_sess_set_new_cb(sc->ctx_, NewSessionCallback);
sc->ca_store_ = NULL; sc->ca_store_ = NULL;
return True(); return True(node_isolate);
} }
@ -333,7 +333,7 @@ Handle<Value> SecureContext::SetKey(const Arguments& args) {
} }
BIO *bio = LoadBIO(args[0]); BIO *bio = LoadBIO(args[0]);
if (!bio) return False(); if (!bio) return False(node_isolate);
String::Utf8Value passphrase(args[1]); String::Utf8Value passphrase(args[1]);
@ -356,7 +356,7 @@ Handle<Value> SecureContext::SetKey(const Arguments& args) {
EVP_PKEY_free(key); EVP_PKEY_free(key);
BIO_free(bio); BIO_free(bio);
return True(); return True(node_isolate);
} }
@ -437,7 +437,7 @@ Handle<Value> SecureContext::SetCert(const Arguments& args) {
} }
BIO* bio = LoadBIO(args[0]); BIO* bio = LoadBIO(args[0]);
if (!bio) return False(); if (!bio) return False(node_isolate);
int rv = SSL_CTX_use_certificate_chain(sc->ctx_, bio); int rv = SSL_CTX_use_certificate_chain(sc->ctx_, bio);
@ -454,7 +454,7 @@ Handle<Value> SecureContext::SetCert(const Arguments& args) {
return ThrowException(Exception::Error(String::New(string))); return ThrowException(Exception::Error(String::New(string)));
} }
return True(); return True(node_isolate);
} }
@ -474,7 +474,7 @@ Handle<Value> SecureContext::AddCACert(const Arguments& args) {
} }
X509* x509 = LoadX509(args[0]); X509* x509 = LoadX509(args[0]);
if (!x509) return False(); if (!x509) return False(node_isolate);
X509_STORE_add_cert(sc->ca_store_, x509); X509_STORE_add_cert(sc->ca_store_, x509);
SSL_CTX_add_client_CA(sc->ctx_, x509); SSL_CTX_add_client_CA(sc->ctx_, x509);
@ -485,7 +485,7 @@ Handle<Value> SecureContext::AddCACert(const Arguments& args) {
SSL_CTX_set_cert_store(sc->ctx_, sc->ca_store_); SSL_CTX_set_cert_store(sc->ctx_, sc->ca_store_);
} }
return True(); return True(node_isolate);
} }
@ -499,13 +499,13 @@ Handle<Value> SecureContext::AddCRL(const Arguments& args) {
} }
BIO *bio = LoadBIO(args[0]); BIO *bio = LoadBIO(args[0]);
if (!bio) return False(); if (!bio) return False(node_isolate);
X509_CRL *x509 = PEM_read_bio_X509_CRL(bio, NULL, NULL, NULL); X509_CRL *x509 = PEM_read_bio_X509_CRL(bio, NULL, NULL, NULL);
if (x509 == NULL) { if (x509 == NULL) {
BIO_free(bio); BIO_free(bio);
return False(); return False(node_isolate);
} }
X509_STORE_add_crl(sc->ca_store_, x509); X509_STORE_add_crl(sc->ca_store_, x509);
@ -516,7 +516,7 @@ Handle<Value> SecureContext::AddCRL(const Arguments& args) {
BIO_free(bio); BIO_free(bio);
X509_CRL_free(x509); X509_CRL_free(x509);
return True(); return True(node_isolate);
} }
@ -536,14 +536,14 @@ Handle<Value> SecureContext::AddRootCerts(const Arguments& args) {
if (!BIO_write(bp, root_certs[i], strlen(root_certs[i]))) { if (!BIO_write(bp, root_certs[i], strlen(root_certs[i]))) {
BIO_free(bp); BIO_free(bp);
return False(); return False(node_isolate);
} }
X509 *x509 = PEM_read_bio_X509(bp, NULL, NULL, NULL); X509 *x509 = PEM_read_bio_X509(bp, NULL, NULL, NULL);
if (x509 == NULL) { if (x509 == NULL) {
BIO_free(bp); BIO_free(bp);
return False(); return False(node_isolate);
} }
X509_STORE_add_cert(root_cert_store, x509); X509_STORE_add_cert(root_cert_store, x509);
@ -556,7 +556,7 @@ Handle<Value> SecureContext::AddRootCerts(const Arguments& args) {
sc->ca_store_ = root_cert_store; sc->ca_store_ = root_cert_store;
SSL_CTX_set_cert_store(sc->ctx_, sc->ca_store_); SSL_CTX_set_cert_store(sc->ctx_, sc->ca_store_);
return True(); return True(node_isolate);
} }
@ -572,7 +572,7 @@ Handle<Value> SecureContext::SetCiphers(const Arguments& args) {
String::Utf8Value ciphers(args[0]); String::Utf8Value ciphers(args[0]);
SSL_CTX_set_cipher_list(sc->ctx_, *ciphers); SSL_CTX_set_cipher_list(sc->ctx_, *ciphers);
return True(); return True(node_isolate);
} }
Handle<Value> SecureContext::SetOptions(const Arguments& args) { Handle<Value> SecureContext::SetOptions(const Arguments& args) {
@ -586,7 +586,7 @@ Handle<Value> SecureContext::SetOptions(const Arguments& args) {
SSL_CTX_set_options(sc->ctx_, args[0]->IntegerValue()); SSL_CTX_set_options(sc->ctx_, args[0]->IntegerValue());
return True(); return True(node_isolate);
} }
Handle<Value> SecureContext::SetSessionIdContext(const Arguments& args) { Handle<Value> SecureContext::SetSessionIdContext(const Arguments& args) {
@ -618,14 +618,14 @@ Handle<Value> SecureContext::SetSessionIdContext(const Arguments& args) {
return ThrowException(Exception::TypeError(message)); return ThrowException(Exception::TypeError(message));
} }
return True(); return True(node_isolate);
} }
Handle<Value> SecureContext::Close(const Arguments& args) { Handle<Value> SecureContext::Close(const Arguments& args) {
HandleScope scope; HandleScope scope;
SecureContext *sc = ObjectWrap::Unwrap<SecureContext>(args.Holder()); SecureContext *sc = ObjectWrap::Unwrap<SecureContext>(args.Holder());
sc->FreeCTXMem(); sc->FreeCTXMem();
return False(); return False(node_isolate);
} }
//Takes .pfx or .p12 and password in string or buffer format //Takes .pfx or .p12 and password in string or buffer format
@ -702,7 +702,7 @@ Handle<Value> SecureContext::LoadPKCS12(const Arguments& args) {
return ThrowException(Exception::Error(String::New(str))); return ThrowException(Exception::Error(String::New(str)));
} }
return True(); return True(node_isolate);
} }
@ -948,11 +948,11 @@ void Connection::SetShutdownFlags() {
int flags = SSL_get_shutdown(ssl_); int flags = SSL_get_shutdown(ssl_);
if (flags & SSL_SENT_SHUTDOWN) { if (flags & SSL_SENT_SHUTDOWN) {
handle_->Set(String::New("sentShutdown"), True()); handle_->Set(String::New("sentShutdown"), True(node_isolate));
} }
if (flags & SSL_RECEIVED_SHUTDOWN) { if (flags & SSL_RECEIVED_SHUTDOWN) {
handle_->Set(String::New("receivedShutdown"), True()); handle_->Set(String::New("receivedShutdown"), True(node_isolate));
} }
} }
@ -1082,7 +1082,7 @@ int Connection::SelectNextProtoCallback_(SSL *s,
*outlen = 8; *outlen = 8;
// set status unsupported // set status unsupported
p->selectedNPNProto_ = Persistent<Value>::New(False()); p->selectedNPNProto_ = Persistent<Value>::New(False(node_isolate));
return SSL_TLSEXT_ERR_OK; return SSL_TLSEXT_ERR_OK;
} }
@ -1103,7 +1103,7 @@ int Connection::SelectNextProtoCallback_(SSL *s,
)); ));
break; break;
case OPENSSL_NPN_NO_OVERLAP: case OPENSSL_NPN_NO_OVERLAP:
p->selectedNPNProto_ = Persistent<Value>::New(False()); p->selectedNPNProto_ = Persistent<Value>::New(False(node_isolate));
break; break;
default: default:
break; break;
@ -1660,7 +1660,7 @@ Handle<Value> Connection::SetSession(const Arguments& args) {
return ThrowException(Exception::Error(eStr)); return ThrowException(Exception::Error(eStr));
} }
return True(); return True(node_isolate);
} }
Handle<Value> Connection::LoadSession(const Arguments& args) { Handle<Value> Connection::LoadSession(const Arguments& args) {
@ -1684,7 +1684,7 @@ Handle<Value> Connection::LoadSession(const Arguments& args) {
ss->hello_parser_.Finish(); ss->hello_parser_.Finish();
return True(); return True(node_isolate);
} }
Handle<Value> Connection::IsSessionReused(const Arguments& args) { Handle<Value> Connection::IsSessionReused(const Arguments& args) {
@ -1692,8 +1692,11 @@ Handle<Value> Connection::IsSessionReused(const Arguments& args) {
Connection *ss = Connection::Unwrap(args); Connection *ss = Connection::Unwrap(args);
if (ss->ssl_ == NULL) return False(); if (ss->ssl_ == NULL || SSL_session_reused(ss->ssl_) == false) {
return SSL_session_reused(ss->ssl_) ? True() : False(); return False(node_isolate);
}
return True(node_isolate);
} }
@ -1724,7 +1727,7 @@ Handle<Value> Connection::Shutdown(const Arguments& args) {
Connection *ss = Connection::Unwrap(args); Connection *ss = Connection::Unwrap(args);
if (ss->ssl_ == NULL) return False(); if (ss->ssl_ == NULL) return False(node_isolate);
int rv = SSL_shutdown(ss->ssl_); int rv = SSL_shutdown(ss->ssl_);
ss->HandleSSLError("SSL_shutdown", rv, kZeroIsNotAnError); ss->HandleSSLError("SSL_shutdown", rv, kZeroIsNotAnError);
ss->SetShutdownFlags(); ss->SetShutdownFlags();
@ -1738,12 +1741,12 @@ Handle<Value> Connection::ReceivedShutdown(const Arguments& args) {
Connection *ss = Connection::Unwrap(args); Connection *ss = Connection::Unwrap(args);
if (ss->ssl_ == NULL) return False(); if (ss->ssl_ == NULL) return False(node_isolate);
int r = SSL_get_shutdown(ss->ssl_); int r = SSL_get_shutdown(ss->ssl_);
if (r & SSL_RECEIVED_SHUTDOWN) return True(); if (r & SSL_RECEIVED_SHUTDOWN) return True(node_isolate);
return False(); return False(node_isolate);
} }
@ -1752,8 +1755,11 @@ Handle<Value> Connection::IsInitFinished(const Arguments& args) {
Connection *ss = Connection::Unwrap(args); Connection *ss = Connection::Unwrap(args);
if (ss->ssl_ == NULL) return False(); if (ss->ssl_ == NULL || SSL_is_init_finished(ss->ssl_) == false) {
return SSL_is_init_finished(ss->ssl_) ? True() : False(); return False(node_isolate);
}
return True(node_isolate);
} }
@ -1929,7 +1935,7 @@ Handle<Value> Connection::Close(const Arguments& args) {
SSL_free(ss->ssl_); SSL_free(ss->ssl_);
ss->ssl_ = NULL; ss->ssl_ = NULL;
} }
return True(); return True(node_isolate);
} }
#ifdef OPENSSL_NPN_NEGOTIATED #ifdef OPENSSL_NPN_NEGOTIATED
@ -1945,7 +1951,7 @@ Handle<Value> Connection::GetNegotiatedProto(const Arguments& args) {
SSL_get0_next_proto_negotiated(ss->ssl_, &npn_proto, &npn_proto_len); SSL_get0_next_proto_negotiated(ss->ssl_, &npn_proto, &npn_proto_len);
if (!npn_proto) { if (!npn_proto) {
return False(); return False(node_isolate);
} }
return String::New((const char*) npn_proto, npn_proto_len); return String::New((const char*) npn_proto, npn_proto_len);
@ -1970,7 +1976,7 @@ Handle<Value> Connection::SetNPNProtocols(const Arguments& args) {
} }
ss->npnProtos_ = Persistent<Object>::New(args[0]->ToObject()); ss->npnProtos_ = Persistent<Object>::New(args[0]->ToObject());
return True(); return True(node_isolate);
}; };
#endif #endif
@ -1983,7 +1989,7 @@ Handle<Value> Connection::GetServername(const Arguments& args) {
if (ss->is_server_ && !ss->servername_.IsEmpty()) { if (ss->is_server_ && !ss->servername_.IsEmpty()) {
return ss->servername_; return ss->servername_;
} else { } else {
return False(); return False(node_isolate);
} }
} }
@ -2004,7 +2010,7 @@ Handle<Value> Connection::SetSNICallback(const Arguments& args) {
ss->sniObject_ = Persistent<Object>::New(Object::New()); ss->sniObject_ = Persistent<Object>::New(Object::New());
ss->sniObject_->Set(String::New("onselect"), args[0]); ss->sniObject_->Set(String::New("onselect"), args[0]);
return True(); return True(node_isolate);
} }
#endif #endif

7
src/node_http_parser.cc

@ -280,9 +280,12 @@ public:
Integer::New(parser_.http_minor, node_isolate)); Integer::New(parser_.http_minor, node_isolate));
message_info->Set(should_keep_alive_sym, message_info->Set(should_keep_alive_sym,
http_should_keep_alive(&parser_) ? True() : False()); http_should_keep_alive(&parser_) ? True(node_isolate)
: False(node_isolate));
message_info->Set(upgrade_sym, parser_.upgrade ? True() : False()); message_info->Set(upgrade_sym,
parser_.upgrade ? True(node_isolate)
: False(node_isolate));
Local<Value> argv[1] = { message_info }; Local<Value> argv[1] = { message_info };

6
src/node_os.cc

@ -235,8 +235,10 @@ static Handle<Value> GetInterfaceAddresses(const Arguments& args) {
o = Object::New(); o = Object::New();
o->Set(String::New("address"), String::New(ip)); o->Set(String::New("address"), String::New(ip));
o->Set(String::New("family"), family); o->Set(String::New("family"), family);
o->Set(String::New("internal"), interfaces[i].is_internal ?
True() : False()); const bool internal = interfaces[i].is_internal;
o->Set(String::New("internal"),
internal ? True(node_isolate) : False(node_isolate));
ifarr->Set(ifarr->Length(), o); ifarr->Set(ifarr->Length(), o);
} }

4
src/tcp_wrap.cc

@ -350,8 +350,8 @@ void TCPWrap::AfterConnect(uv_connect_t* req, int status) {
Integer::New(status, node_isolate), Integer::New(status, node_isolate),
Local<Value>::New(node_isolate, wrap->object_), Local<Value>::New(node_isolate, wrap->object_),
Local<Value>::New(node_isolate, req_wrap->object_), Local<Value>::New(node_isolate, req_wrap->object_),
Local<Value>::New(node_isolate, v8::True()), Local<Value>::New(node_isolate, v8::True(node_isolate)),
Local<Value>::New(node_isolate, v8::True()) Local<Value>::New(node_isolate, v8::True(node_isolate))
}; };
MakeCallback(req_wrap->object_, oncomplete_sym, ARRAY_SIZE(argv), argv); MakeCallback(req_wrap->object_, oncomplete_sym, ARRAY_SIZE(argv), argv);

7
src/tty_wrap.cc

@ -118,7 +118,12 @@ Handle<Value> TTYWrap::IsTTY(const Arguments& args) {
HandleScope scope; HandleScope scope;
int fd = args[0]->Int32Value(); int fd = args[0]->Int32Value();
assert(fd >= 0); assert(fd >= 0);
return uv_guess_handle(fd) == UV_TTY ? v8::True() : v8::False();
if (uv_guess_handle(fd) == UV_TTY) {
return v8::True(node_isolate);
}
return v8::False(node_isolate);
} }

4
src/udp_wrap.cc

@ -280,10 +280,10 @@ Handle<Value> UDPWrap::RecvStart(const Arguments& args) {
int r = uv_udp_recv_start(&wrap->handle_, OnAlloc, OnRecv); int r = uv_udp_recv_start(&wrap->handle_, OnAlloc, OnRecv);
if (r && uv_last_error(uv_default_loop()).code != UV_EALREADY) { if (r && uv_last_error(uv_default_loop()).code != UV_EALREADY) {
SetErrno(uv_last_error(uv_default_loop())); SetErrno(uv_last_error(uv_default_loop()));
return False(); return False(node_isolate);
} }
return True(); return True(node_isolate);
} }

Loading…
Cancel
Save