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

Unified Diff: Source/bindings/core/v8/ScriptDebugServer.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/ScriptDebugServer.cpp
diff --git a/Source/bindings/core/v8/ScriptDebugServer.cpp b/Source/bindings/core/v8/ScriptDebugServer.cpp
index b3216357a0b38304408919a6b39ce53a7967c4f8..aa18c7e974541d536d485a53eed6bf776d3641c1 100644
--- a/Source/bindings/core/v8/ScriptDebugServer.cpp
+++ b/Source/bindings/core/v8/ScriptDebugServer.cpp
@@ -614,8 +614,7 @@ void ScriptDebugServer::ensureDebuggerScriptCompiled()
v8::Context::Scope contextScope(v8::Debug::GetDebugContext());
const blink::WebData& debuggerScriptSourceResource = blink::Platform::current()->loadResource("DebuggerScriptSource.js");
v8::Handle<v8::String> source = v8String(m_isolate, String(debuggerScriptSourceResource.data(), debuggerScriptSourceResource.size()));
- v8::Local<v8::Value> value = V8ScriptRunner::compileAndRunInternalScript(source, m_isolate);
- ASSERT(!value.IsEmpty());
+ v8::Local<v8::Value> value = V8ScriptRunner::compileAndRunInternalScript(source, m_isolate).ToLocalChecked();
haraken 2015/03/18 01:58:51 Wouldn't it be better to use ToLocal and return ea
bashi 2015/03/18 02:33:11 Will do.
ASSERT(value->IsObject());
m_debuggerScript.Reset(m_isolate, v8::Handle<v8::Object>::Cast(value));
}
@@ -697,8 +696,8 @@ void ScriptDebugServer::compileScript(ScriptState* scriptState, const String& ex
v8::Handle<v8::String> source = v8String(m_isolate, expression);
v8::TryCatch tryCatch;
- v8::Local<v8::Script> script = V8ScriptRunner::compileScript(source, sourceURL, String(), TextPosition(), m_isolate);
- if (tryCatch.HasCaught()) {
+ v8::Local<v8::Script> script;
+ if (!v8Call(V8ScriptRunner::compileScript(source, sourceURL, String(), TextPosition(), m_isolate), script, tryCatch)) {
v8::Local<v8::Message> message = tryCatch.Message();
if (!message.IsEmpty()) {
*exceptionDetailsText = toCoreStringWithUndefinedOrNullCheck(message->Get());
@@ -710,7 +709,7 @@ void ScriptDebugServer::compileScript(ScriptState* scriptState, const String& ex
}
return;
}
- if (script.IsEmpty() || !persistScript)
+ if (!persistScript)
return;
*scriptId = String::number(script->GetUnboundScript()->GetId());
@@ -735,9 +734,13 @@ void ScriptDebugServer::runScript(ScriptState* scriptState, const String& script
return;
ScriptState::Scope scope(scriptState);
v8::TryCatch tryCatch;
- v8::Local<v8::Value> value = V8ScriptRunner::runCompiledScript(m_isolate, script, scriptState->executionContext());
+ v8::Local<v8::Value> value;
*wasThrown = false;
- if (tryCatch.HasCaught()) {
+ if (v8Call(V8ScriptRunner::runCompiledScript(m_isolate, script, scriptState->executionContext()), value, tryCatch)) {
+ *result = ScriptValue(scriptState, value);
+ } else {
+ if (!tryCatch.HasCaught())
haraken 2015/03/18 01:58:51 Can this happen? In V8BindingMacros.h, you're add
bashi 2015/03/18 02:33:11 Oh, I forgot to remove this. Will remove.
+ return;
*wasThrown = true;
*result = ScriptValue(scriptState, tryCatch.Exception());
v8::Local<v8::Message> message = tryCatch.Message();
@@ -749,8 +752,6 @@ void ScriptDebugServer::runScript(ScriptState* scriptState, const String& script
if (!messageStackTrace.IsEmpty() && messageStackTrace->GetFrameCount() > 0)
*stackTrace = createScriptCallStack(m_isolate, messageStackTrace, messageStackTrace->GetFrameCount());
}
- } else {
- *result = ScriptValue(scriptState, value);
}
}

Powered by Google App Engine
This is Rietveld 408576698