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

Side by Side 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 unified diff | Download patch
OLDNEW
1 <html> 1 <html>
2 <head> 2 <head>
3 <script src="../../../http/tests/inspector/inspector-test.js"></script> 3 <script src="../../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../../http/tests/inspector/debugger-test.js"></script> 4 <script src="../../../http/tests/inspector/debugger-test.js"></script>
5 <script> 5 <script>
6 var test = function() 6 var test = function()
7 { 7 {
8 function printExceptionDetails(exceptionDetails)
9 {
10 InspectorTest.addResult('exceptionDetails:')
11 InspectorTest.addResult(' ' + exceptionDetails.text);
12 InspectorTest.addResult(' line: ' + exceptionDetails.line + ', column: ' + exceptionDetails.column);
13
14 var stack = exceptionDetails.stackTrace;
15 if (!stack) {
16 InspectorTest.addResult(" no stack trace attached to exceptionDeta ils");
17 } else {
18 InspectorTest.addResult(" exceptionDetails stack trace:");
19 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 {
20 {
21 InspectorTest.addResult(" url: " + stack[i].url);
22 InspectorTest.addResult(" function: " + stack[i].functionN ame);
23 InspectorTest.addResult(" line: " + stack[i].lineNumber);
24 }
25 }
26 }
27
8 InspectorTest.runDebuggerTestSuite([ 28 InspectorTest.runDebuggerTestSuite([
9 function testSuccessfulCompileAndRun(next) 29 function testSuccessfulCompileAndRun(next)
10 { 30 {
11 var expression = "var a = 1; var b = 2; a + b; "; 31 var expression = "var a = 1; var b = 2; a + b; ";
12 InspectorTest.addResult("Compiling script"); 32 InspectorTest.addResult("Compiling script");
13 DebuggerAgent.compileScript(expression, "test.js", compileCallback.b ind(this)); 33 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.
34 DebuggerAgent.compileScript(expression, "test.js", contextId, compil eCallback.bind(this));
14 35
15 function compileCallback(error, scriptId, syntaxErrorMessage) 36 function compileCallback(error, scriptId, exceptionDetails)
16 { 37 {
17 InspectorTest.assertTrue(!error); 38 InspectorTest.assertTrue(!error);
18 InspectorTest.assertTrue(!syntaxErrorMessage); 39 InspectorTest.assertTrue(!exceptionDetails);
19 InspectorTest.assertTrue(!!scriptId); 40 InspectorTest.assertTrue(!!scriptId);
20 var contextId = undefined; 41 var contextId = undefined;
21 InspectorTest.addResult("Running script"); 42 InspectorTest.addResult("Running script");
22 DebuggerAgent.runScript(scriptId, contextId, "console", false, r unCallback.bind(this)); 43 DebuggerAgent.runScript(scriptId, contextId, "console", false, r unCallback.bind(this));
23 } 44 }
24 45
25 function runCallback(error, result, wasThrown) 46 function runCallback(error, result, exceptionDetails)
26 { 47 {
48 var wasThrown = !!exceptionDetails;
27 InspectorTest.assertTrue(!error); 49 InspectorTest.assertTrue(!error);
28 InspectorTest.assertTrue(!wasThrown); 50 InspectorTest.assertTrue(!wasThrown);
29 InspectorTest.addResult("Script result: " + result.value); 51 InspectorTest.addResult("Script result: " + result.value);
30 next(); 52 next();
31 } 53 }
32 }, 54 },
33 55
34 function testRunError(next) 56 function testRunError(next)
35 { 57 {
36 var expression = "var a = 1; a + c; "; 58 var expression = "var a = 1; a + c; ";
37 InspectorTest.addResult("Compiling script"); 59 InspectorTest.addResult("Compiling script");
38 DebuggerAgent.compileScript(expression, "test.js", compileCallback.b ind(this)); 60 var contextId = undefined;
61 DebuggerAgent.compileScript(expression, "test.js", contextId, compil eCallback.bind(this));
39 62
40 function compileCallback(error, scriptId, syntaxErrorMessage) 63 function compileCallback(error, scriptId, exceptionDetails)
41 { 64 {
42 InspectorTest.assertTrue(!error); 65 InspectorTest.assertTrue(!error);
43 InspectorTest.assertTrue(!syntaxErrorMessage); 66 InspectorTest.assertTrue(!exceptionDetails);
44 InspectorTest.assertTrue(!!scriptId); 67 InspectorTest.assertTrue(!!scriptId);
45 var contextId = undefined; 68 var contextId = undefined;
46 InspectorTest.addResult("Running script"); 69 InspectorTest.addResult("Running script");
47 DebuggerAgent.runScript(scriptId, contextId, "console", false, r unCallback.bind(this)); 70 DebuggerAgent.runScript(scriptId, contextId, "console", false, r unCallback.bind(this));
48 } 71 }
49 72
50 function runCallback(error, result, wasThrown) 73 function runCallback(error, result, exceptionDetails)
51 { 74 {
75 var wasThrown = !!exceptionDetails;
52 InspectorTest.assertTrue(!error); 76 InspectorTest.assertTrue(!error);
53 InspectorTest.assertTrue(wasThrown); 77 InspectorTest.assertTrue(wasThrown);
54 InspectorTest.addResult("Script run error: " + result.descriptio n); 78 printExceptionDetails(exceptionDetails);
55 next(); 79 next();
56 } 80 }
57 }, 81 },
58 82
59 function testCompileError(next) 83 function testCompileError(next)
60 { 84 {
61 var expression = "}"; 85 var expression = "}";
62 InspectorTest.addResult("Compiling script"); 86 InspectorTest.addResult("Compiling script");
63 DebuggerAgent.compileScript(expression, "test.js", compileCallback.b ind(this)); 87 var contextId = undefined;
88 DebuggerAgent.compileScript(expression, "test.js", contextId, compil eCallback.bind(this));
64 89
65 function compileCallback(error, scriptId, syntaxErrorMessage) 90 function compileCallback(error, scriptId, exceptionDetails)
66 { 91 {
67 InspectorTest.assertTrue(!error); 92 InspectorTest.assertTrue(!error);
93 InspectorTest.assertTrue(!!exceptionDetails);
68 InspectorTest.assertTrue(!scriptId); 94 InspectorTest.assertTrue(!scriptId);
69 InspectorTest.addResult("Script compile error: " + syntaxErrorMe ssage); 95 printExceptionDetails(exceptionDetails);
70 next(); 96 next();
71 } 97 }
72 } 98 }
73 ]); 99 ]);
74 } 100 }
75 </script> 101 </script>
76 </head> 102 </head>
77 <body onload="runTest()"> 103 <body onload="runTest()">
78 <p>Tests separate compilation and run.</p> 104 <p>Tests separate compilation and run.</p>
79 <a href="https://bugs.webkit.org/show_bug.cgi?id=89646">Bug 89646.</a> 105 <a href="https://bugs.webkit.org/show_bug.cgi?id=89646">Bug 89646.</a>
80 </body> 106 </body>
81 </html> 107 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698