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

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

Powered by Google App Engine
This is Rietveld 408576698