Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ env:
- export NODE_VERSION="4"
- export NODE_VERSION="5"
- export NODE_VERSION="6"
- export NODE_VERSION="7"
global:
- node_pre_gyp_region="eu-central-1"

Expand Down
19 changes: 18 additions & 1 deletion src/debug.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,24 @@ namespace nodex {
}

Local<Function> fn = Local<Function>::Cast(info[0]);
v8::Debug::Call(fn);

#if (NODE_MODULE_VERSION > 48)
Local<Context> context = fn->GetIsolate()->GetCurrentContext();
v8::Debug::Call(context, fn);
#else
v8::Debug::Call(fn);
#endif
RETURN(Undefined());
};

static NAN_METHOD(SendCommand) {
String::Value command(info[0]);
#if (NODE_MODULE_VERSION > 11)
#if (NODE_MODULE_VERSION > 48)
Isolate* debug_isolate = v8::Debug::GetDebugContext(Isolate::GetCurrent())->GetIsolate();
#else
Isolate* debug_isolate = v8::Debug::GetDebugContext()->GetIsolate();
#endif
v8::HandleScope debug_scope(debug_isolate);
v8::Debug::SendCommand(debug_isolate, *command, command.length());
#else
Expand All @@ -58,12 +67,20 @@ namespace nodex {
if (expression.IsEmpty())
RETURN(Undefined());

#if (NODE_MODULE_VERSION > 48)
Local<Context> debug_context = v8::Debug::GetDebugContext(Isolate::GetCurrent());
#else
Local<Context> debug_context = v8::Debug::GetDebugContext();
#endif
#if (NODE_MODULE_VERSION > 45)
if (debug_context.IsEmpty()) {
// Force-load the debug context.
v8::Debug::GetMirror(info.GetIsolate()->GetCurrentContext(), info[0]);
#if (NODE_MODULE_VERSION > 48)
debug_context = v8::Debug::GetDebugContext(Isolate::GetCurrent());
#else
debug_context = v8::Debug::GetDebugContext();
#endif
}
#endif

Expand Down
5 changes: 4 additions & 1 deletion v8-debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,10 @@ function sendCommand(name, attributes, userdata) {
command: name,
arguments: attributes || {}
};
binding.sendCommand(JSON.stringify(message));
// don't know why yet
process.nextTick(function() {
binding.sendCommand(JSON.stringify(message))
});
};

V8Debug.prototype.commandToEvent = function(request, response) {
Expand Down