Don’t enter node::MakeCallback if we have a calling context
this means we already have JavaScript frames on the execution stack
This commit is contained in:
parent
fe756bdc86
commit
1e58351ace
|
@ -38,6 +38,14 @@ inline v8::Local<v8::Value> node::Function::call(v8::Isolate* isolate, const v8:
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
inline v8::Local<v8::Value> node::Function::callback(v8::Isolate* isolate, const v8::Local<v8::Function> &function, const v8::Local<v8::Object> &this_object, size_t argc, const v8::Local<v8::Value> arguments[]) {
|
inline v8::Local<v8::Value> node::Function::callback(v8::Isolate* isolate, const v8::Local<v8::Function> &function, const v8::Local<v8::Object> &this_object, size_t argc, const v8::Local<v8::Value> arguments[]) {
|
||||||
|
if (!isolate->GetCallingContext().IsEmpty()) {
|
||||||
|
// if there are any JavaScript frames on the stack below this one we don't need to
|
||||||
|
// go through the trouble of calling MakeCallback. MakeCallback is only for when a
|
||||||
|
// thread with no JavaScript frames on its stack needs to call into JavaScript, like in
|
||||||
|
// an uv_async callback.
|
||||||
|
return call(isolate, function, this_object, argc, arguments);
|
||||||
|
}
|
||||||
|
|
||||||
v8::TryCatch trycatch(isolate);
|
v8::TryCatch trycatch(isolate);
|
||||||
|
|
||||||
auto recv = this_object.IsEmpty() ? isolate->GetCurrentContext()->Global() : this_object;
|
auto recv = this_object.IsEmpty() ? isolate->GetCurrentContext()->Global() : this_object;
|
||||||
|
|
Loading…
Reference in New Issue