mod_v8: Minor tweaks to keep up with recent V8 API changes
This commit is contained in:
parent
bd72cd9cc1
commit
c679d98eb7
|
@ -565,7 +565,7 @@ static int v8_parse_and_execute(switch_core_session_t *session, const char *inpu
|
|||
TryCatch try_catch;
|
||||
|
||||
// Compile the source code.
|
||||
Handle<Script> v8_script = Script::Compile(source, Handle<Value>::New(isolate, String::NewFromUtf8(isolate, script_file)));
|
||||
Handle<Script> v8_script = Script::Compile(source, Local<Value>::New(isolate, String::NewFromUtf8(isolate, script_file)));
|
||||
|
||||
if (try_catch.HasCaught()) {
|
||||
v8_error(isolate, &try_catch);
|
||||
|
|
|
@ -122,7 +122,7 @@ int FSCoreDB::Callback(void *pArg, int argc, char **argv, char **columnNames)
|
|||
}
|
||||
|
||||
HandleScope scope(dbo->GetIsolate());
|
||||
Handle<Function> func = Handle<Function>::New(dbo->GetIsolate(), dbo->_callback);
|
||||
Handle<Function> func = Local<Function>::New(dbo->GetIsolate(), dbo->_callback);
|
||||
Handle<Value> jsargv[1] = { arg };
|
||||
|
||||
func->Call(dbo->GetIsolate()->GetCurrentContext()->Global(), 1, jsargv);
|
||||
|
|
|
@ -72,7 +72,7 @@ size_t FSCURL::FileCallback(void *ptr, size_t size, size_t nmemb, void *data)
|
|||
Handle<Function> func;
|
||||
|
||||
if (!obj->_function.IsEmpty()) {
|
||||
func = Handle<Function>::New(obj->GetIsolate(), obj->_function);
|
||||
func = Local<Function>::New(obj->GetIsolate(), obj->_function);
|
||||
}
|
||||
|
||||
if (!func.IsEmpty()) {
|
||||
|
@ -83,7 +83,7 @@ size_t FSCURL::FileCallback(void *ptr, size_t size, size_t nmemb, void *data)
|
|||
argv[argc++] = String::NewFromUtf8(obj->GetIsolate(), "");
|
||||
}
|
||||
if (!obj->_user_data.IsEmpty()) {
|
||||
argv[argc++] = Handle<Value>::New(obj->GetIsolate(), Persistent<Value>::Cast(obj->_user_data));
|
||||
argv[argc++] = Local<Value>::New(obj->GetIsolate(), Persistent<Value>::Cast(obj->_user_data));
|
||||
}
|
||||
|
||||
Handle<Value> res = func->Call(obj->GetIsolate()->GetCurrentContext()->Global(), argc, argv);
|
||||
|
@ -94,7 +94,7 @@ size_t FSCURL::FileCallback(void *ptr, size_t size, size_t nmemb, void *data)
|
|||
obj->_ret.Reset();
|
||||
}
|
||||
|
||||
String::Utf8Value str(Handle<Value>::New(obj->GetIsolate(), res));
|
||||
String::Utf8Value str(Local<Value>::New(obj->GetIsolate(), res));
|
||||
|
||||
if ((ret = *str)) {
|
||||
if (!strcmp(ret, "true") || !strcmp(ret, "undefined")) {
|
||||
|
|
|
@ -213,11 +213,11 @@ switch_status_t FSSession::CommonCallback(switch_core_session_t *session, void *
|
|||
HandleScope handle_scope(isolate);
|
||||
|
||||
if (cb_state->jss_a && cb_state->jss_a->_session && cb_state->jss_a->_session == session) {
|
||||
argv[argc++] = Handle<Object>::New(isolate, cb_state->session_obj_a);
|
||||
argv[argc++] = Local<Object>::New(isolate, cb_state->session_obj_a);
|
||||
} else if (cb_state->jss_b && cb_state->jss_b->_session && cb_state->jss_b->_session == session) {
|
||||
argv[argc++] = Handle<Object>::New(isolate, cb_state->session_obj_b);
|
||||
argv[argc++] = Local<Object>::New(isolate, cb_state->session_obj_b);
|
||||
} else {
|
||||
argv[argc++] = Handle<Object>::New(isolate, cb_state->session_state->GetJavaScriptObject());
|
||||
argv[argc++] = Local<Object>::New(isolate, cb_state->session_state->GetJavaScriptObject());
|
||||
}
|
||||
|
||||
switch (itype) {
|
||||
|
@ -226,7 +226,7 @@ switch_status_t FSSession::CommonCallback(switch_core_session_t *session, void *
|
|||
Event = FSEvent::New(event, "", cb_state->session_state->GetOwner());
|
||||
if (!Event.IsEmpty()) {
|
||||
argv[argc++] = String::NewFromUtf8(isolate, "event");
|
||||
argv[argc++] = Handle<Object>::New(isolate, Event);
|
||||
argv[argc++] = Local<Object>::New(isolate, Event);
|
||||
}
|
||||
}
|
||||
if (Event.IsEmpty()) {
|
||||
|
@ -241,7 +241,7 @@ switch_status_t FSSession::CommonCallback(switch_core_session_t *session, void *
|
|||
Event = FSDTMF::New(dtmf, "", cb_state->session_state->GetOwner());
|
||||
if (!Event.IsEmpty()) {
|
||||
argv[argc++] = String::NewFromUtf8(isolate, "dtmf");
|
||||
argv[argc++] = Handle<Object>::New(isolate, Event);
|
||||
argv[argc++] = Local<Object>::New(isolate, Event);
|
||||
} else {
|
||||
goto done;
|
||||
}
|
||||
|
@ -251,14 +251,14 @@ switch_status_t FSSession::CommonCallback(switch_core_session_t *session, void *
|
|||
}
|
||||
|
||||
if (!cb_state->arg.IsEmpty()) {
|
||||
argv[argc++] = Handle<Value>::New(isolate, cb_state->arg);
|
||||
argv[argc++] = Local<Value>::New(isolate, cb_state->arg);
|
||||
}
|
||||
|
||||
CheckHangupHook(cb_state->session_state, &ret);
|
||||
|
||||
if (ret) {
|
||||
if (!cb_state->function.IsEmpty()) {
|
||||
Handle<Function> func = Handle<Function>::New(isolate, cb_state->function);
|
||||
Handle<Function> func = Local<Function>::New(isolate, cb_state->function);
|
||||
|
||||
if (func->IsFunction()) {
|
||||
Handle<Value> res = func->Call(isolate->GetCurrentContext()->Global(), argc, argv);
|
||||
|
@ -299,7 +299,7 @@ switch_status_t FSSession::StreamInputCallback(switch_core_session_t *session, v
|
|||
}
|
||||
|
||||
if (!cb_state->ret.IsEmpty()) {
|
||||
Handle<Value> tmp = Handle<Value>::New(obj->GetOwner()->GetIsolate(), cb_state->ret);
|
||||
Handle<Value> tmp = Local<Value>::New(obj->GetOwner()->GetIsolate(), cb_state->ret);
|
||||
String::Utf8Value str(tmp);
|
||||
const char *ret = js_safe_str(*str);
|
||||
|
||||
|
@ -410,7 +410,7 @@ switch_status_t FSSession::RecordInputCallback(switch_core_session_t *session, v
|
|||
}
|
||||
|
||||
if (!cb_state->ret.IsEmpty()) {
|
||||
Handle<Value> tmp = Handle<Value>::New(obj->GetOwner()->GetIsolate(), cb_state->ret);
|
||||
Handle<Value> tmp = Local<Value>::New(obj->GetOwner()->GetIsolate(), cb_state->ret);
|
||||
String::Utf8Value str(tmp);
|
||||
const char *ret = js_safe_str(*str);
|
||||
|
||||
|
@ -451,7 +451,7 @@ switch_status_t FSSession::CollectInputCallback(switch_core_session_t *session,
|
|||
}
|
||||
|
||||
if (!cb_state->ret.IsEmpty()) {
|
||||
Handle<Value> tmp = Handle<Value>::New(obj->GetOwner()->GetIsolate(), cb_state->ret);
|
||||
Handle<Value> tmp = Local<Value>::New(obj->GetOwner()->GetIsolate(), cb_state->ret);
|
||||
String::Utf8Value str(tmp);
|
||||
ret = js_safe_str(*str);
|
||||
|
||||
|
@ -703,7 +703,7 @@ bool FSSession::CheckHangupHook(FSSession *obj, bool *ret)
|
|||
|
||||
if (obj && !obj->_check_state && !obj->_on_hangup.IsEmpty() && (obj->_hook_state == CS_HANGUP || obj->_hook_state == CS_ROUTING)) {
|
||||
obj->_check_state++;
|
||||
argv[argc++] = Handle<Object>::New(obj->GetOwner()->GetIsolate(), obj->GetJavaScriptObject());
|
||||
argv[argc++] = Local<Object>::New(obj->GetOwner()->GetIsolate(), obj->GetJavaScriptObject());
|
||||
|
||||
if (obj->_hook_state == CS_HANGUP) {
|
||||
argv[argc++] = String::NewFromUtf8(isolate, "hangup");
|
||||
|
@ -712,7 +712,7 @@ bool FSSession::CheckHangupHook(FSSession *obj, bool *ret)
|
|||
}
|
||||
|
||||
// Run the hangup hook
|
||||
Handle<Function> func = Handle<Function>::New(isolate, obj->_on_hangup);
|
||||
Handle<Function> func = Local<Function>::New(isolate, obj->_on_hangup);
|
||||
|
||||
if (!func.IsEmpty() && func->IsFunction()) {
|
||||
Handle<Value> res = func->Call(isolate->GetCurrentContext()->Global(), argc, argv);
|
||||
|
|
|
@ -275,10 +275,10 @@ JS_TELETONE_FUNCTION_IMPL(Generate)
|
|||
aargv[aargc++] = String::NewFromUtf8(info.GetIsolate(), dtmf);
|
||||
|
||||
if (!_arg.IsEmpty()) {
|
||||
aargv[aargc++] = Handle<Value>::New(info.GetIsolate(), _arg);
|
||||
aargv[aargc++] = Local<Value>::New(info.GetIsolate(), _arg);
|
||||
}
|
||||
|
||||
Handle<Function> func = Handle<Function>::New(info.GetIsolate(), _function);
|
||||
Handle<Function> func = Local<Function>::New(info.GetIsolate(), _function);
|
||||
Handle<Value> res = func->Call(info.GetIsolate()->GetCurrentContext()->Global(), aargc, aargv);
|
||||
|
||||
String::Utf8Value tmp(res);
|
||||
|
|
|
@ -83,7 +83,7 @@ JSBase::~JSBase(void)
|
|||
Handle<Object> JSBase::GetJavaScriptObject()
|
||||
{
|
||||
/* Returns the javascript object related to this C++ instance */
|
||||
return Handle<Object>::New(GetIsolate(), *persistentHandle);
|
||||
return Local<Object>::New(GetIsolate(), *persistentHandle);
|
||||
}
|
||||
|
||||
void JSBase::AddInstance(Isolate *isolate, const Handle<Object>& handle, const Handle<External>& object, bool autoDestroy)
|
||||
|
|
|
@ -302,7 +302,7 @@ const string JSMain::ExecuteString(const string& scriptData, const string& fileN
|
|||
TryCatch try_catch;
|
||||
|
||||
// Compile the source code.
|
||||
Handle<Script> script = Script::Compile(source, Handle<Value>::New(isolate, String::NewFromUtf8(isolate, fileName.c_str())));
|
||||
Handle<Script> script = Script::Compile(source, Local<Value>::New(isolate, String::NewFromUtf8(isolate, fileName.c_str())));
|
||||
|
||||
if (try_catch.HasCaught()) {
|
||||
res = JSMain::GetExceptionInfo(isolate, &try_catch);
|
||||
|
|
Loading…
Reference in New Issue