| Index: Source/core/inspector/V8Debugger.cpp
|
| diff --git a/Source/core/inspector/V8Debugger.cpp b/Source/core/inspector/V8Debugger.cpp
|
| index 40e884d6a13094fc383abe687c2a1d7e810a68c0..cb36c150ba964fb46bc1cdd4f7f47cd9831ba7be 100644
|
| --- a/Source/core/inspector/V8Debugger.cpp
|
| +++ b/Source/core/inspector/V8Debugger.cpp
|
| @@ -36,7 +36,6 @@
|
| #include "bindings/core/v8/V8ScriptRunner.h"
|
| #include "bindings/core/v8/inspector/V8JavaScriptCallFrame.h"
|
| #include "core/inspector/JavaScriptCallFrame.h"
|
| -#include "core/inspector/ScriptDebugListener.h"
|
| #include "platform/JSONValues.h"
|
| #include "wtf/StdLibExtras.h"
|
| #include "wtf/Vector.h"
|
| @@ -580,10 +579,6 @@ void V8Debugger::handleProgramBreak(ScriptState* pausedScriptState, v8::Local<v8
|
| if (m_runningNestedMessageLoop)
|
| return;
|
|
|
| - ScriptDebugListener* listener = m_client->getDebugListenerForContext(pausedScriptState->context());
|
| - if (!listener)
|
| - return;
|
| -
|
| Vector<String> breakpointIds;
|
| if (!hitBreakpointNumbers.IsEmpty()) {
|
| breakpointIds.resize(hitBreakpointNumbers->Length());
|
| @@ -596,7 +591,7 @@ void V8Debugger::handleProgramBreak(ScriptState* pausedScriptState, v8::Local<v8
|
|
|
| m_pausedScriptState = pausedScriptState;
|
| m_executionState = executionState;
|
| - SkipPauseRequest result = listener->didPause(pausedScriptState, currentCallFrames(), ScriptValue(pausedScriptState, exception), breakpointIds, isPromiseRejection);
|
| + SkipPauseRequest result = m_client->didPause(pausedScriptState, currentCallFrames(), ScriptValue(pausedScriptState, exception), breakpointIds, isPromiseRejection);
|
| if (result == NoSkip) {
|
| m_runningNestedMessageLoop = true;
|
| m_client->runMessageLoopOnPause(pausedScriptState->context());
|
| @@ -641,38 +636,35 @@ void V8Debugger::handleV8DebugEvent(const v8::Debug::EventDetails& eventDetails)
|
| v8::Local<v8::Context> eventContext = eventDetails.GetEventContext();
|
| ASSERT(!eventContext.IsEmpty());
|
|
|
| - ScriptDebugListener* listener = m_client->getDebugListenerForContext(eventContext);
|
| - if (listener) {
|
| - v8::HandleScope scope(m_isolate);
|
| - if (event == v8::AfterCompile || event == v8::CompileError) {
|
| - v8::Context::Scope contextScope(debuggerContext());
|
| - v8::Local<v8::Value> argv[] = { eventDetails.GetEventData() };
|
| - v8::Local<v8::Value> value = callDebuggerMethod("getAfterCompileScript", 1, argv).ToLocalChecked();
|
| - ASSERT(value->IsObject());
|
| - v8::Local<v8::Object> object = v8::Local<v8::Object>::Cast(value);
|
| - listener->didParseSource(createParsedScript(object, event != v8::AfterCompile ? CompileError : CompileSuccess));
|
| - } else if (event == v8::Exception) {
|
| - v8::Local<v8::Object> eventData = eventDetails.GetEventData();
|
| - v8::Local<v8::Value> exception = callInternalGetterFunction(eventData, "exception");
|
| - v8::Local<v8::Value> promise = callInternalGetterFunction(eventData, "promise");
|
| - bool isPromiseRejection = !promise.IsEmpty() && promise->IsObject();
|
| - handleProgramBreak(ScriptState::from(eventContext), eventDetails.GetExecutionState(), exception, v8::Local<v8::Array>(), isPromiseRejection);
|
| - } else if (event == v8::Break) {
|
| - v8::Local<v8::Value> argv[] = { eventDetails.GetEventData() };
|
| - v8::Local<v8::Value> hitBreakpoints = callDebuggerMethod("getBreakpointNumbers", 1, argv).ToLocalChecked();
|
| - ASSERT(hitBreakpoints->IsArray());
|
| - handleProgramBreak(ScriptState::from(eventContext), eventDetails.GetExecutionState(), v8::Local<v8::Value>(), hitBreakpoints.As<v8::Array>());
|
| - } else if (event == v8::AsyncTaskEvent) {
|
| - if (listener->v8AsyncTaskEventsEnabled())
|
| - handleV8AsyncTaskEvent(listener, ScriptState::from(eventContext), eventDetails.GetExecutionState(), eventDetails.GetEventData());
|
| - } else if (event == v8::PromiseEvent) {
|
| - if (listener->v8PromiseEventsEnabled())
|
| - handleV8PromiseEvent(listener, ScriptState::from(eventContext), eventDetails.GetExecutionState(), eventDetails.GetEventData());
|
| - }
|
| + v8::HandleScope scope(m_isolate);
|
| + if (event == v8::AfterCompile || event == v8::CompileError) {
|
| + v8::Context::Scope contextScope(debuggerContext());
|
| + v8::Local<v8::Value> argv[] = { eventDetails.GetEventData() };
|
| + v8::Local<v8::Value> value = callDebuggerMethod("getAfterCompileScript", 1, argv).ToLocalChecked();
|
| + ASSERT(value->IsObject());
|
| + v8::Local<v8::Object> object = v8::Local<v8::Object>::Cast(value);
|
| + m_client->didParseSource(eventContext, createParsedScript(object, event != v8::AfterCompile ? CompileError : CompileSuccess));
|
| + } else if (event == v8::Exception) {
|
| + v8::Local<v8::Object> eventData = eventDetails.GetEventData();
|
| + v8::Local<v8::Value> exception = callInternalGetterFunction(eventData, "exception");
|
| + v8::Local<v8::Value> promise = callInternalGetterFunction(eventData, "promise");
|
| + bool isPromiseRejection = !promise.IsEmpty() && promise->IsObject();
|
| + handleProgramBreak(ScriptState::from(eventContext), eventDetails.GetExecutionState(), exception, v8::Local<v8::Array>(), isPromiseRejection);
|
| + } else if (event == v8::Break) {
|
| + v8::Local<v8::Value> argv[] = { eventDetails.GetEventData() };
|
| + v8::Local<v8::Value> hitBreakpoints = callDebuggerMethod("getBreakpointNumbers", 1, argv).ToLocalChecked();
|
| + ASSERT(hitBreakpoints->IsArray());
|
| + handleProgramBreak(ScriptState::from(eventContext), eventDetails.GetExecutionState(), v8::Local<v8::Value>(), hitBreakpoints.As<v8::Array>());
|
| + } else if (event == v8::AsyncTaskEvent) {
|
| + if (m_client->v8AsyncTaskEventsEnabled(ScriptState::from(eventContext)))
|
| + handleV8AsyncTaskEvent(ScriptState::from(eventContext), eventDetails.GetExecutionState(), eventDetails.GetEventData());
|
| + } else if (event == v8::PromiseEvent) {
|
| + if (m_client->v8PromiseEventsEnabled(ScriptState::from(eventContext)))
|
| + handleV8PromiseEvent(ScriptState::from(eventContext), eventDetails.GetExecutionState(), eventDetails.GetEventData());
|
| }
|
| }
|
|
|
| -void V8Debugger::handleV8AsyncTaskEvent(ScriptDebugListener* listener, ScriptState* pausedScriptState, v8::Local<v8::Object> executionState, v8::Local<v8::Object> eventData)
|
| +void V8Debugger::handleV8AsyncTaskEvent(ScriptState* pausedScriptState, v8::Local<v8::Object> executionState, v8::Local<v8::Object> eventData)
|
| {
|
| String type = toCoreStringWithUndefinedOrNullCheck(callInternalGetterFunction(eventData, "type"));
|
| String name = toCoreStringWithUndefinedOrNullCheck(callInternalGetterFunction(eventData, "name"));
|
| @@ -680,12 +672,12 @@ void V8Debugger::handleV8AsyncTaskEvent(ScriptDebugListener* listener, ScriptSta
|
|
|
| m_pausedScriptState = pausedScriptState;
|
| m_executionState = executionState;
|
| - listener->didReceiveV8AsyncTaskEvent(pausedScriptState, type, name, id);
|
| + m_client->didReceiveV8AsyncTaskEvent(pausedScriptState, type, name, id);
|
| m_pausedScriptState.clear();
|
| m_executionState.Clear();
|
| }
|
|
|
| -void V8Debugger::handleV8PromiseEvent(ScriptDebugListener* listener, ScriptState* pausedScriptState, v8::Local<v8::Object> executionState, v8::Local<v8::Object> eventData)
|
| +void V8Debugger::handleV8PromiseEvent(ScriptState* pausedScriptState, v8::Local<v8::Object> executionState, v8::Local<v8::Object> eventData)
|
| {
|
| v8::Local<v8::Value> argv[] = { eventData };
|
| v8::Local<v8::Value> value = callDebuggerMethod("getPromiseDetails", 1, argv).ToLocalChecked();
|
| @@ -697,7 +689,7 @@ void V8Debugger::handleV8PromiseEvent(ScriptDebugListener* listener, ScriptState
|
|
|
| m_pausedScriptState = pausedScriptState;
|
| m_executionState = executionState;
|
| - listener->didReceiveV8PromiseEvent(pausedScriptState, promise, parentPromise, status);
|
| + m_client->didReceiveV8PromiseEvent(pausedScriptState, promise, parentPromise, status);
|
| m_pausedScriptState.clear();
|
| m_executionState.Clear();
|
| }
|
|
|