From cbb18a596a0696b65fcb116744ee86492421ec2b Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Tue, 1 Jan 2019 11:22:23 -0500 Subject: Properly internalize V8 strings. --- libdeno/binding.cc | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'libdeno/binding.cc') diff --git a/libdeno/binding.cc b/libdeno/binding.cc index eb83d2363..9e93bfca8 100644 --- a/libdeno/binding.cc +++ b/libdeno/binding.cc @@ -66,12 +66,6 @@ const char* ToCString(const v8::String::Utf8Value& value) { return *value ? *value : ""; } -static inline v8::Local v8_str(const char* x) { - return v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), x, - v8::NewStringType::kNormal) - .ToLocalChecked(); -} - std::string EncodeExceptionAsJSON(v8::Local context, v8::Local exception) { auto* isolate = context->GetIsolate(); @@ -360,7 +354,7 @@ bool ExecuteV8StringSource(v8::Local context, v8::TryCatch try_catch(isolate); - auto name = v8_str(js_filename); + auto name = v8_str(js_filename, true); v8::ScriptOrigin origin(name); @@ -388,7 +382,7 @@ bool Execute(v8::Local context, const char* js_filename, auto* isolate = context->GetIsolate(); v8::Isolate::Scope isolate_scope(isolate); v8::HandleScope handle_scope(isolate); - auto source = v8_str(js_source); + auto source = v8_str(js_source, true); return ExecuteV8StringSource(context, js_filename, source); } -- cgit v1.2.3