summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--third_party/WebKit/LayoutTests/inspector-protocol/debugger/access-obsolete-frame.html2
-rw-r--r--third_party/WebKit/Source/platform/v8_inspector/DebuggerScript.js44
-rw-r--r--third_party/WebKit/Source/platform/v8_inspector/JavaScriptCallFrame.cpp10
-rw-r--r--third_party/WebKit/Source/platform/v8_inspector/JavaScriptCallFrame.h4
-rw-r--r--third_party/WebKit/Source/platform/v8_inspector/V8DebuggerAgentImpl.cpp106
-rw-r--r--third_party/WebKit/Source/platform/v8_inspector/V8DebuggerAgentImpl.h12
-rw-r--r--third_party/WebKit/Source/platform/v8_inspector/V8DebuggerImpl.cpp67
-rw-r--r--third_party/WebKit/Source/platform/v8_inspector/V8DebuggerImpl.h8
-rw-r--r--third_party/WebKit/Source/platform/v8_inspector/debugger_script_externs.js1
9 files changed, 92 insertions, 162 deletions
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/access-obsolete-frame.html b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/access-obsolete-frame.html
index b4bb0e5..b614228 100644
--- a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/access-obsolete-frame.html
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/access-obsolete-frame.html
@@ -60,7 +60,7 @@ function test()
function logErrorResponse(response)
{
if (response.error) {
- if (response.error.message.indexOf("debugger is not on pause") != -1) {
+ if (response.error.message.indexOf("Can only perform operation while paused.") != -1) {
InspectorTest.log("PASS, error message as expected");
return;
}
diff --git a/third_party/WebKit/Source/platform/v8_inspector/DebuggerScript.js b/third_party/WebKit/Source/platform/v8_inspector/DebuggerScript.js
index c4992db..cb25482 100644
--- a/third_party/WebKit/Source/platform/v8_inspector/DebuggerScript.js
+++ b/third_party/WebKit/Source/platform/v8_inspector/DebuggerScript.js
@@ -274,41 +274,15 @@ DebuggerScript.setPauseOnExceptionsState = function(newState)
/**
* @param {!ExecutionState} execState
- * @return {number}
- */
-DebuggerScript.frameCount = function(execState)
-{
- return execState.frameCount();
-}
-
-/**
- * @param {!ExecutionState} execState
- * @return {!JavaScriptCallFrame|undefined}
- */
-DebuggerScript.currentCallFrame = function(execState)
-{
- var frameCount = execState.frameCount();
- var topFrame = undefined;
- for (var i = frameCount - 1; i >= 0; i--) {
- var frameMirror = execState.frame(i);
- topFrame = DebuggerScript._frameMirrorToJSCallFrame(frameMirror, topFrame);
- }
- return topFrame;
-}
-
-/**
- * @param {!ExecutionState} execState
- * @param {number} index
- * @return {!JavaScriptCallFrame|undefined}
+ * @param {number} limit
+ * @return {!Array<!JavaScriptCallFrame>}
*/
-DebuggerScript.currentCallFrameByIndex = function(execState, index)
+DebuggerScript.currentCallFrames = function(execState, limit)
{
- if (index < 0)
- return undefined;
- var frameCount = execState.frameCount();
- if (index >= frameCount)
- return undefined;
- return DebuggerScript._frameMirrorToJSCallFrame(execState.frame(index), undefined);
+ var frames = [];
+ for (var i = 0; i < execState.frameCount() && (!limit || i < limit); ++i)
+ frames.push(DebuggerScript._frameMirrorToJSCallFrame(execState.frame(i)));
+ return frames;
}
/**
@@ -427,10 +401,9 @@ DebuggerScript.getBreakpointNumbers = function(eventData)
// asynchronous call stacks. Thus, when possible, initialize the data lazily.
/**
* @param {!FrameMirror} frameMirror
- * @param {!JavaScriptCallFrame|undefined} callerFrame
* @return {!JavaScriptCallFrame}
*/
-DebuggerScript._frameMirrorToJSCallFrame = function(frameMirror, callerFrame)
+DebuggerScript._frameMirrorToJSCallFrame = function(frameMirror)
{
// Stuff that can not be initialized lazily (i.e. valid while paused with a valid break_id).
// The frameMirror and scopeMirror can be accessed only while paused on the debugger.
@@ -664,7 +637,6 @@ DebuggerScript._frameMirrorToJSCallFrame = function(frameMirror, callerFrame)
"column": column,
"thisObject": thisObject,
"evaluate": evaluate,
- "caller": callerFrame,
"restart": restart,
"setVariableValue": setVariableValue,
"isAtReturn": isAtReturn,
diff --git a/third_party/WebKit/Source/platform/v8_inspector/JavaScriptCallFrame.cpp b/third_party/WebKit/Source/platform/v8_inspector/JavaScriptCallFrame.cpp
index 59b292a..5c216f6 100644
--- a/third_party/WebKit/Source/platform/v8_inspector/JavaScriptCallFrame.cpp
+++ b/third_party/WebKit/Source/platform/v8_inspector/JavaScriptCallFrame.cpp
@@ -47,16 +47,6 @@ JavaScriptCallFrame::~JavaScriptCallFrame()
{
}
-PassOwnPtr<JavaScriptCallFrame> JavaScriptCallFrame::caller()
-{
- v8::HandleScope handleScope(m_isolate);
- v8::Local<v8::Context> debuggerContext = v8::Local<v8::Context>::New(m_isolate, m_debuggerContext);
- v8::Local<v8::Value> callerFrame = v8::Local<v8::Object>::New(m_isolate, m_callFrame)->Get(toV8StringInternalized(m_isolate, "caller"));
- if (callerFrame.IsEmpty() || !callerFrame->IsObject())
- return 0;
- return JavaScriptCallFrame::create(debuggerContext, v8::Local<v8::Object>::Cast(callerFrame));
-}
-
int JavaScriptCallFrame::callV8FunctionReturnInt(const char* name) const
{
v8::HandleScope handleScope(m_isolate);
diff --git a/third_party/WebKit/Source/platform/v8_inspector/JavaScriptCallFrame.h b/third_party/WebKit/Source/platform/v8_inspector/JavaScriptCallFrame.h
index 46e6aab..f89576a 100644
--- a/third_party/WebKit/Source/platform/v8_inspector/JavaScriptCallFrame.h
+++ b/third_party/WebKit/Source/platform/v8_inspector/JavaScriptCallFrame.h
@@ -46,8 +46,6 @@ public:
}
~JavaScriptCallFrame();
- PassOwnPtr<JavaScriptCallFrame> caller();
-
int sourceID() const;
int line() const;
int column() const;
@@ -70,6 +68,8 @@ private:
v8::Global<v8::FunctionTemplate> m_wrapperTemplate;
};
+using JavaScriptCallFrames = Vector<OwnPtr<JavaScriptCallFrame>>;
+
} // namespace blink
#endif // JavaScriptCallFrame_h
diff --git a/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerAgentImpl.cpp b/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerAgentImpl.cpp
index e4d02ed..72ada62 100644
--- a/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerAgentImpl.cpp
+++ b/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerAgentImpl.cpp
@@ -243,7 +243,8 @@ void V8DebuggerAgentImpl::disable(ErrorString*)
debugger().removeDebuggerAgent(m_contextGroupId);
m_pausedContext.Reset();
- m_currentCallStack.clear();
+ JavaScriptCallFrames emptyCallFrames;
+ m_pausedCallFrames.swap(emptyCallFrames);
m_scripts.clear();
m_blackboxedPositions.clear();
m_breakpointIdToDebuggerBreakpointIds.clear();
@@ -484,30 +485,28 @@ void V8DebuggerAgentImpl::getBacktrace(ErrorString* errorString, OwnPtr<Array<Ca
{
if (!assertPaused(errorString))
return;
- m_currentCallStack = debugger().currentCallFrames();
+ m_pausedCallFrames = debugger().currentCallFrames();
*callFrames = currentCallFrames(errorString);
if (!*callFrames)
return;
*asyncStackTrace = currentAsyncStackTrace();
}
-bool V8DebuggerAgentImpl::isCallStackEmptyOrBlackboxed()
+bool V8DebuggerAgentImpl::isCurrentCallStackEmptyOrBlackboxed()
{
ASSERT(enabled());
- for (int index = 0; ; ++index) {
- OwnPtr<JavaScriptCallFrame> frame = debugger().callFrame(index);
- if (!frame)
- break;
- if (!isCallFrameWithUnknownScriptOrBlackboxed(frame.get()))
+ JavaScriptCallFrames callFrames = debugger().currentCallFrames();
+ for (size_t index = 0; index < callFrames.size(); ++index) {
+ if (!isCallFrameWithUnknownScriptOrBlackboxed(callFrames[index].get()))
return false;
}
return true;
}
-bool V8DebuggerAgentImpl::isTopCallFrameBlackboxed()
+bool V8DebuggerAgentImpl::isTopPausedCallFrameBlackboxed()
{
ASSERT(enabled());
- return isCallFrameWithUnknownScriptOrBlackboxed(debugger().callFrame(0).get());
+ return isCallFrameWithUnknownScriptOrBlackboxed(m_pausedCallFrames.size() ? m_pausedCallFrames[0].get() : nullptr);
}
bool V8DebuggerAgentImpl::isCallFrameWithUnknownScriptOrBlackboxed(JavaScriptCallFrame* frame)
@@ -530,16 +529,16 @@ bool V8DebuggerAgentImpl::isCallFrameWithUnknownScriptOrBlackboxed(JavaScriptCal
return std::distance(ranges->begin(), itRange) % 2;
}
-V8DebuggerAgentImpl::SkipPauseRequest V8DebuggerAgentImpl::shouldSkipExceptionPause()
+V8DebuggerAgentImpl::SkipPauseRequest V8DebuggerAgentImpl::shouldSkipExceptionPause(JavaScriptCallFrame* topCallFrame)
{
if (m_steppingFromFramework)
return RequestNoSkip;
- if (isTopCallFrameBlackboxed())
+ if (isCallFrameWithUnknownScriptOrBlackboxed(topCallFrame))
return RequestContinue;
return RequestNoSkip;
}
-V8DebuggerAgentImpl::SkipPauseRequest V8DebuggerAgentImpl::shouldSkipStepPause()
+V8DebuggerAgentImpl::SkipPauseRequest V8DebuggerAgentImpl::shouldSkipStepPause(JavaScriptCallFrame* topCallFrame)
{
if (m_steppingFromFramework)
return RequestNoSkip;
@@ -550,7 +549,7 @@ V8DebuggerAgentImpl::SkipPauseRequest V8DebuggerAgentImpl::shouldSkipStepPause()
return RequestStepOut;
}
- if (!isTopCallFrameBlackboxed())
+ if (!isCallFrameWithUnknownScriptOrBlackboxed(topCallFrame))
return RequestNoSkip;
if (m_skippedStepFrameCount >= maxSkipStepFrameCount)
@@ -616,7 +615,7 @@ void V8DebuggerAgentImpl::setScriptSource(ErrorString* errorString,
{
if (!checkEnabled(errorString))
return;
- if (!debugger().setScriptSource(scriptId, newContent, preview.fromMaybe(false), errorString, optOutCompileError, &m_currentCallStack, stackChanged))
+ if (!debugger().setScriptSource(scriptId, newContent, preview.fromMaybe(false), errorString, optOutCompileError, &m_pausedCallFrames, stackChanged))
return;
OwnPtr<Array<CallFrame>> callFrames = currentCallFrames(errorString);
@@ -636,10 +635,8 @@ void V8DebuggerAgentImpl::restartFrame(ErrorString* errorString,
OwnPtr<Array<CallFrame>>* newCallFrames,
Maybe<StackTrace>* asyncStackTrace)
{
- if (!isPaused() || !m_currentCallStack) {
- *errorString = "Attempt to access call frame when debugger is not on pause";
+ if (!assertPaused(errorString))
return;
- }
OwnPtr<RemoteCallFrameId> remoteId = RemoteCallFrameId::parse(errorString, callFrameId);
if (!remoteId)
return;
@@ -652,19 +649,19 @@ void V8DebuggerAgentImpl::restartFrame(ErrorString* errorString,
v8::TryCatch tryCatch(m_isolate);
- OwnPtr<JavaScriptCallFrame> javaScriptCallFrame = debugger().callFrame(remoteId->frameOrdinal());
- if (!javaScriptCallFrame) {
+ size_t frameOrdinal = static_cast<size_t>(remoteId->frameOrdinal());
+ if (frameOrdinal >= m_pausedCallFrames.size()) {
*errorString = "Could not find call frame with given id";
return;
}
v8::Local<v8::Value> resultValue;
v8::Local<v8::Boolean> result;
- if (!javaScriptCallFrame->restart().ToLocal(&resultValue) || tryCatch.HasCaught() || !resultValue->ToBoolean(localContext).ToLocal(&result) || !result->Value()) {
+ if (!m_pausedCallFrames[frameOrdinal].get()->restart().ToLocal(&resultValue) || tryCatch.HasCaught() || !resultValue->ToBoolean(localContext).ToLocal(&result) || !result->Value()) {
*errorString = "Internal error";
return;
}
- m_currentCallStack = debugger().currentCallFrames();
+ m_pausedCallFrames = debugger().currentCallFrames();
*newCallFrames = currentCallFrames(errorString);
if (!*newCallFrames)
@@ -892,13 +889,13 @@ void V8DebuggerAgentImpl::stepOver(ErrorString* errorString)
if (!assertPaused(errorString))
return;
// StepOver at function return point should fallback to StepInto.
- OwnPtr<JavaScriptCallFrame> frame = debugger().callFrame(0);
+ JavaScriptCallFrame* frame = m_pausedCallFrames.size() ? m_pausedCallFrames[0].get() : nullptr;
if (frame && frame->isAtReturn()) {
stepInto(errorString);
return;
}
m_scheduledDebuggerStep = StepOver;
- m_steppingFromFramework = isTopCallFrameBlackboxed();
+ m_steppingFromFramework = isTopPausedCallFrameBlackboxed();
m_injectedScriptManager->releaseObjectGroup(V8DebuggerAgentImpl::backtraceObjectGroup);
debugger().stepOverStatement();
}
@@ -908,7 +905,7 @@ void V8DebuggerAgentImpl::stepInto(ErrorString* errorString)
if (!assertPaused(errorString))
return;
m_scheduledDebuggerStep = StepInto;
- m_steppingFromFramework = isTopCallFrameBlackboxed();
+ m_steppingFromFramework = isTopPausedCallFrameBlackboxed();
m_injectedScriptManager->releaseObjectGroup(V8DebuggerAgentImpl::backtraceObjectGroup);
debugger().stepIntoStatement();
}
@@ -920,7 +917,7 @@ void V8DebuggerAgentImpl::stepOut(ErrorString* errorString)
m_scheduledDebuggerStep = StepOut;
m_skipNextDebuggerStepOut = false;
m_recursionLevelForStepOut = 1;
- m_steppingFromFramework = isTopCallFrameBlackboxed();
+ m_steppingFromFramework = isTopPausedCallFrameBlackboxed();
m_injectedScriptManager->releaseObjectGroup(V8DebuggerAgentImpl::backtraceObjectGroup);
debugger().stepOutOfFunction();
}
@@ -977,10 +974,8 @@ void V8DebuggerAgentImpl::evaluateOnCallFrame(ErrorString* errorString,
Maybe<bool>* wasThrown,
Maybe<protocol::Runtime::ExceptionDetails>* exceptionDetails)
{
- if (!isPaused() || !m_currentCallStack) {
- *errorString = "Attempt to access callframe when debugger is not on pause";
+ if (!assertPaused(errorString))
return;
- }
OwnPtr<RemoteCallFrameId> remoteId = RemoteCallFrameId::parse(errorString, callFrameId);
if (!remoteId)
return;
@@ -995,8 +990,8 @@ void V8DebuggerAgentImpl::evaluateOnCallFrame(ErrorString* errorString,
return;
}
- OwnPtr<JavaScriptCallFrame> javaScriptCallFrame = debugger().callFrame(remoteId->frameOrdinal());
- if (!javaScriptCallFrame) {
+ size_t frameOrdinal = static_cast<size_t>(remoteId->frameOrdinal());
+ if (frameOrdinal >= m_pausedCallFrames.size()) {
*errorString = "Could not find call frame with given id";
return;
}
@@ -1009,7 +1004,7 @@ void V8DebuggerAgentImpl::evaluateOnCallFrame(ErrorString* errorString,
v8::TryCatch tryCatch(injectedScript->isolate());
- v8::MaybeLocal<v8::Value> maybeResultValue = javaScriptCallFrame->evaluate(toV8String(injectedScript->isolate(), expression));
+ v8::MaybeLocal<v8::Value> maybeResultValue = m_pausedCallFrames[frameOrdinal].get()->evaluate(toV8String(injectedScript->isolate(), expression));
// InjectedScript may be gone after any evaluate call - find it again.
injectedScript = m_injectedScriptManager->findInjectedScript(errorString, remoteId.get());
@@ -1035,10 +1030,8 @@ void V8DebuggerAgentImpl::setVariableValue(ErrorString* errorString,
{
if (!checkEnabled(errorString))
return;
- if (!isPaused() || !m_currentCallStack) {
- *errorString = "Attempt to access callframe when debugger is not on pause";
+ if (!assertPaused(errorString))
return;
- }
OwnPtr<RemoteCallFrameId> remoteId = RemoteCallFrameId::parse(errorString, callFrameId);
if (!remoteId)
return;
@@ -1053,12 +1046,12 @@ void V8DebuggerAgentImpl::setVariableValue(ErrorString* errorString,
if (!injectedScript->resolveCallArgument(errorString, newValueArgument.get()).ToLocal(&newValue))
return;
- OwnPtr<JavaScriptCallFrame> javaScriptCallFrame = debugger().callFrame(remoteId->frameOrdinal());
- if (!javaScriptCallFrame) {
+ size_t frameOrdinal = static_cast<size_t>(remoteId->frameOrdinal());
+ if (frameOrdinal >= m_pausedCallFrames.size()) {
*errorString = "Could not find call frame with given id";
return;
}
- v8::MaybeLocal<v8::Value> result = javaScriptCallFrame->setVariableValue(scopeNumber, toV8String(m_isolate, variableName), newValue);
+ v8::MaybeLocal<v8::Value> result = m_pausedCallFrames[frameOrdinal].get()->setVariableValue(scopeNumber, toV8String(m_isolate, variableName), newValue);
if (tryCatch.HasCaught() || result.IsEmpty()) {
*errorString = "Internal error";
return;
@@ -1351,7 +1344,7 @@ void V8DebuggerAgentImpl::changeJavaScriptRecursionLevel(int step)
PassOwnPtr<Array<CallFrame>> V8DebuggerAgentImpl::currentCallFrames(ErrorString* errorString)
{
- if (m_pausedContext.IsEmpty() || !m_currentCallStack)
+ if (m_pausedContext.IsEmpty() || !m_pausedCallFrames.size())
return Array<CallFrame>::create();
InjectedScript* injectedScript = m_injectedScriptManager->injectedScriptFor(m_pausedContext.Get(m_isolate));
if (!injectedScript) {
@@ -1364,16 +1357,15 @@ PassOwnPtr<Array<CallFrame>> V8DebuggerAgentImpl::currentCallFrames(ErrorString*
v8::Local<v8::Context> context = injectedScript->context();
v8::Context::Scope contextScope(context);
- JavaScriptCallFrame* currentCallFrame = m_currentCallStack.get();
- int callFrameIndex = 0;
- OwnPtr<JavaScriptCallFrame> currentCallFrameOwner;
v8::Local<v8::Array> objects = v8::Array::New(isolate);
- while (currentCallFrame) {
+ for (size_t frameOrdinal = 0; frameOrdinal < m_pausedCallFrames.size(); ++frameOrdinal) {
+ JavaScriptCallFrame* currentCallFrame = m_pausedCallFrames[frameOrdinal].get();
+
v8::Local<v8::Object> details = currentCallFrame->details();
if (hasInternalError(errorString, details.IsEmpty()))
return Array<CallFrame>::create();
- String16 callFrameId = RemoteCallFrameId::serialize(injectedScript->contextId(), callFrameIndex);
+ String16 callFrameId = RemoteCallFrameId::serialize(injectedScript->contextId(), frameOrdinal);
if (hasInternalError(errorString, !details->Set(context, toV8StringInternalized(isolate, "callFrameId"), toV8String(isolate, callFrameId)).FromMaybe(false)))
return Array<CallFrame>::create();
@@ -1392,12 +1384,8 @@ PassOwnPtr<Array<CallFrame>> V8DebuggerAgentImpl::currentCallFrames(ErrorString*
return Array<CallFrame>::create();
}
- if (hasInternalError(errorString, !objects->Set(context, callFrameIndex, details).FromMaybe(false)))
+ if (hasInternalError(errorString, !objects->Set(context, frameOrdinal, details).FromMaybe(false)))
return Array<CallFrame>::create();
-
- currentCallFrameOwner = currentCallFrame->caller();
- currentCallFrame = currentCallFrameOwner.get();
- ++callFrameIndex;
}
protocol::ErrorSupport errorSupport;
@@ -1486,31 +1474,34 @@ void V8DebuggerAgentImpl::didParseSource(const V8DebuggerParsedScript& parsedScr
}
}
-V8DebuggerAgentImpl::SkipPauseRequest V8DebuggerAgentImpl::didPause(v8::Local<v8::Context> context, PassOwnPtr<JavaScriptCallFrame> callFrames, v8::Local<v8::Value> exception, const protocol::Vector<String16>& hitBreakpoints, bool isPromiseRejection)
+V8DebuggerAgentImpl::SkipPauseRequest V8DebuggerAgentImpl::didPause(v8::Local<v8::Context> context, v8::Local<v8::Value> exception, const protocol::Vector<String16>& hitBreakpoints, bool isPromiseRejection)
{
+ JavaScriptCallFrames callFrames = debugger().currentCallFrames(1);
+ JavaScriptCallFrame* topCallFrame = callFrames.size() > 0 ? callFrames[0].get() : nullptr;
+
V8DebuggerAgentImpl::SkipPauseRequest result;
if (m_skipAllPauses)
result = RequestContinue;
else if (!hitBreakpoints.isEmpty())
result = RequestNoSkip; // Don't skip explicit breakpoints even if set in frameworks.
else if (!exception.IsEmpty())
- result = shouldSkipExceptionPause();
+ result = shouldSkipExceptionPause(topCallFrame);
else if (m_scheduledDebuggerStep != NoStep || m_javaScriptPauseScheduled || m_pausingOnNativeEvent)
- result = shouldSkipStepPause();
+ result = shouldSkipStepPause(topCallFrame);
else
result = RequestNoSkip;
m_skipNextDebuggerStepOut = false;
if (result != RequestNoSkip)
return result;
-
// Skip pauses inside V8 internal scripts and on syntax errors.
- if (!callFrames)
+ if (!topCallFrame)
return RequestContinue;
ASSERT(m_pausedContext.IsEmpty());
+ callFrames = debugger().currentCallFrames();
+ m_pausedCallFrames.swap(callFrames);
m_pausedContext.Reset(m_isolate, context);
- m_currentCallStack = callFrames;
v8::HandleScope handles(m_isolate);
if (!exception.IsEmpty()) {
@@ -1565,7 +1556,8 @@ V8DebuggerAgentImpl::SkipPauseRequest V8DebuggerAgentImpl::didPause(v8::Local<v8
void V8DebuggerAgentImpl::didContinue()
{
m_pausedContext.Reset();
- m_currentCallStack.clear();
+ JavaScriptCallFrames emptyCallFrames;
+ m_pausedCallFrames.swap(emptyCallFrames);
clearBreakDetails();
m_frontend->resumed();
}
@@ -1578,7 +1570,7 @@ bool V8DebuggerAgentImpl::canBreakProgram()
void V8DebuggerAgentImpl::breakProgram(const String16& breakReason, PassOwnPtr<protocol::DictionaryValue> data)
{
ASSERT(enabled());
- if (m_skipAllPauses || !m_pausedContext.IsEmpty() || isCallStackEmptyOrBlackboxed() || !debugger().breakpointsActivated())
+ if (m_skipAllPauses || !m_pausedContext.IsEmpty() || isCurrentCallStackEmptyOrBlackboxed() || !debugger().breakpointsActivated())
return;
m_breakReason = breakReason;
m_breakAuxData = data;
diff --git a/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerAgentImpl.h b/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerAgentImpl.h
index 0a47745..d6e705a 100644
--- a/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerAgentImpl.h
+++ b/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerAgentImpl.h
@@ -163,7 +163,7 @@ public:
void reset();
// Interface for V8DebuggerImpl
- SkipPauseRequest didPause(v8::Local<v8::Context>, PassOwnPtr<JavaScriptCallFrame> callFrames, v8::Local<v8::Value> exception, const protocol::Vector<String16>& hitBreakpoints, bool isPromiseRejection);
+ SkipPauseRequest didPause(v8::Local<v8::Context>, v8::Local<v8::Value> exception, const protocol::Vector<String16>& hitBreakpoints, bool isPromiseRejection);
void didContinue();
void didParseSource(const V8DebuggerParsedScript&);
bool v8AsyncTaskEventsEnabled() const;
@@ -177,8 +177,8 @@ private:
bool checkEnabled(ErrorString*);
void enable();
- SkipPauseRequest shouldSkipExceptionPause();
- SkipPauseRequest shouldSkipStepPause();
+ SkipPauseRequest shouldSkipExceptionPause(JavaScriptCallFrame* topCallFrame);
+ SkipPauseRequest shouldSkipStepPause(JavaScriptCallFrame* topCallFrame);
void schedulePauseOnNextStatementIfSteppingInto();
@@ -198,8 +198,8 @@ private:
bool assertPaused(ErrorString*);
void clearBreakDetails();
- bool isCallStackEmptyOrBlackboxed();
- bool isTopCallFrameBlackboxed();
+ bool isCurrentCallStackEmptyOrBlackboxed();
+ bool isTopPausedCallFrameBlackboxed();
bool isCallFrameWithUnknownScriptOrBlackboxed(JavaScriptCallFrame*);
void internalSetAsyncCallStackDepth(int);
@@ -225,7 +225,7 @@ private:
protocol::Frontend::Debugger* m_frontend;
v8::Isolate* m_isolate;
v8::Global<v8::Context> m_pausedContext;
- OwnPtr<JavaScriptCallFrame> m_currentCallStack;
+ JavaScriptCallFrames m_pausedCallFrames;
ScriptsMap m_scripts;
BreakpointIdToDebuggerBreakpointIdsMap m_breakpointIdToDebuggerBreakpointIds;
DebugServerBreakpointToBreakpointIdAndSourceMap m_serverBreakpoints;
diff --git a/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerImpl.cpp b/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerImpl.cpp
index feb0f4e..750f6c2 100644
--- a/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerImpl.cpp
+++ b/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerImpl.cpp
@@ -33,7 +33,6 @@
#include "platform/inspector_protocol/Values.h"
#include "platform/v8_inspector/Atomics.h"
#include "platform/v8_inspector/DebuggerScript.h"
-#include "platform/v8_inspector/JavaScriptCallFrame.h"
#include "platform/v8_inspector/ScriptBreakpoint.h"
#include "platform/v8_inspector/V8DebuggerAgentImpl.h"
#include "platform/v8_inspector/V8RuntimeAgentImpl.h"
@@ -396,7 +395,7 @@ void V8DebuggerImpl::clearStepping()
callDebuggerMethod("clearStepping", 0, argv);
}
-bool V8DebuggerImpl::setScriptSource(const String16& sourceID, const String16& newContent, bool preview, ErrorString* error, Maybe<protocol::Debugger::SetScriptSourceError>* errorData, OwnPtr<JavaScriptCallFrame>* newCallFrames, Maybe<bool>* stackChanged)
+bool V8DebuggerImpl::setScriptSource(const String16& sourceID, const String16& newContent, bool preview, ErrorString* error, Maybe<protocol::Debugger::SetScriptSourceError>* errorData, JavaScriptCallFrames* newCallFrames, Maybe<bool>* stackChanged)
{
class EnableLiveEditScope {
public:
@@ -465,53 +464,33 @@ bool V8DebuggerImpl::setScriptSource(const String16& sourceID, const String16& n
return false;
}
-int V8DebuggerImpl::frameCount()
-{
- ASSERT(isPaused());
- ASSERT(!m_executionState.IsEmpty());
- v8::Local<v8::Value> argv[] = { m_executionState };
- v8::Local<v8::Value> result = callDebuggerMethod("frameCount", WTF_ARRAY_LENGTH(argv), argv).ToLocalChecked();
- if (result->IsInt32())
- return result->Int32Value();
- return 0;
-}
-
-PassOwnPtr<JavaScriptCallFrame> V8DebuggerImpl::currentCallFrames()
+JavaScriptCallFrames V8DebuggerImpl::currentCallFrames(int limit)
{
if (!m_isolate->InContext())
- return nullptr;
- v8::Local<v8::Value> currentCallFrameV8;
+ return JavaScriptCallFrames();
+ v8::Local<v8::Value> currentCallFramesV8;
if (m_executionState.IsEmpty()) {
- v8::Local<v8::Function> currentCallFrameFunction = v8::Local<v8::Function>::Cast(m_debuggerScript.Get(m_isolate)->Get(v8InternalizedString("currentCallFrame")));
- currentCallFrameV8 = v8::Debug::Call(debuggerContext(), currentCallFrameFunction).ToLocalChecked();
+ v8::Local<v8::Function> currentCallFramesFunction = v8::Local<v8::Function>::Cast(m_debuggerScript.Get(m_isolate)->Get(v8InternalizedString("currentCallFrames")));
+ currentCallFramesV8 = v8::Debug::Call(debuggerContext(), currentCallFramesFunction, v8::Integer::New(m_isolate, limit)).ToLocalChecked();
} else {
- v8::Local<v8::Value> argv[] = { m_executionState };
- currentCallFrameV8 = callDebuggerMethod("currentCallFrame", WTF_ARRAY_LENGTH(argv), argv).ToLocalChecked();
+ v8::Local<v8::Value> argv[] = { m_executionState, v8::Integer::New(m_isolate, limit) };
+ currentCallFramesV8 = callDebuggerMethod("currentCallFrames", WTF_ARRAY_LENGTH(argv), argv).ToLocalChecked();
}
- ASSERT(!currentCallFrameV8.IsEmpty());
- if (!currentCallFrameV8->IsObject())
- return nullptr;
- return JavaScriptCallFrame::create(debuggerContext(), v8::Local<v8::Object>::Cast(currentCallFrameV8));
-}
-
-PassOwnPtr<JavaScriptCallFrame> V8DebuggerImpl::callFrame(int index)
-{
- if (!m_isolate->InContext())
- return nullptr;
- v8::HandleScope handleScope(m_isolate);
-
- v8::Local<v8::Value> currentCallFrameV8;
- if (m_executionState.IsEmpty()) {
- v8::Local<v8::Function> currentCallFrameFunction = v8::Local<v8::Function>::Cast(m_debuggerScript.Get(m_isolate)->Get(v8InternalizedString("currentCallFrameByIndex")));
- currentCallFrameV8 = v8::Debug::Call(debuggerContext(), currentCallFrameFunction, v8::Integer::New(m_isolate, index)).ToLocalChecked();
- } else {
- v8::Local<v8::Value> argv[] = { m_executionState, v8::Integer::New(m_isolate, index) };
- currentCallFrameV8 = callDebuggerMethod("currentCallFrameByIndex", WTF_ARRAY_LENGTH(argv), argv).ToLocalChecked();
+ ASSERT(!currentCallFramesV8.IsEmpty());
+ if (!currentCallFramesV8->IsArray())
+ return JavaScriptCallFrames();
+ v8::Local<v8::Array> callFramesArray = currentCallFramesV8.As<v8::Array>();
+ JavaScriptCallFrames callFrames;
+ for (size_t i = 0; i < callFramesArray->Length(); ++i) {
+ v8::Local<v8::Value> callFrameValue;
+ if (!callFramesArray->Get(debuggerContext(), i).ToLocal(&callFrameValue))
+ return JavaScriptCallFrames();
+ if (!callFrameValue->IsObject())
+ return JavaScriptCallFrames();
+ v8::Local<v8::Object> callFrameObject = callFrameValue.As<v8::Object>();
+ callFrames.append(JavaScriptCallFrame::create(debuggerContext(), v8::Local<v8::Object>::Cast(callFrameObject)));
}
- ASSERT(!currentCallFrameV8.IsEmpty());
- if (!currentCallFrameV8->IsObject())
- return nullptr;
- return JavaScriptCallFrame::create(debuggerContext(), v8::Local<v8::Object>::Cast(currentCallFrameV8));
+ return callFrames;
}
static V8DebuggerImpl* toV8DebuggerImpl(v8::Local<v8::Value> data)
@@ -552,7 +531,7 @@ void V8DebuggerImpl::handleProgramBreak(v8::Local<v8::Context> pausedContext, v8
m_pausedContext = pausedContext;
m_executionState = executionState;
- V8DebuggerAgentImpl::SkipPauseRequest result = agent->didPause(pausedContext, currentCallFrames(), exception, breakpointIds, isPromiseRejection);
+ V8DebuggerAgentImpl::SkipPauseRequest result = agent->didPause(pausedContext, exception, breakpointIds, isPromiseRejection);
if (result == V8DebuggerAgentImpl::RequestNoSkip) {
m_runningNestedMessageLoop = true;
int groupId = getGroupId(pausedContext);
diff --git a/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerImpl.h b/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerImpl.h
index 83213ec..0a96e8e09 100644
--- a/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerImpl.h
+++ b/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerImpl.h
@@ -32,6 +32,7 @@
#define V8DebuggerImpl_h
#include "platform/inspector_protocol/TypeBuilder.h"
+#include "platform/v8_inspector/JavaScriptCallFrame.h"
#include "platform/v8_inspector/V8DebuggerScript.h"
#include "platform/v8_inspector/public/V8Debugger.h"
#include "wtf/PassOwnPtr.h"
@@ -43,7 +44,6 @@ namespace blink {
using protocol::Maybe;
-class JavaScriptCallFrame;
struct ScriptBreakpoint;
class V8DebuggerAgentImpl;
class V8RuntimeAgentImpl;
@@ -83,10 +83,8 @@ public:
void stepOutOfFunction();
void clearStepping();
- bool setScriptSource(const String16& sourceID, const String16& newContent, bool preview, ErrorString*, Maybe<protocol::Debugger::SetScriptSourceError>*, OwnPtr<JavaScriptCallFrame>* newCallFrames, Maybe<bool>* stackChanged);
- PassOwnPtr<JavaScriptCallFrame> currentCallFrames();
- PassOwnPtr<JavaScriptCallFrame> callFrame(int index);
- int frameCount();
+ bool setScriptSource(const String16& sourceID, const String16& newContent, bool preview, ErrorString*, Maybe<protocol::Debugger::SetScriptSourceError>*, JavaScriptCallFrames* newCallFrames, Maybe<bool>* stackChanged);
+ JavaScriptCallFrames currentCallFrames(int limit = 0);
bool isPaused();
v8::Local<v8::Context> pausedContext() { return m_pausedContext; }
diff --git a/third_party/WebKit/Source/platform/v8_inspector/debugger_script_externs.js b/third_party/WebKit/Source/platform/v8_inspector/debugger_script_externs.js
index 75e7a16..5eebeca 100644
--- a/third_party/WebKit/Source/platform/v8_inspector/debugger_script_externs.js
+++ b/third_party/WebKit/Source/platform/v8_inspector/debugger_script_externs.js
@@ -58,7 +58,6 @@ var JavaScriptCallFrameDetails;
column: function():number,
thisObject: !Object,
evaluate: function(string):*,
- caller: *,
restart: function():undefined,
setVariableValue: function(number, string, *):undefined,
isAtReturn: boolean,