Upstream version 11.40.271.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / inspector / sources / debugger / debugger-eval-on-call-frame-inside-iframe.html
1 <html>
2 <head>
3 <script src="../../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../../http/tests/inspector/console-test.js"></script>
5 <script src="../../../http/tests/inspector/debugger-test.js"></script>
6 <script>
7
8 function dirxml() { return "overridden dirxml() in top frame"; }
9
10 function onload()
11 {
12     var iframe = document.getElementById("iframe");
13     var doc = iframe.contentWindow.document;
14
15     var html = "<html><head><script>\n" +
16         "function dir() { return 'overridden dir() in iframe'; }\n" +
17         "function pauseInsideIframe()\n" +
18         "{\n" +
19         "    var table = 'local in iframe';\n" +
20         "    debugger;\n" +
21         "}\n" +
22         "</" + "script></" + "head><" + "body></" + "body></" + "html>";
23     doc.open();
24     doc.write(html);
25     doc.close();
26
27     runTest();
28 }
29
30 function testFunction()
31 {
32     var clear = "local in top frame";
33     var iframe = document.getElementById("iframe");
34     iframe.contentWindow.pauseInsideIframe.call({foo: 42});
35 }
36
37 var test = function()
38 {
39     var expressions = [
40         "dir()",
41         "dirxml()",
42         "table",
43         "clear",
44         "x:", // print correct syntax error: crbug.com/110163
45     ];
46
47     function evaluateInConsoleAndDump(callback)
48     {
49         var copy = expressions.slice();
50         inner();
51
52         function inner()
53         {
54             var expression = copy.shift();
55             if (expression)
56                 InspectorTest.evaluateInConsoleAndDump(expression, inner);
57             else
58                 callback();
59         }
60     }
61
62     InspectorTest.startDebuggerTest(step1, true);
63
64     function step1()
65     {
66         InspectorTest.runTestFunctionAndWaitUntilPaused(step2);
67     }
68
69     function step2(callFrames)
70     {
71         InspectorTest.captureStackTrace(callFrames);
72         InspectorTest.addResult("\n=== Evaluating on iframe ===");
73         evaluateInConsoleAndDump(step3);
74     }
75
76     function step3()
77     {
78         var pane = WebInspector.panels.sources.sidebarPanes.callstack;
79         pane._placardSelected(pane.placards[1]);
80         InspectorTest.runAfterPendingDispatches(step4);
81     }
82
83     function step4()
84     {
85         InspectorTest.addResult("\n=== Evaluating on top frame ===");
86         evaluateInConsoleAndDump(step5);
87     }
88
89     function step5()
90     {
91         InspectorTest.completeDebuggerTest();
92     }
93 }
94
95 </script>
96 </head>
97
98 <body onload="onload()">
99 <iframe id="iframe"></iframe>
100 <p>
101 Test that evaluation on call frame works across all inspected windows in the call stack.
102 </p>
103
104 </body>
105 </html>