Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(333)

Unified Diff: Source/bindings/core/v8/custom/V8InjectedScriptHostCustom.cpp

Issue 1003043002: bindings: Use Maybe APIs in V8ScriptRunner (part 1) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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())
+ 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())
haraken 2015/03/13 04:31:16 What is this check for?
bashi 2015/03/13 05:15:20 I think when this is true, following V8 APIs will
+ 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);

Powered by Google App Engine
This is Rietveld 408576698