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

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 03a3f10dd6a0f009d3b931e7e110e25861317518..11e90e54bf7be8eda2ee5111e1776b513381b139 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::ExceptionMessage;
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)
+void InspectorDebuggerAgent::compileScript(ErrorString* errorString, const String& expression, const String& sourceURL, const int* executionContextId, TypeBuilder::OptOutput<ScriptId>* scriptId, RefPtr<TypeBuilder::Debugger::ExceptionMessage>& exceptionMessage)
{
InjectedScript injectedScript = injectedScriptForEval(errorString, executionContextId);
if (injectedScript.isEmpty()) {
@@ -944,17 +945,24 @@ void InspectorDebuggerAgent::compileScript(ErrorString* errorString, const Strin
}
String scriptIdValue;
- String exceptionMessage;
- scriptDebugServer().compileScript(injectedScript.scriptState(), expression, sourceURL, &scriptIdValue, &exceptionMessage);
- if (!scriptIdValue && !exceptionMessage) {
+ String exceptionMessageText;
+ int lineNumberValue = 0;
+ int columnNumberValue = 0;
+ RefPtr<ScriptCallStack> stackTraceValue;
+ scriptDebugServer().compileScript(injectedScript.scriptState(), expression, sourceURL, &scriptIdValue, &exceptionMessageText, &lineNumberValue, &columnNumberValue, &stackTraceValue);
+ if (!scriptIdValue && !exceptionMessageText) {
*errorString = "Script compilation failed";
return;
}
- *syntaxErrorMessage = exceptionMessage;
*scriptId = scriptIdValue;
+ exceptionMessage = ExceptionMessage::create().setText(exceptionMessageText);
vsevik 2014/05/19 12:40:23 We should only do this when scriptIdValue is not s
+ exceptionMessage->setLine(lineNumberValue);
+ exceptionMessage->setColumn(columnNumberValue);
+ if (stackTraceValue && stackTraceValue->size() > 0)
+ exceptionMessage->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)
+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::ExceptionMessage>& exceptionMessage)
{
InjectedScript injectedScript = injectedScriptForEval(errorString, executionContextId);
if (injectedScript.isEmpty()) {
@@ -971,16 +979,23 @@ void InspectorDebuggerAgent::runScript(ErrorString* errorString, const ScriptId&
ScriptValue value;
bool wasThrownValue;
- String exceptionMessage;
- scriptDebugServer().runScript(injectedScript.scriptState(), scriptId, &value, &wasThrownValue, &exceptionMessage);
- *wasThrown = wasThrownValue;
+ String exceptionMessageText;
+ int lineNumberValue = 0;
+ int columnNumberValue = 0;
+ RefPtr<ScriptCallStack> stackTraceValue;
+ scriptDebugServer().runScript(injectedScript.scriptState(), scriptId, &value, &wasThrownValue, &exceptionMessageText, &lineNumberValue, &columnNumberValue, &stackTraceValue);
if (value.isEmpty()) {
*errorString = "Script execution failed";
return;
}
result = injectedScript.wrapObject(value, objectGroup ? *objectGroup : "");
- if (wasThrownValue)
- result->setDescription(exceptionMessage);
+ if (wasThrownValue) {
+ exceptionMessage = ExceptionMessage::create().setText(exceptionMessageText);
+ exceptionMessage->setLine(lineNumberValue);
+ exceptionMessage->setColumn(columnNumberValue);
+ if (stackTraceValue && stackTraceValue->size() > 0)
+ exceptionMessage->setStackTrace(stackTraceValue->buildInspectorArray());
+ }
if (doNotPauseOnExceptionsAndMuteConsole && *doNotPauseOnExceptionsAndMuteConsole) {
unmuteConsole();

Powered by Google App Engine
This is Rietveld 408576698