OLD | NEW |
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/elements-test.js"></script> | 4 <script src="../../../http/tests/inspector/elements-test.js"></script> |
5 <script src="../../../http/tests/inspector/network-test.js"></script> | 5 <script src="../../../http/tests/inspector/network-test.js"></script> |
6 <script src="../../../http/tests/inspector/debugger-test.js"></script> | 6 <script src="../../../http/tests/inspector/debugger-test.js"></script> |
7 <script> | 7 <script> |
8 function testFunction() | 8 function testFunction() |
9 { | 9 { |
10 var x = Math.sqrt(10); | 10 var x = Math.sqrt(10); |
11 return x; | 11 return x; |
12 } | 12 } |
13 | 13 |
14 var test = function() | 14 var test = function() |
15 { | 15 { |
16 InspectorTest.setQuiet(true); | 16 InspectorTest.setQuiet(true); |
17 InspectorTest.startDebuggerTest(step1); | 17 InspectorTest.startDebuggerTest(step1); |
18 | 18 |
19 var currentSourceFrame; | 19 var currentSourceFrame; |
20 var watchExpressionsSection; | 20 var watchExpressionsPane; |
| 21 //callback per each watchExpression called twice: in constructor and when ac
tual evaluation result is available |
| 22 var updateCount = 4; |
21 | 23 |
22 function step1() | 24 function step1() |
23 { | 25 { |
24 var watchExpressionsPane = WebInspector.panels.sources.sidebarPanes.watc
hExpressions; | 26 watchExpressionsPane = WebInspector.panels.sources.sidebarPanes.watchExp
ressions; |
25 watchExpressionsPane.expand(); | 27 watchExpressionsPane.expand(); |
26 | 28 watchExpressionsPane.addExpression("window.document"); |
27 watchExpressionsSection = watchExpressionsPane.section; | 29 watchExpressionsPane.addExpression("windowa.document"); |
28 watchExpressionsSection.watchExpressions = []; | |
29 watchExpressionsSection.watchExpressions.push("window.document"); | |
30 watchExpressionsSection.watchExpressions.push("windowa.document"); | |
31 watchExpressionsSection.update(); | |
32 | 30 |
33 var testName = InspectorTest.resourceTreeModel.inspectedPageURL(); | 31 var testName = InspectorTest.resourceTreeModel.inspectedPageURL(); |
34 testName = testName.substring(testName.lastIndexOf('/') + 1); | 32 testName = testName.substring(testName.lastIndexOf('/') + 1); |
35 InspectorTest.showScriptSource(testName, didShowScriptSource); | 33 InspectorTest.showScriptSource(testName, didShowScriptSource); |
36 } | 34 } |
37 | 35 |
38 function didShowScriptSource(sourceFrame) | 36 function didShowScriptSource(sourceFrame) |
39 { | 37 { |
40 currentSourceFrame = sourceFrame; | 38 currentSourceFrame = sourceFrame; |
41 InspectorTest.addResult("Script source was shown."); | 39 InspectorTest.addResult("Script source was shown."); |
42 InspectorTest.setBreakpoint(currentSourceFrame, 9, "", true); | 40 InspectorTest.setBreakpoint(currentSourceFrame, 9, "", true); |
43 InspectorTest.addSniffer(WebInspector.WatchExpressionsSection.prototype,
"update", watchExpressionsUpdated); | 41 InspectorTest.addSniffer(WebInspector.WatchExpression.prototype, "_creat
eWatchExpression", watchExpressionsUpdated, true); |
44 // Switch to another panel to test how watch expressions evaluation toge
ther with panel switching. | 42 // Switch to another panel to test how watch expressions evaluation toge
ther with panel switching. |
45 WebInspector.NetworkPanel.show(); | 43 WebInspector.NetworkPanel.show(); |
46 InspectorTest.runTestFunctionAndWaitUntilPaused(didPause); | 44 InspectorTest.runTestFunctionAndWaitUntilPaused(didPause); |
47 } | 45 } |
48 | 46 |
49 function didPause(callFrames) | 47 function didPause(callFrames) |
50 { | 48 { |
51 } | 49 } |
52 | 50 |
53 function watchExpressionsUpdated() | 51 function watchExpressionsUpdated() |
54 { | 52 { |
| 53 updateCount--; |
| 54 if (updateCount) |
| 55 return; |
| 56 |
55 InspectorTest.addResult("Watch expressions updated."); | 57 InspectorTest.addResult("Watch expressions updated."); |
56 InspectorTest.dumpObjectPropertySection(watchExpressionsSection, {}); | |
57 | 58 |
58 // Clear watch expressions after execution. | 59 for (var i = 0; i < watchExpressionsPane._watchExpressions.length; i++)
{ |
59 watchExpressionsSection.watchExpressions = []; | 60 var watch = watchExpressionsPane._watchExpressions[i]; |
60 watchExpressionsSection.update(); | 61 var nameElement = watch._objectPresentationElement.querySelector(".n
ame"); |
| 62 var valueElement = watch._objectPresentationElement.querySelector(".
value"); |
| 63 InspectorTest.addResult("'" + nameElement.textContent + "'" + " => "
+ "'" + valueElement.textContent + "'"); |
| 64 } |
61 | 65 |
| 66 watchExpressionsPane._deleteAllButtonClicked(); |
62 InspectorTest.completeDebuggerTest(); | 67 InspectorTest.completeDebuggerTest(); |
63 } | 68 } |
64 } | 69 } |
65 | 70 |
66 </script> | 71 </script> |
67 </head> | 72 </head> |
68 <body onload="runTest()"> | 73 <body onload="runTest()"> |
69 <p>Tests debugger does not fail when stopped while a panel other than scripts wa
s opened. Both valid and invalid expressions are added to watch expressions.</p> | 74 <p>Tests debugger does not fail when stopped while a panel other than scripts wa
s opened. Both valid and invalid expressions are added to watch expressions.</p> |
70 <a href="https://bugs.webkit.org/show_bug.cgi?id=70718">Bug 70718</a> | 75 <a href="https://bugs.webkit.org/show_bug.cgi?id=70718">Bug 70718</a> |
71 </body> | 76 </body> |
72 </html> | 77 </html> |
OLD | NEW |