Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1131)

Unified Diff: Source/core/inspector/InspectorDebuggerAgent.cpp

Issue 290633009: DevTools: Show detailed information for exceptions during snippet execution. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/inspector/InspectorDebuggerAgent.cpp
diff --git a/Source/core/inspector/InspectorDebuggerAgent.cpp b/Source/core/inspector/InspectorDebuggerAgent.cpp
index 3125322f308bc62bf78a27bde2f0c4131360a66d..b1190c9d21b608937f394045c23544c447d141cd 100644
--- a/Source/core/inspector/InspectorDebuggerAgent.cpp
+++ b/Source/core/inspector/InspectorDebuggerAgent.cpp
@@ -50,6 +50,7 @@
using WebCore::TypeBuilder::Array;
using WebCore::TypeBuilder::Debugger::BreakpointId;
using WebCore::TypeBuilder::Debugger::CallFrame;
+using WebCore::TypeBuilder::Debugger::ExceptionDetails;
using WebCore::TypeBuilder::Debugger::FunctionDetails;
using WebCore::TypeBuilder::Debugger::ScriptId;
using WebCore::TypeBuilder::Debugger::StackTrace;
@@ -935,7 +936,7 @@ void InspectorDebuggerAgent::evaluateOnCallFrame(ErrorString* errorString, const
}
}
-void InspectorDebuggerAgent::compileScript(ErrorString* errorString, const String& expression, const String& sourceURL, const int* executionContextId, TypeBuilder::OptOutput<ScriptId>* scriptId, TypeBuilder::OptOutput<String>* syntaxErrorMessage, TypeBuilder::OptOutput<int>* lineNumber, TypeBuilder::OptOutput<int>* columnNumber)
+void InspectorDebuggerAgent::compileScript(ErrorString* errorString, const String& expression, const String& sourceURL, const int* executionContextId, TypeBuilder::OptOutput<ScriptId>* scriptId, RefPtr<TypeBuilder::Debugger::ExceptionDetails>& exceptionDetails)
{
InjectedScript injectedScript = injectedScriptForEval(errorString, executionContextId);
if (injectedScript.isEmpty()) {
@@ -944,21 +945,27 @@ void InspectorDebuggerAgent::compileScript(ErrorString* errorString, const Strin
}
String scriptIdValue;
- String exceptionMessage;
+ String exceptionDetailsText;
int lineNumberValue = 0;
int columnNumberValue = 0;
- scriptDebugServer().compileScript(injectedScript.scriptState(), expression, sourceURL, &scriptIdValue, &exceptionMessage, &lineNumberValue, &columnNumberValue);
- if (!scriptIdValue && !exceptionMessage) {
+ RefPtr<ScriptCallStack> stackTraceValue;
+ scriptDebugServer().compileScript(injectedScript.scriptState(), expression, sourceURL, &scriptIdValue, &exceptionDetailsText, &lineNumberValue, &columnNumberValue, &stackTraceValue);
+ if (!scriptIdValue && !exceptionDetailsText) {
*errorString = "Script compilation failed";
return;
}
- *syntaxErrorMessage = exceptionMessage;
*scriptId = scriptIdValue;
- *lineNumber = lineNumberValue;
- *columnNumber = columnNumberValue;
+ if (!!scriptIdValue)
vsevik 2014/05/22 15:56:15 "if (scriptIdValue)" is well enough.
+ return;
+
+ exceptionDetails = ExceptionDetails::create().setText(exceptionDetailsText);
+ exceptionDetails->setLine(lineNumberValue);
+ exceptionDetails->setColumn(columnNumberValue);
+ if (stackTraceValue && stackTraceValue->size() > 0)
+ exceptionDetails->setStackTrace(stackTraceValue->buildInspectorArray());
}
-void InspectorDebuggerAgent::runScript(ErrorString* errorString, const ScriptId& scriptId, const int* executionContextId, const String* const objectGroup, const bool* const doNotPauseOnExceptionsAndMuteConsole, RefPtr<RemoteObject>& result, TypeBuilder::OptOutput<bool>* wasThrown, TypeBuilder::OptOutput<int>* lineNumber, TypeBuilder::OptOutput<int>* columnNumber)
+void InspectorDebuggerAgent::runScript(ErrorString* errorString, const ScriptId& scriptId, const int* executionContextId, const String* const objectGroup, const bool* const doNotPauseOnExceptionsAndMuteConsole, RefPtr<RemoteObject>& result, RefPtr<TypeBuilder::Debugger::ExceptionDetails>& exceptionDetails)
{
InjectedScript injectedScript = injectedScriptForEval(errorString, executionContextId);
if (injectedScript.isEmpty()) {
@@ -975,21 +982,22 @@ void InspectorDebuggerAgent::runScript(ErrorString* errorString, const ScriptId&
ScriptValue value;
bool wasThrownValue;
- String exceptionMessage;
+ String exceptionDetailsText;
int lineNumberValue = 0;
int columnNumberValue = 0;
- scriptDebugServer().runScript(injectedScript.scriptState(), scriptId, &value, &wasThrownValue, &exceptionMessage, &lineNumberValue, &columnNumberValue);
- *wasThrown = wasThrownValue;
+ RefPtr<ScriptCallStack> stackTraceValue;
+ scriptDebugServer().runScript(injectedScript.scriptState(), scriptId, &value, &wasThrownValue, &exceptionDetailsText, &lineNumberValue, &columnNumberValue, &stackTraceValue);
if (value.isEmpty()) {
*errorString = "Script execution failed";
return;
}
result = injectedScript.wrapObject(value, objectGroup ? *objectGroup : "");
- if (wasThrownValue)
- {
- result->setDescription(exceptionMessage);
- *lineNumber = lineNumberValue;
- *columnNumber = columnNumberValue;
+ if (wasThrownValue) {
+ exceptionDetails = ExceptionDetails::create().setText(exceptionDetailsText);
+ exceptionDetails->setLine(lineNumberValue);
+ exceptionDetails->setColumn(columnNumberValue);
+ if (stackTraceValue && stackTraceValue->size() > 0)
+ exceptionDetails->setStackTrace(stackTraceValue->buildInspectorArray());
}
if (doNotPauseOnExceptionsAndMuteConsole && *doNotPauseOnExceptionsAndMuteConsole) {

Powered by Google App Engine
This is Rietveld 408576698