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

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..c280ef1f25ffa4d4c2d2f79c3d972825ebe789c3 100644
--- a/Source/bindings/core/v8/ScriptDebugServer.cpp
+++ b/Source/bindings/core/v8/ScriptDebugServer.cpp
@@ -614,8 +614,9 @@ 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;
+ if (!V8ScriptRunner::compileAndRunInternalScript(source, m_isolate).ToLocal(&value))
+ ASSERT_NOT_REACHED();
ASSERT(value->IsObject());
m_debuggerScript.Reset(m_isolate, v8::Handle<v8::Object>::Cast(value));
}
@@ -697,20 +698,22 @@ 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::Message> message = tryCatch.Message();
- if (!message.IsEmpty()) {
- *exceptionDetailsText = toCoreStringWithUndefinedOrNullCheck(message->Get());
- *lineNumber = message->GetLineNumber();
- *columnNumber = message->GetStartColumn();
- v8::Handle<v8::StackTrace> messageStackTrace = message->GetStackTrace();
- if (!messageStackTrace.IsEmpty() && messageStackTrace->GetFrameCount() > 0)
- *stackTrace = createScriptCallStack(m_isolate, messageStackTrace, messageStackTrace->GetFrameCount());
+ v8::Local<v8::Script> script;
+ if (!V8ScriptRunner::compileScript(source, sourceURL, String(), TextPosition(), m_isolate).ToLocal(&script)) {
+ if (tryCatch.HasCaught()) {
+ v8::Local<v8::Message> message = tryCatch.Message();
+ if (!message.IsEmpty()) {
+ *exceptionDetailsText = toCoreStringWithUndefinedOrNullCheck(message->Get());
+ *lineNumber = message->GetLineNumber();
+ *columnNumber = message->GetStartColumn();
+ v8::Handle<v8::StackTrace> messageStackTrace = message->GetStackTrace();
+ if (!messageStackTrace.IsEmpty() && messageStackTrace->GetFrameCount() > 0)
+ *stackTrace = createScriptCallStack(m_isolate, messageStackTrace, messageStackTrace->GetFrameCount());
+ }
}
return;
}
- if (script.IsEmpty() || !persistScript)
+ if (!persistScript)
return;
*scriptId = String::number(script->GetUnboundScript()->GetId());
@@ -735,8 +738,12 @@ 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 (V8ScriptRunner::runCompiledScript(m_isolate, script, scriptState->executionContext()).ToLocal(&value)) {
+ *result = ScriptValue(scriptState, value);
+ return;
+ }
if (tryCatch.HasCaught()) {
*wasThrown = true;
*result = ScriptValue(scriptState, tryCatch.Exception());
@@ -749,8 +756,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