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

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, 6 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 17e182c41cf6ba0b9334e977160760bcc9d9c131..bec67a55aaf5169e35ce4a683fed9150dd4fec60 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;
@@ -888,7 +889,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<ExceptionDetails>& exceptionDetails)
{
InjectedScript injectedScript = injectedScriptForEval(errorString, executionContextId);
if (injectedScript.isEmpty()) {
@@ -897,17 +898,27 @@ void InspectorDebuggerAgent::compileScript(ErrorString* errorString, const Strin
}
String scriptIdValue;
- String exceptionMessage;
- scriptDebugServer().compileScript(injectedScript.scriptState(), expression, sourceURL, &scriptIdValue, &exceptionMessage);
- if (!scriptIdValue && !exceptionMessage) {
+ String exceptionDetailsText;
+ int lineNumberValue = 0;
+ int columnNumberValue = 0;
+ 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;
+ if (!scriptIdValue.isEmpty())
+ 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)
+void InspectorDebuggerAgent::runScript(ErrorString* errorString, const ScriptId& scriptId, const int* executionContextId, const String* const objectGroup, const bool* const doNotPauseOnExceptionsAndMuteConsole, RefPtr<RemoteObject>& result, RefPtr<ExceptionDetails>& exceptionDetails)
{
InjectedScript injectedScript = injectedScriptForEval(errorString, executionContextId);
if (injectedScript.isEmpty()) {
@@ -924,16 +935,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 exceptionDetailsText;
+ int lineNumberValue = 0;
+ int columnNumberValue = 0;
+ 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);
+ 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) {
unmuteConsole();

Powered by Google App Engine
This is Rietveld 408576698