summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/inspector/sources/debugger-pause/function-name-in-callstack.html
blob: 095990090f52e4b12ad1b859fe64b561977f79a1 (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
48
49
50
51
52
53
54
55
56
57
58
59
<html>
<head>
<script src="../../../http/tests/inspector/inspector-test.js"></script>
<script src="../../../http/tests/inspector/debugger-test.js"></script>
<script>
var foo = function ()
{
    debugger;
}

foo.displayName = 'foo.displayName';
Object.defineProperty(foo, 'name', { value: 'foo.function.name' } );

var bar = function()
{
    foo();
}

bar.displayName = 'bar.displayName';

var baz = function()
{
    bar();
}

Object.defineProperty(baz, 'name', { value: 'baz.function.name' } );

function testFunction()
{
    baz();
}

function test()
{
    InspectorTest.startDebuggerTest(step1);

    function step1()
    {
        InspectorTest.runTestFunctionAndWaitUntilPaused(step2);
    }

    function step2(callFrames)
    {
        InspectorTest.addResult("callFrames.length = " + callFrames.length);
        for (var i = 0; i < callFrames.length; ++i)
            InspectorTest.addResult("functionName: " + callFrames[i].functionName);
        InspectorTest.completeDebuggerTest();
    }
}
</script>
</head>

<body onload="runTest()">
<p>
Tests that callFrames on pause contains function name taking into account displayName and Function.name.
</p>

</body>
</html>