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

Unified Diff: LayoutTests/inspector/sources/debugger/debugger-compile-and-run.html

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: LayoutTests/inspector/sources/debugger/debugger-compile-and-run.html
diff --git a/LayoutTests/inspector/sources/debugger/debugger-compile-and-run.html b/LayoutTests/inspector/sources/debugger/debugger-compile-and-run.html
index bb2e449d105f60e334a5c162c9ca54766551c230..61799d177b247477aa04c6fb9eb518ee3d7693fe 100644
--- a/LayoutTests/inspector/sources/debugger/debugger-compile-and-run.html
+++ b/LayoutTests/inspector/sources/debugger/debugger-compile-and-run.html
@@ -5,6 +5,25 @@
<script>
var test = function()
{
+ function printExceptionDetails(exceptionDetails)
+ {
+ InspectorTest.addResult("exceptionDetails:")
+ InspectorTest.addResult(" " + exceptionDetails.text);
+ InspectorTest.addResult(" line: " + exceptionDetails.line + ", column: " + exceptionDetails.column);
+
+ var stack = exceptionDetails.stackTrace;
+ if (!stack) {
+ InspectorTest.addResult(" no stack trace attached to exceptionDetails");
+ } else {
+ InspectorTest.addResult(" exceptionDetails stack trace:");
+ for (var i = 0; i < stack.length && i < 100; ++i) {
+ InspectorTest.addResult(" url: " + stack[i].url);
+ InspectorTest.addResult(" function: " + stack[i].functionName);
+ InspectorTest.addResult(" line: " + stack[i].lineNumber);
+ }
+ }
+ }
+
InspectorTest.runDebuggerTestSuite([
function testSuccessfulCompileAndRun(next)
{
@@ -12,18 +31,18 @@ var test = function()
InspectorTest.addResult("Compiling script");
DebuggerAgent.compileScript(expression, "test.js", compileCallback.bind(this));
- function compileCallback(error, scriptId, syntaxErrorMessage)
+ function compileCallback(error, scriptId, exceptionDetails)
{
InspectorTest.assertTrue(!error);
- InspectorTest.assertTrue(!syntaxErrorMessage);
+ InspectorTest.assertTrue(!exceptionDetails);
InspectorTest.assertTrue(!!scriptId);
- var contextId = undefined;
InspectorTest.addResult("Running script");
- DebuggerAgent.runScript(scriptId, contextId, "console", false, runCallback.bind(this));
+ DebuggerAgent.runScript(scriptId, undefined, "console", false, runCallback.bind(this));
}
- function runCallback(error, result, wasThrown)
+ function runCallback(error, result, exceptionDetails)
{
+ var wasThrown = !!exceptionDetails;
InspectorTest.assertTrue(!error);
InspectorTest.assertTrue(!wasThrown);
InspectorTest.addResult("Script result: " + result.value);
@@ -37,21 +56,21 @@ var test = function()
InspectorTest.addResult("Compiling script");
DebuggerAgent.compileScript(expression, "test.js", compileCallback.bind(this));
- function compileCallback(error, scriptId, syntaxErrorMessage)
+ function compileCallback(error, scriptId, exceptionDetails)
{
InspectorTest.assertTrue(!error);
- InspectorTest.assertTrue(!syntaxErrorMessage);
+ InspectorTest.assertTrue(!exceptionDetails);
InspectorTest.assertTrue(!!scriptId);
- var contextId = undefined;
InspectorTest.addResult("Running script");
- DebuggerAgent.runScript(scriptId, contextId, "console", false, runCallback.bind(this));
+ DebuggerAgent.runScript(scriptId, undefined, "console", false, runCallback.bind(this));
}
- function runCallback(error, result, wasThrown)
+ function runCallback(error, result, exceptionDetails)
{
+ var wasThrown = !!exceptionDetails;
InspectorTest.assertTrue(!error);
InspectorTest.assertTrue(wasThrown);
- InspectorTest.addResult("Script run error: " + result.description);
+ printExceptionDetails(exceptionDetails);
next();
}
},
@@ -60,13 +79,15 @@ var test = function()
{
var expression = "}";
InspectorTest.addResult("Compiling script");
- DebuggerAgent.compileScript(expression, "test.js", compileCallback.bind(this));
+ var contextId = undefined;
+ DebuggerAgent.compileScript(expression, "test.js", contextId, compileCallback.bind(this));
- function compileCallback(error, scriptId, syntaxErrorMessage)
+ function compileCallback(error, scriptId, exceptionDetails)
{
InspectorTest.assertTrue(!error);
+ InspectorTest.assertTrue(!!exceptionDetails);
InspectorTest.assertTrue(!scriptId);
- InspectorTest.addResult("Script compile error: " + syntaxErrorMessage);
+ printExceptionDetails(exceptionDetails);
next();
}
}

Powered by Google App Engine
This is Rietveld 408576698