Chromium Code Reviews| Index: Source/bindings/core/v8/custom/V8InjectedScriptHostCustom.cpp |
| diff --git a/Source/bindings/core/v8/custom/V8InjectedScriptHostCustom.cpp b/Source/bindings/core/v8/custom/V8InjectedScriptHostCustom.cpp |
| index c169b37bca1197a1324d0529837def04cd6c4c7a..572b8eece0d4a42e5155d85197e644584d051605 100644 |
| --- a/Source/bindings/core/v8/custom/V8InjectedScriptHostCustom.cpp |
| +++ b/Source/bindings/core/v8/custom/V8InjectedScriptHostCustom.cpp |
| @@ -378,9 +378,10 @@ void V8InjectedScriptHost::evalMethodCustom(const v8::FunctionCallbackInfo<v8::V |
| ASSERT(isolate->InContext()); |
| v8::TryCatch tryCatch; |
| - v8::Handle<v8::Value> result = V8ScriptRunner::compileAndRunInternalScript(expression, info.GetIsolate()); |
| - if (tryCatch.HasCaught()) { |
| - v8SetReturnValue(info, tryCatch.ReThrow()); |
| + v8::Local<v8::Value> result; |
| + if (!V8ScriptRunner::compileAndRunInternalScript(expression, info.GetIsolate()).ToLocal(&result)) { |
| + if (tryCatch.HasCaught()) |
|
dcarney
2015/03/13 08:15:46
use a macro for this pattern
bashi
2015/03/17 02:01:36
Done.
|
| + v8SetReturnValue(info, tryCatch.ReThrow()); |
| return; |
| } |
| v8SetReturnValue(info, result); |
| @@ -402,15 +403,20 @@ void V8InjectedScriptHost::evaluateWithExceptionDetailsMethodCustom(const v8::Fu |
| ASSERT(isolate->InContext()); |
| v8::TryCatch tryCatch; |
| - v8::Handle<v8::Script> script = V8ScriptRunner::compileScript(expression, String(), String(), TextPosition(), isolate); |
| - v8::Handle<v8::Value> result = V8ScriptRunner::runCompiledScript(isolate, script, currentExecutionContext(isolate)); |
| + v8::Local<v8::Script> script; |
| + v8::MaybeLocal<v8::Value> result; |
| + if (V8ScriptRunner::compileScript(expression, String(), String(), TextPosition(), isolate).ToLocal(&script)) |
| + result = V8ScriptRunner::runCompiledScript(isolate, script, currentExecutionContext(isolate)); |
| + if (!tryCatch.CanContinue()) |
| + return; |
| v8::Local<v8::Object> wrappedResult = v8::Object::New(isolate); |
| if (tryCatch.HasCaught()) { |
| wrappedResult->Set(v8::String::NewFromUtf8(isolate, "result"), tryCatch.Exception()); |
| wrappedResult->Set(v8::String::NewFromUtf8(isolate, "exceptionDetails"), JavaScriptCallFrame::createExceptionDetails(isolate, tryCatch.Message())); |
| } else { |
| - wrappedResult->Set(v8::String::NewFromUtf8(isolate, "result"), result); |
| + ASSERT(!result.IsEmpty()); |
| + wrappedResult->Set(v8::String::NewFromUtf8(isolate, "result"), result.ToLocalChecked()); |
| wrappedResult->Set(v8::String::NewFromUtf8(isolate, "exceptionDetails"), v8::Undefined(isolate)); |
| } |
| v8SetReturnValue(info, wrappedResult); |