summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/inspector/console/console-eval-exception-report.html
blob: d1c7b24c2406bc6335d0129be5bb2f035a907861 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<html>
<head>
<script src="../../http/tests/inspector/inspector-test.js"></script>
<script src="../../http/tests/inspector/console-test.js"></script>
<script>
function test()
{
    InspectorTest.evaluateInConsole("\
        function foo()\n\
        {\n\
            throw {a:239};\n\
        }\n\
        function boo()\n\
        {\n\
            foo();\n\
        }\n\
        boo();", afterEvaluate);

    function afterEvaluate()
    {
        InspectorTest.dumpConsoleMessages();

        var viewMessages = WebInspector.ConsoleView.instance()._visibleViewMessages;
        var uiMessage = viewMessages[viewMessages.length - 1];
        var message = uiMessage.consoleMessage();
        var stackTrace = message.stackTrace;

        if (stackTrace.callFrames.length < 3) {
            InspectorTest.addResult('FAILED: Stack size too small');
        } else {
            for (var i = 0; i < 3; ++i) {
                var frame = stackTrace.callFrames[i];
                InspectorTest.addResult('call frame:' + frame.functionName + ' at ' + frame.url + ':' + frame.lineNumber);
            }
        }
        InspectorTest.completeTest();
    }
}

</script>
</head>
<body onload="runTest()">
<p>
Tests that evaluating an expression with an exception in the console provide correct exception information.
</p>
</body>
</html>