Upstream version 5.34.98.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / inspector / debugger / function-display-name-call-stack.html
1 <html>
2 <head>
3 <script src="../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../http/tests/inspector/debugger-test.js"></script>
5 <script>
6 var error = false;
7
8 function func1()
9 {
10     debugger;
11 }
12 func1.displayName = "my.framework.foo";
13
14 var func2 = (function() {
15     var f = function() { func1(); }
16     f.displayName = "my.framework.bar";
17     return f;
18 })();
19
20 var func3 = function() { func2(); }
21 func3.__defineGetter__("displayName", function() { error = true; throw new Error("Should not crash!"); });
22
23 function func4() { func3(); }
24 func4.__defineGetter__("displayName", function() { error = true; return "FAIL: Should not execute getters!"; });
25
26 function func5() { func4(); }
27 func5.displayName = "my.framework.func5";
28 func5.__defineSetter__("displayName", function() { error = true; throw new Error("FAIL: Should not call setter!"); });
29
30 function func6() { func5(); }
31 func6.displayName = { "foo": 6, toString: function() { error = true; return "FAIL: Should not call toString!"; } };
32
33 function testFunction()
34 {
35     (function() {
36         arguments.callee.displayName = "<anonymous_inside_testFunction>";
37         func6();
38     })();
39     console.assert(!error, "FAIL: No getter or setter or toString should have been called!");
40 }
41 testFunction.displayName = "<InspectorTest::testFunction>";
42
43 function test()
44 {
45     InspectorTest.startDebuggerTest(step1);
46
47     function step1()
48     {
49         InspectorTest.runTestFunctionAndWaitUntilPaused(step2);
50     }
51
52     function step2(callFrames)
53     {
54         InspectorTest.captureStackTrace(callFrames);
55         InspectorTest.completeDebuggerTest();
56     }
57 };
58
59 </script>
60
61 </head>
62
63 <body onload="runTest()">
64 <p>Tests that we display function's "displayName" property in the call stack.
65 <a href="http://code.google.com/p/chromium/issues/detail?id=17356">CrBug 17356</a>
66 </p>
67
68 </body>
69 </html>