TryCatch try_catch;
- domain = domain_v->ToObject();
- assert(!domain.IsEmpty());
- if (domain->Get(disposed_symbol)->IsTrue()) {
- // domain has been disposed of.
- return Undefined(node_isolate);
- }
- enter = Local<Function>::Cast(domain->Get(enter_symbol));
- assert(!enter.IsEmpty());
- enter->Call(domain, 0, NULL);
+ bool has_domain = domain_v->IsObject();
+ if (has_domain) {
+ domain = domain_v->ToObject();
+ assert(!domain.IsEmpty());
+ if (domain->Get(disposed_symbol)->IsTrue()) {
+ // domain has been disposed of.
- return Undefined();
++ return Undefined(node_isolate);
+ }
+ enter = Local<Function>::Cast(domain->Get(enter_symbol));
+ assert(!enter.IsEmpty());
+ enter->Call(domain, 0, NULL);
- if (try_catch.HasCaught()) {
- FatalException(try_catch);
- return Undefined(node_isolate);
+ if (try_catch.HasCaught()) {
+ FatalException(try_catch);
- return Undefined();
++ return Undefined(node_isolate);
+ }
}
Local<Value> ret = callback->Call(object, argc, argv);
if (try_catch.HasCaught()) {
FatalException(try_catch);
- return Undefined();
+ return Undefined(node_isolate);
}
- exit = Local<Function>::Cast(domain->Get(exit_symbol));
- assert(!exit.IsEmpty());
- exit->Call(domain, 0, NULL);
+ if (has_domain) {
+ exit = Local<Function>::Cast(domain->Get(exit_symbol));
+ assert(!exit.IsEmpty());
+ exit->Call(domain, 0, NULL);
- if (try_catch.HasCaught()) {
- FatalException(try_catch);
- return Undefined(node_isolate);
+ if (try_catch.HasCaught()) {
+ FatalException(try_catch);
- return Undefined();
++ return Undefined(node_isolate);
+ }
}
if (tick_infobox.length == 0) {
const Handle<String> symbol,
int argc,
Handle<Value> argv[]) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
Local<Function> callback = object->Get(symbol).As<Function>();
- Local<Value> domain = object->Get(domain_symbol);
- // has domain, off with you
- if (!domain->IsNull() && !domain->IsUndefined())
+ if (using_domains)
return scope.Close(MakeDomainCallback(object, callback, argc, argv));
return scope.Close(MakeCallback(object, callback, argc, argv));
}