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

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, 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: 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..368df307c57b5ba1f905d64da7dfa6f3bc7895f4 100644
--- a/LayoutTests/inspector/sources/debugger/debugger-compile-and-run.html
+++ b/LayoutTests/inspector/sources/debugger/debugger-compile-and-run.html
@@ -5,25 +5,47 @@
<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)
vsevik 2014/05/22 15:40:46 Please put { on the same line here (we only put {
+ {
+ InspectorTest.addResult(" url: " + stack[i].url);
+ InspectorTest.addResult(" function: " + stack[i].functionName);
+ InspectorTest.addResult(" line: " + stack[i].lineNumber);
+ }
+ }
+ }
+
InspectorTest.runDebuggerTestSuite([
function testSuccessfulCompileAndRun(next)
{
var expression = "var a = 1; var b = 2; a + b; ";
InspectorTest.addResult("Compiling script");
- DebuggerAgent.compileScript(expression, "test.js", compileCallback.bind(this));
+ var contextId = undefined;
vsevik 2014/05/22 15:40:46 = undefined is redundant.
vsevik 2014/05/22 15:42:01 Actually passing this variable is also redundant.
+ DebuggerAgent.compileScript(expression, "test.js", contextId, 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));
}
- 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);
@@ -35,23 +57,25 @@ var test = function()
{
var expression = "var a = 1; a + c; ";
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(!syntaxErrorMessage);
+ InspectorTest.assertTrue(!exceptionDetails);
InspectorTest.assertTrue(!!scriptId);
var contextId = undefined;
InspectorTest.addResult("Running script");
DebuggerAgent.runScript(scriptId, contextId, "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 +84,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