提交 14803625 authored 作者: Seven Du's avatar Seven Du

Merge pull request #1452 in FS/freeswitch from…

Merge pull request #1452 in FS/freeswitch from ~ANDYWOLK/freeswitch:bugfix/FS-10789-v8-segs-on-invalid-instruction to master

* commit 'db3e6ec3':
  FS-10789: [mod_v8] v8 segs on invalid instruction
......@@ -86,6 +86,11 @@
<CodeAnalysisRuleSet>NativeMinimumRules.ruleset</CodeAnalysisRuleSet>
<RunCodeAnalysis>false</RunCodeAnalysis>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<DisableSpecificWarnings>4100;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
......
......@@ -665,7 +665,12 @@ static int v8_parse_and_execute(switch_core_session_t *session, const char *inpu
// Compile the source code.
#if defined(V8_MAJOR_VERSION) && V8_MAJOR_VERSION >=5
v8::ScriptCompiler::CompileOptions options = v8::ScriptCompiler::kNoCompileOptions;
Handle<v8::Script> v8_script = v8::ScriptCompiler::Compile(context, &source, options).ToLocalChecked();
Handle<v8::Script> v8_script;
v8::MaybeLocal<v8::Script> v8_script_check = v8::ScriptCompiler::Compile(context, &source, options);
if (!v8_script_check.IsEmpty()) {
v8_script = v8_script_check.ToLocalChecked();
}
//Handle<v8::Script> v8_script = v8::ScriptCompiler::Compile(context, source,/* String::NewFromUtf8(isolate, script_file),*/ v8::ScriptCompiler::kProduceCodeCache).ToLocalChecked();
//source->GetCachedData();
#else
......
......@@ -253,7 +253,7 @@ JS_DBH_FUNCTION_IMPL(query)
if (err) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error %s\n", err);
switch_core_db_free(err);
switch_safe_free(err);
info.GetReturnValue().Set(false);
}
}
......
......@@ -158,7 +158,11 @@ void JSBase::CreateInstance(const v8::FunctionCallbackInfo<Value>& args)
v8::Local<v8::Context> context = isolate->GetCurrentContext();
v8::Local<v8::String> key = String::NewFromUtf8(isolate, "constructor_method");
v8::Local<v8::Private> privateKey = v8::Private::ForApi(isolate, key);
Handle<External> ex = Handle<External>::Cast(args.Callee()->GetPrivate(context, privateKey).ToLocalChecked());
Handle<External> ex;
v8::MaybeLocal<v8::Value> hiddenValue = args.Callee()->GetPrivate(context, privateKey);
if (!hiddenValue.IsEmpty()) {
ex = Handle<External>::Cast(hiddenValue.ToLocalChecked());
}
#else
Handle<External> ex = Handle<External>::Cast(args.Callee()->GetHiddenValue(String::NewFromUtf8(args.GetIsolate(), "constructor_method")));
#endif
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论