const PropertyCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- Local<Object> data = args.Data()->ToObject();
- ContextifyContext* ctx = ObjectWrap::Unwrap<ContextifyContext>(data);
+ ContextifyContext* ctx = NULL;
+ NODE_UNWRAP(args.Data().As<Object>(), ContextifyContext, ctx);
Local<Object> sandbox = PersistentToLocal(node_isolate, ctx->sandbox_);
Local<Value> rv = sandbox->GetRealNamedProperty(property);
const PropertyCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- Local<Object> data = args.Data()->ToObject();
- ContextifyContext* ctx = ObjectWrap::Unwrap<ContextifyContext>(data);
+ ContextifyContext* ctx = NULL;
+ NODE_UNWRAP(args.Data().As<Object>(), ContextifyContext, ctx);
PersistentToLocal(node_isolate, ctx->sandbox_)->Set(property, value);
}
const PropertyCallbackInfo<Integer>& args) {
HandleScope scope(node_isolate);
- Local<Object> data = args.Data()->ToObject();
- ContextifyContext* ctx = ObjectWrap::Unwrap<ContextifyContext>(data);
+ ContextifyContext* ctx = NULL;
+ NODE_UNWRAP(args.Data().As<Object>(), ContextifyContext, ctx);
Local<Object> sandbox = PersistentToLocal(node_isolate, ctx->sandbox_);
Local<Object> proxy_global = PersistentToLocal(node_isolate,
const PropertyCallbackInfo<Boolean>& args) {
HandleScope scope(node_isolate);
- Local<Object> data = args.Data()->ToObject();
- ContextifyContext* ctx = ObjectWrap::Unwrap<ContextifyContext>(data);
+ ContextifyContext* ctx = NULL;
+ NODE_UNWRAP(args.Data().As<Object>(), ContextifyContext, ctx);
bool success = PersistentToLocal(node_isolate,
ctx->sandbox_)->Delete(property);
const PropertyCallbackInfo<Array>& args) {
HandleScope scope(node_isolate);
- Local<Object> data = args.Data()->ToObject();
- ContextifyContext* ctx = ObjectWrap::Unwrap<ContextifyContext>(data);
+ ContextifyContext* ctx = NULL;
+ NODE_UNWRAP(args.Data().As<Object>(), ContextifyContext, ctx);
Local<Object> sandbox = PersistentToLocal(node_isolate, ctx->sandbox_);
args.GetReturnValue().Set(sandbox->GetPropertyNames());
}
};
-class ContextifyScript : ObjectWrap {
+class ContextifyScript : public ObjectWrap {
private:
Persistent<Script> script_;
const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- Base* w = ObjectWrap::Unwrap<Base>(args.This());
+ Base* w = NULL;
+ NODE_UNWRAP(args.This(), Base, w);
Environment* env = w->env();
Local<Object> info = Object::New();
void SSLWrap<Base>::GetSession(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- Base* w = ObjectWrap::Unwrap<Base>(args.This());
+ Base* w = NULL;
+ NODE_UNWRAP(args.This(), Base, w);
SSL_SESSION* sess = SSL_get_session(w->ssl_);
if (sess == NULL)
void SSLWrap<Base>::SetSession(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- Base* w = ObjectWrap::Unwrap<Base>(args.This());
+ Base* w = NULL;
+ NODE_UNWRAP(args.This(), Base, w);
if (args.Length() < 1 ||
(!args[0]->IsString() && !Buffer::HasInstance(args[0]))) {
void SSLWrap<Base>::LoadSession(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- Base* w = ObjectWrap::Unwrap<Base>(args.This());
+ Base* w = NULL;
+ NODE_UNWRAP(args.This(), Base, w);
Environment* env = w->env();
if (args.Length() >= 1 && Buffer::HasInstance(args[0])) {
template <class Base>
void SSLWrap<Base>::IsSessionReused(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- Base* w = ObjectWrap::Unwrap<Base>(args.This());
+ Base* w = NULL;
+ NODE_UNWRAP(args.This(), Base, w);
bool yes = SSL_session_reused(w->ssl_);
args.GetReturnValue().Set(yes);
}
template <class Base>
void SSLWrap<Base>::ReceivedShutdown(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- Base* w = ObjectWrap::Unwrap<Base>(args.This());
+ Base* w = NULL;
+ NODE_UNWRAP(args.This(), Base, w);
bool yes = SSL_get_shutdown(w->ssl_) == SSL_RECEIVED_SHUTDOWN;
args.GetReturnValue().Set(yes);
}
template <class Base>
void SSLWrap<Base>::EndParser(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
-
- Base* w = ObjectWrap::Unwrap<Base>(args.This());
-
+ Base* w = NULL;
+ NODE_UNWRAP(args.This(), Base, w);
w->hello_parser_.End();
}
void SSLWrap<Base>::Renegotiate(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- Base* w = ObjectWrap::Unwrap<Base>(args.This());
+ Base* w = NULL;
+ NODE_UNWRAP(args.This(), Base, w);
ClearErrorOnReturn clear_error_on_return;
(void) &clear_error_on_return; // Silence unused variable warning.
template <class Base>
void SSLWrap<Base>::IsInitFinished(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- Base* w = ObjectWrap::Unwrap<Base>(args.This());
+ Base* w = NULL;
+ NODE_UNWRAP(args.This(), Base, w);
bool yes = SSL_is_init_finished(w->ssl_);
args.GetReturnValue().Set(yes);
}
void SSLWrap<Base>::VerifyError(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- Base* w = ObjectWrap::Unwrap<Base>(args.This());
+ Base* w = NULL;
+ NODE_UNWRAP(args.This(), Base, w);
// XXX(indutny) Do this check in JS land?
X509* peer_cert = SSL_get_peer_certificate(w->ssl_);
void SSLWrap<Base>::GetCurrentCipher(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- Base* w = ObjectWrap::Unwrap<Base>(args.This());
+ Base* w = NULL;
+ NODE_UNWRAP(args.This(), Base, w);
Environment* env = w->env();
OPENSSL_CONST SSL_CIPHER* c = SSL_get_current_cipher(w->ssl_);
const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- Base* w = ObjectWrap::Unwrap<Base>(args.This());
+ Base* w = NULL;
+ NODE_UNWRAP(args.This(), Base, w);
if (w->is_client()) {
if (w->selected_npn_proto_.IsEmpty() == false) {
void SSLWrap<Base>::SetNPNProtocols(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- Base* w = ObjectWrap::Unwrap<Base>(args.This());
+ Base* w = NULL;
+ NODE_UNWRAP(args.This(), Base, w);
if (args.Length() < 1 || !Buffer::HasInstance(args[0]))
return ThrowTypeError("Must give a Buffer as first argument");