Chromium Code Reviews| 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(); |
|
dcarney
2015/03/13 08:15:45
In cases like this you want ToLocalChecked instead
bashi
2015/03/17 02:01:36
Done. Please add DCHECK() in ToLocalChecked.
|
| 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); |
| } |
| } |