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 | |
8 function testFunction() | 9 function testFunction() |
9 { | 10 { |
10 var x = Math.sqrt(10); | 11 var x = Math.sqrt(16); |
12 debugger; | |
11 return x; | 13 return x; |
12 } | 14 } |
13 | 15 |
14 var test = function() | 16 function test() |
15 { | 17 { |
16 InspectorTest.setQuiet(true); | 18 InspectorTest.setQuiet(true); |
17 InspectorTest.startDebuggerTest(step1); | 19 InspectorTest.startDebuggerTest(step1); |
20 var updateCount = 6; | |
dgozman
2016/08/15 21:31:03
8
| |
18 | 21 |
19 var currentSourceFrame; | 22 WebInspector.settings.createLocalSetting("watchExpressions", []).set(["x", " y.foo"]); |
20 var watchExpressionsPane; | |
21 //callback per each watchExpression called twice: in constructor and when ac tual evaluation result is available | |
22 var updateCount = 4; | |
23 | 23 |
24 function step1() | 24 function step1() |
25 { | 25 { |
26 watchExpressionsPane = WebInspector.panels.sources.sidebarPanes.watchExp ressions; | 26 watchExpressionsPane = self.runtime.sharedInstance(WebInspector.WatchExp ressionsSidebarPane); |
27 watchExpressionsPane.revealView().then(() => { | 27 WebInspector.panels.sources._sidebarPaneStack.showView(WebInspector.pane ls.sources._watchSidebarPane).then(() => { |
28 watchExpressionsPane.addExpression("window.document"); | 28 InspectorTest.addSniffer(WebInspector.WatchExpression.prototype, "_c reateWatchExpression", watchExpressionsUpdated, true); |
29 watchExpressionsPane.addExpression("windowa.document"); | 29 InspectorTest.evaluateInPage("testFunction()"); |
30 var testName = InspectorTest.mainTarget.inspectedURL(); | |
31 testName = testName.substring(testName.lastIndexOf('/') + 1); | |
32 InspectorTest.showScriptSource(testName, didShowScriptSource); | |
33 }); | 30 }); |
34 } | 31 } |
35 | 32 |
36 function didShowScriptSource(sourceFrame) | 33 function watchExpressionsUpdated(result, wasThrown) |
37 { | 34 { |
38 currentSourceFrame = sourceFrame; | 35 InspectorTest.addResult(this._element.deepTextContent()); |
39 InspectorTest.addResult("Script source was shown."); | 36 if (--updateCount === 0) |
40 InspectorTest.setBreakpoint(currentSourceFrame, 9, "", true); | 37 InspectorTest.completeDebuggerTest(); |
41 InspectorTest.addSniffer(WebInspector.WatchExpression.prototype, "_creat eWatchExpression", watchExpressionsUpdated, true); | |
42 // Switch to another panel to test how watch expressions evaluation toge ther with panel switching. | |
43 WebInspector.NetworkPanel.show(); | |
44 InspectorTest.runTestFunctionAndWaitUntilPaused(didPause); | |
45 } | |
46 | |
47 function didPause(callFrames) | |
48 { | |
49 } | |
50 | |
51 function watchExpressionsUpdated() | |
52 { | |
53 updateCount--; | |
54 if (updateCount) | |
55 return; | |
56 | |
57 InspectorTest.addResult("Watch expressions updated."); | |
58 | |
59 for (var i = 0; i < watchExpressionsPane._watchExpressions.length; i++) { | |
60 var watch = watchExpressionsPane._watchExpressions[i]; | |
61 var nameElement = watch._objectPresentationElement.querySelector(".n ame"); | |
62 var valueElement = watch._objectPresentationElement.querySelector(". value"); | |
63 InspectorTest.addResult("'" + nameElement.textContent + "'" + " => " + "'" + valueElement.textContent + "'"); | |
64 } | |
65 | |
66 watchExpressionsPane._deleteAllButtonClicked(); | |
67 InspectorTest.completeDebuggerTest(); | |
68 } | 38 } |
69 } | 39 } |
70 | 40 |
71 </script> | 41 </script> |
72 </head> | 42 </head> |
73 <body onload="runTest()"> | 43 <body onload="runTest()"> |
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> | 44 <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> |
75 <a href="https://bugs.webkit.org/show_bug.cgi?id=70718">Bug 70718</a> | 45 <a href="https://bugs.webkit.org/show_bug.cgi?id=70718">Bug 70718</a> |
76 </body> | 46 </body> |
77 </html> | 47 </html> |
OLD | NEW |