Index: gin/shell_runner.cc |
diff --git a/gin/shell_runner.cc b/gin/shell_runner.cc |
index 8d98e425d745da3ec3236d0f08745fb16e84a4d1..ee856bd64437d6c6942e9e482534ed5692b0f9f4 100644 |
--- a/gin/shell_runner.cc |
+++ b/gin/shell_runner.cc |
@@ -67,9 +67,11 @@ void ShellRunner::Run(const std::string& source, |
const std::string& resource_name) { |
TryCatch try_catch; |
v8::Isolate* isolate = GetContextHolder()->isolate(); |
- v8::Handle<Script> script = Script::Compile( |
- StringToV8(isolate, source), StringToV8(isolate, resource_name)); |
- if (try_catch.HasCaught()) { |
+ v8::ScriptOrigin origin(StringToV8(isolate, resource_name)); |
+ auto maybe_script = Script::Compile(GetContextHolder()->context(), |
+ StringToV8(isolate, source), &origin); |
+ v8::Local<Script> script; |
+ if (!maybe_script.ToLocal(&script)) { |
delegate_->UnhandledException(this, try_catch); |
return; |
} |
@@ -84,10 +86,12 @@ v8::Handle<v8::Value> ShellRunner::Call(v8::Handle<v8::Function> function, |
TryCatch try_catch; |
delegate_->WillRunScript(this); |
- v8::Handle<v8::Value> result = function->Call(receiver, argc, argv); |
+ auto maybe_result = |
+ function->Call(GetContextHolder()->context(), receiver, argc, argv); |
delegate_->DidRunScript(this); |
- if (try_catch.HasCaught()) |
+ v8::Local<v8::Value> result; |
+ if (!maybe_result.ToLocal(&result)) |
delegate_->UnhandledException(this, try_catch); |
return result; |
@@ -101,10 +105,11 @@ void ShellRunner::Run(v8::Handle<Script> script) { |
TryCatch try_catch; |
delegate_->WillRunScript(this); |
- script->Run(); |
+ auto maybe = script->Run(GetContextHolder()->context()); |
delegate_->DidRunScript(this); |
- if (try_catch.HasCaught()) { |
+ v8::Local<v8::Value> result; |
+ if (!maybe.ToLocal(&result)) { |
delegate_->UnhandledException(this, try_catch); |
} |
} |