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 0aa99494ea405bc988179bea9e2ab697472294c9..0234ef93bea1803023c0345c7e8eb08a62be904d 100644 |
| --- a/Source/bindings/core/v8/ScriptDebugServer.cpp |
| +++ b/Source/bindings/core/v8/ScriptDebugServer.cpp |
| @@ -471,7 +471,7 @@ void ScriptDebugServer::handleV8DebugEvent(const v8::Debug::EventDetails& eventD |
| return; |
| } |
| - if (event != v8::AsyncTaskEvent && event != v8::Break && event != v8::Exception && event != v8::AfterCompile && event != v8::BeforeCompile && event != v8::CompileError) |
| + if (event != v8::AsyncTaskEvent && event != v8::Break && event != v8::Exception && event != v8::AfterCompile && event != v8::BeforeCompile && event != v8::CompileError && event != v8::PromiseEvent) |
| return; |
| v8::Handle<v8::Context> eventContext = eventDetails.GetEventContext(); |
| @@ -503,6 +503,8 @@ void ScriptDebugServer::handleV8DebugEvent(const v8::Debug::EventDetails& eventD |
| handleProgramBreak(ScriptState::from(eventContext), eventDetails.GetExecutionState(), v8::Handle<v8::Value>(), hitBreakpoints.As<v8::Array>()); |
| } else if (event == v8::AsyncTaskEvent) { |
| handleV8AsyncTaskEvent(listener, ScriptState::from(eventContext), eventDetails.GetExecutionState(), eventDetails.GetEventData()); |
| + } else if (event == v8::PromiseEvent) { |
| + handleV8PromiseEvent(listener, ScriptState::from(eventContext), eventDetails.GetExecutionState(), eventDetails.GetEventData()); |
| } |
| } |
| } |
| @@ -526,6 +528,22 @@ void ScriptDebugServer::handleV8AsyncTaskEvent(ScriptDebugListener* listener, Sc |
| m_executionState.Clear(); |
| } |
| +void ScriptDebugServer::handleV8PromiseEvent(ScriptDebugListener* listener, ScriptState* pausedScriptState, v8::Handle<v8::Object> executionState, v8::Handle<v8::Object> eventData) |
| +{ |
| + m_pausedScriptState = pausedScriptState; |
| + m_executionState = executionState; |
| + v8::Isolate* isolate = m_pausedScriptState->isolate(); |
| + v8::Handle<v8::Value> argv[] = { eventData }; |
| + v8::Local<v8::Object> promiseDetails = callDebuggerMethod("getPromiseDetails", 1, argv)->ToObject(); |
| + ScopedPersistent<v8::Object> promise(isolate, promiseDetails->Get(v8AtomicString(m_isolate, "promise"))->ToObject()); |
| + int status = static_cast<int>(promiseDetails->Get(v8AtomicString(m_isolate, "status"))->ToInteger()->Value()); |
|
aandrey
2014/08/04 16:58:47
why static_cast<int>?
Alexandra Mikhaylova
2014/08/06 13:28:38
Removed it.
|
| + v8::Handle<v8::Value> parentPromiseHandle = promiseDetails->Get(v8AtomicString(m_isolate, "parentPromise")); |
| + ScopedPersistent<v8::Object> parentPromise(isolate, parentPromiseHandle->IsUndefined() ? v8::Handle<v8::Object>() : parentPromiseHandle->ToObject()); |
|
aandrey
2014/08/04 16:58:47
use IsObject() instead of IsUndefined()
Alexandra Mikhaylova
2014/08/06 13:28:39
Done.
|
| + listener->didReceiveV8PromiseEvent(pausedScriptState, promise, parentPromise, status); |
|
aandrey
2014/08/04 16:58:47
nit: line break before, assign m_pausedScriptState
Alexandra Mikhaylova
2014/08/06 13:28:38
Done.
|
| + m_pausedScriptState.clear(); |
| + m_executionState.Clear(); |
| +} |
| + |
| void ScriptDebugServer::dispatchDidParseSource(ScriptDebugListener* listener, v8::Handle<v8::Object> object, CompileResult compileResult) |
| { |
| v8::Handle<v8::Value> id = object->Get(v8AtomicString(m_isolate, "id")); |