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..9eefc4ff6bd48453d8e4525af440df4cc4b82c72 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,32 @@ 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) |
| +{ |
| + String type = toCoreStringWithUndefinedOrNullCheck(callInternalGetterFunction(eventData, "type", m_isolate)); |
| + v8::Handle<v8::Value> argv[] = { eventData }; |
| + v8::Local<v8::Object> promiseDetails = callDebuggerMethod("getPromiseDetails", 1, argv)->ToObject(); |
| + v8::Handle<v8::Object> promise = promiseDetails->Get(v8AtomicString(m_isolate, "promise"))->ToObject(); |
| + m_pausedScriptState = pausedScriptState; |
| + m_executionState = executionState; |
| + ExecutionContext* context = pausedScriptState->executionContext(); |
| + |
| + if (type == "new") |
| + listener->didReceiveV8NewPromiseEvent(context, promise); |
|
aandrey
2014/08/01 08:28:12
merge them all into didReceiveV8PromiseEvent, do t
Alexandra Mikhaylova
2014/08/04 14:25:06
Done.
|
| + if (type == "update") { |
| + int status = static_cast<int>(promiseDetails->Get(v8AtomicString(m_isolate, "status"))->ToInteger()->Value()); |
| + v8::Handle<v8::Value> value = promiseDetails->Get(v8AtomicString(m_isolate, "value")); |
| + listener->didReceiveV8UpdatePromiseEvent(context, promise, status, value); |
| + } |
| + if (type == "chain") { |
| + v8::Handle<v8::Object> parentPromise = promiseDetails->Get(v8AtomicString(m_isolate, "parentPromise"))->ToObject(); |
| + listener->didReceiveV8ChainPromiseEvent(context, promise, parentPromise); |
| + } |
| + |
| + 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")); |