| 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/debugger-test.js"></script> | 5 <script src="../../../http/tests/inspector/debugger-test.js"></script> |
| 6 <script> | 6 <script> |
| 7 | 7 |
| 8 var globalObject = { | 8 var globalObject = { |
| 9 foo: { | 9 foo: { |
| 10 bar: { | 10 bar: { |
| 11 baz: 2012 | 11 baz: 2012 |
| 12 } | 12 } |
| 13 } | 13 } |
| 14 }; | 14 }; |
| 15 var windowAlias = window; | 15 var windowAlias = window; |
| 16 var array = []; | 16 var array = []; |
| 17 for (var i = 0; i < 300; ++i) | 17 for (var i = 0; i < 300; ++i) |
| 18 array[i] = i; | 18 array[i] = i; |
| 19 | 19 |
| 20 (function() | 20 (function() |
| 21 { | 21 { |
| 22 var a = 10; | 22 var a = 10; |
| 23 var b = 100; | 23 var b = 100; |
| 24 window.func = function() {return a + b;} | 24 window.func = function() {return a + b;} |
| 25 }()); | 25 }()); |
| 26 | 26 |
| 27 var test = function() | 27 var test = function() |
| 28 { | 28 { |
| 29 var watchExpressionsPane = WebInspector.panels.sources.sidebarPanes.watchExp
ressions; | 29 var watchExpressionsPane = self.runtime.sharedInstance(WebInspector.WatchExp
ressionsSidebarPane); |
| 30 watchExpressionsPane.revealView(); | 30 WebInspector.panels.sources._sidebarPaneStack.showView(WebInspector.panels.s
ources._watchSidebarPane).then(() => { |
| 31 watchExpressionsPane.addExpression("globalObject"); | 31 watchExpressionsPane.doUpdate(); |
| 32 watchExpressionsPane.addExpression("windowAlias"); | 32 watchExpressionsPane._createWatchExpression("globalObject"); |
| 33 watchExpressionsPane.addExpression("array"); | 33 watchExpressionsPane._createWatchExpression("windowAlias"); |
| 34 watchExpressionsPane.addExpression("func"); | 34 watchExpressionsPane._createWatchExpression("array"); |
| 35 InspectorTest.deprecatedRunAfterPendingDispatches(step2); | 35 watchExpressionsPane._createWatchExpression("func"); |
| 36 watchExpressionsPane._saveExpressions(); |
| 37 InspectorTest.deprecatedRunAfterPendingDispatches(step2); |
| 38 }); |
| 36 | 39 |
| 37 function step2() | 40 function step2() |
| 38 { | 41 { |
| 39 InspectorTest.addResult("Watch expressions added."); | 42 InspectorTest.addResult("Watch expressions added."); |
| 40 var expandArray = expandWatchExpression.bind(null, ["array", "[200 \u202
6 299]", "299"], step3); | 43 var expandArray = expandWatchExpression.bind(null, ["array", "[200 \u202
6 299]", "299"], step3); |
| 41 var expandFunc = expandWatchExpression.bind(null, ["func", "[[Scopes]]",
"0", "a"], expandArray); | 44 var expandFunc = expandWatchExpression.bind(null, ["func", "[[Scopes]]",
"0", "a"], expandArray); |
| 42 expandWatchExpression(["globalObject", "foo", "bar"], expandFunc); | 45 expandWatchExpression(["globalObject", "foo", "bar"], expandFunc); |
| 43 } | 46 } |
| 44 | 47 |
| 45 function step3() | 48 function step3() |
| 46 { | 49 { |
| 47 InspectorTest.addResult("Watch expressions expanded."); | 50 InspectorTest.addResult("Watch expressions expanded."); |
| 48 dumpWatchExpressions(); | 51 dumpWatchExpressions(); |
| 49 InspectorTest.reloadPage(step4); | 52 InspectorTest.reloadPage(step4); |
| 50 } | 53 } |
| 51 | 54 |
| 52 function step4() | 55 function step4() |
| 53 { | 56 { |
| 54 InspectorTest.addResult("Watch expressions after page reload:"); | 57 InspectorTest.addResult("Watch expressions after page reload:"); |
| 55 dumpWatchExpressions(); | 58 dumpWatchExpressions(); |
| 56 InspectorTest.completeTest(); | 59 InspectorTest.completeTest(); |
| 57 } | 60 } |
| 58 | 61 |
| 59 function dumpWatchExpressions() | 62 function dumpWatchExpressions() |
| 60 { | 63 { |
| 61 var pane = WebInspector.panels.sources.sidebarPanes.watchExpressions; | 64 var pane = self.runtime.sharedInstance(WebInspector.WatchExpressionsSide
barPane); |
| 62 | 65 |
| 63 for (var i = 0; i < pane._watchExpressions.length; i++) { | 66 for (var i = 0; i < pane._watchExpressions.length; i++) { |
| 64 var watch = pane._watchExpressions[i]; | 67 var watch = pane._watchExpressions[i]; |
| 65 InspectorTest.addResult(watch.expression() + ": " + watch._objectPro
pertiesSection._object._description); | 68 InspectorTest.addResult(watch.expression() + ": " + watch._objectPro
pertiesSection._object._description); |
| 66 dumpObjectPropertiesTreeElement(watch._objectPropertiesSection.objec
tTreeElement(), " "); | 69 dumpObjectPropertiesTreeElement(watch._objectPropertiesSection.objec
tTreeElement(), " "); |
| 67 } | 70 } |
| 68 } | 71 } |
| 69 | 72 |
| 70 function dumpObjectPropertiesTreeElement(treeElement, indent) | 73 function dumpObjectPropertiesTreeElement(treeElement, indent) |
| 71 { | 74 { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 98 return; | 101 return; |
| 99 } | 102 } |
| 100 | 103 |
| 101 treeoutline.removeEventListener(TreeOutline.Events.ElementAttached,
elementAttached); | 104 treeoutline.removeEventListener(TreeOutline.Events.ElementAttached,
elementAttached); |
| 102 callback(); | 105 callback(); |
| 103 } | 106 } |
| 104 } | 107 } |
| 105 | 108 |
| 106 function expandWatchExpression(path, callback) | 109 function expandWatchExpression(path, callback) |
| 107 { | 110 { |
| 108 var pane = WebInspector.panels.sources.sidebarPanes.watchExpressions; | 111 var pane = self.runtime.sharedInstance(WebInspector.WatchExpressionsSide
barPane); |
| 109 var expression = path.shift(); | 112 var expression = path.shift(); |
| 110 for (var i = 0; i < pane._watchExpressions.length; i++) { | 113 for (var i = 0; i < pane._watchExpressions.length; i++) { |
| 111 var watch = pane._watchExpressions[i]; | 114 var watch = pane._watchExpressions[i]; |
| 112 if (watch.expression() === expression) { | 115 if (watch.expression() === expression) { |
| 113 expandProperties(watch._objectPropertiesSection, path, callback)
; | 116 expandProperties(watch._objectPropertiesSection, path, callback)
; |
| 114 break; | 117 break; |
| 115 } | 118 } |
| 116 } | 119 } |
| 117 } | 120 } |
| 118 | 121 |
| 119 function addResult(string) | 122 function addResult(string) |
| 120 { | 123 { |
| 121 InspectorTest.addResult(string.replace("\u2026", "..")); | 124 InspectorTest.addResult(string.replace("\u2026", "..")); |
| 122 } | 125 } |
| 123 } | 126 } |
| 124 | 127 |
| 125 </script> | 128 </script> |
| 126 </head> | 129 </head> |
| 127 <body onload="runTest()"> | 130 <body onload="runTest()"> |
| 128 <p>Test that watch expressions expansion state is restored after update.</p> | 131 <p>Test that watch expressions expansion state is restored after update.</p> |
| 129 <a href="https://bugs.webkit.org/show_bug.cgi?id=99304">Bug 99304</a> | 132 <a href="https://bugs.webkit.org/show_bug.cgi?id=99304">Bug 99304</a> |
| 130 </body> | 133 </body> |
| 131 </html> | 134 </html> |
| OLD | NEW |