Skip to content

Commit

Permalink
fix: fix the deprecated warnings (#40)
Browse files Browse the repository at this point in the history
* fix: fix the deprecated warnings
  • Loading branch information
hustxiaoc authored Mar 28, 2017
1 parent 6894f71 commit b087816
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/InjectedScriptHost.cc
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ namespace nodex {
Local<String> constructorSymbol = CHK(New("constructor"));
if (object->HasRealNamedProperty(constructorSymbol) && !object->HasRealNamedCallbackProperty(constructorSymbol)) {
TryCatch tryCatch;
Local<Value> constructor = object->GetRealNamedProperty(constructorSymbol);
Local<Value> constructor = Nan::GetRealNamedProperty(object, constructorSymbol).ToLocalChecked();
if (!constructor.IsEmpty() && constructor->IsFunction()) {
Local<String> constructorName = functionDisplayName(Handle<Function>::Cast(constructor));
if (!constructorName.IsEmpty() && !tryCatch.HasCaught())
Expand Down
8 changes: 4 additions & 4 deletions src/debug.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace nodex {

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

#if (NODE_MODULE_VERSION > 48)
#if (NODE_MODULE_VERSION > 47)
Local<Context> context = fn->GetIsolate()->GetCurrentContext();
v8::Debug::Call(context, fn);
#else
Expand All @@ -48,7 +48,7 @@ namespace nodex {
static NAN_METHOD(SendCommand) {
String::Value command(info[0]);
#if (NODE_MODULE_VERSION > 11)
#if (NODE_MODULE_VERSION > 48)
#if (NODE_MODULE_VERSION > 47)
Isolate* debug_isolate = v8::Debug::GetDebugContext(Isolate::GetCurrent())->GetIsolate();
#else
Isolate* debug_isolate = v8::Debug::GetDebugContext()->GetIsolate();
Expand All @@ -67,7 +67,7 @@ namespace nodex {
if (expression.IsEmpty())
RETURN(Undefined());

#if (NODE_MODULE_VERSION > 48)
#if (NODE_MODULE_VERSION > 47)
Local<Context> debug_context = v8::Debug::GetDebugContext(Isolate::GetCurrent());
#else
Local<Context> debug_context = v8::Debug::GetDebugContext();
Expand All @@ -76,7 +76,7 @@ namespace nodex {
if (debug_context.IsEmpty()) {
// Force-load the debug context.
v8::Debug::GetMirror(info.GetIsolate()->GetCurrentContext(), info[0]);
#if (NODE_MODULE_VERSION > 48)
#if (NODE_MODULE_VERSION > 47)
debug_context = v8::Debug::GetDebugContext(Isolate::GetCurrent());
#else
debug_context = v8::Debug::GetDebugContext();
Expand Down
8 changes: 6 additions & 2 deletions test/v8-debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ describe('v8-debug', function() {
expect(v8debug.registerAgentCommand.bind(v8debug, 'command', [], function() {
done();
})).to.not.throw();
v8debug.sendCommand('command');
process.nextTick(function() {
v8debug.sendCommand('command');
});
});
} else {
it('enableWebkitProtocol should throw error', function() {
Expand All @@ -56,7 +58,9 @@ describe('v8-debug', function() {
describe('events.', function() {
it('Emits `close` on disconnect command', function(done) {
v8debug.on('close', done);
v8debug.sendCommand('disconnect');
process.nextTick(function() {
v8debug.sendCommand('disconnect');
});
});
});
});
5 changes: 1 addition & 4 deletions v8-debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,7 @@ function sendCommand(name, attributes, userdata) {
command: name,
arguments: attributes || {}
};
// don't know why yet
process.nextTick(function() {
binding.sendCommand(JSON.stringify(message))
});
binding.sendCommand(JSON.stringify(message));
};

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

0 comments on commit b087816

Please sign in to comment.