| 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 = self.runtime.sharedInstance(WebInspector.WatchExp
ressionsSidebarPane); | 29 var watchExpressionsPane = self.runtime.sharedInstance(Sources.WatchExpressi
onsSidebarPane); |
| 30 WebInspector.panels.sources._sidebarPaneStack.showView(WebInspector.panels.s
ources._watchSidebarPane).then(() => { | 30 UI.panels.sources._sidebarPaneStack.showView(UI.panels.sources._watchSidebar
Pane).then(() => { |
| 31 watchExpressionsPane.doUpdate(); | 31 watchExpressionsPane.doUpdate(); |
| 32 watchExpressionsPane._createWatchExpression("globalObject"); | 32 watchExpressionsPane._createWatchExpression("globalObject"); |
| 33 watchExpressionsPane._createWatchExpression("windowAlias"); | 33 watchExpressionsPane._createWatchExpression("windowAlias"); |
| 34 watchExpressionsPane._createWatchExpression("array"); | 34 watchExpressionsPane._createWatchExpression("array"); |
| 35 watchExpressionsPane._createWatchExpression("func"); | 35 watchExpressionsPane._createWatchExpression("func"); |
| 36 watchExpressionsPane._saveExpressions(); | 36 watchExpressionsPane._saveExpressions(); |
| 37 InspectorTest.deprecatedRunAfterPendingDispatches(step2); | 37 InspectorTest.deprecatedRunAfterPendingDispatches(step2); |
| 38 }); | 38 }); |
| 39 | 39 |
| 40 function step2() | 40 function step2() |
| (...skipping 13 matching lines...) Expand all Loading... |
| 54 | 54 |
| 55 function step4() | 55 function step4() |
| 56 { | 56 { |
| 57 InspectorTest.addResult("Watch expressions after page reload:"); | 57 InspectorTest.addResult("Watch expressions after page reload:"); |
| 58 dumpWatchExpressions(); | 58 dumpWatchExpressions(); |
| 59 InspectorTest.completeTest(); | 59 InspectorTest.completeTest(); |
| 60 } | 60 } |
| 61 | 61 |
| 62 function dumpWatchExpressions() | 62 function dumpWatchExpressions() |
| 63 { | 63 { |
| 64 var pane = self.runtime.sharedInstance(WebInspector.WatchExpressionsSide
barPane); | 64 var pane = self.runtime.sharedInstance(Sources.WatchExpressionsSidebarPa
ne); |
| 65 | 65 |
| 66 for (var i = 0; i < pane._watchExpressions.length; i++) { | 66 for (var i = 0; i < pane._watchExpressions.length; i++) { |
| 67 var watch = pane._watchExpressions[i]; | 67 var watch = pane._watchExpressions[i]; |
| 68 InspectorTest.addResult(watch.expression() + ": " + watch._objectPro
pertiesSection._object._description); | 68 InspectorTest.addResult(watch.expression() + ": " + watch._objectPro
pertiesSection._object._description); |
| 69 dumpObjectPropertiesTreeElement(watch._objectPropertiesSection.objec
tTreeElement(), " "); | 69 dumpObjectPropertiesTreeElement(watch._objectPropertiesSection.objec
tTreeElement(), " "); |
| 70 } | 70 } |
| 71 } | 71 } |
| 72 | 72 |
| 73 function dumpObjectPropertiesTreeElement(treeElement, indent) | 73 function dumpObjectPropertiesTreeElement(treeElement, indent) |
| 74 { | 74 { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 101 return; | 101 return; |
| 102 } | 102 } |
| 103 | 103 |
| 104 treeoutline.removeEventListener(TreeOutline.Events.ElementAttached,
elementAttached); | 104 treeoutline.removeEventListener(TreeOutline.Events.ElementAttached,
elementAttached); |
| 105 callback(); | 105 callback(); |
| 106 } | 106 } |
| 107 } | 107 } |
| 108 | 108 |
| 109 function expandWatchExpression(path, callback) | 109 function expandWatchExpression(path, callback) |
| 110 { | 110 { |
| 111 var pane = self.runtime.sharedInstance(WebInspector.WatchExpressionsSide
barPane); | 111 var pane = self.runtime.sharedInstance(Sources.WatchExpressionsSidebarPa
ne); |
| 112 var expression = path.shift(); | 112 var expression = path.shift(); |
| 113 for (var i = 0; i < pane._watchExpressions.length; i++) { | 113 for (var i = 0; i < pane._watchExpressions.length; i++) { |
| 114 var watch = pane._watchExpressions[i]; | 114 var watch = pane._watchExpressions[i]; |
| 115 if (watch.expression() === expression) { | 115 if (watch.expression() === expression) { |
| 116 expandProperties(watch._objectPropertiesSection, path, callback)
; | 116 expandProperties(watch._objectPropertiesSection, path, callback)
; |
| 117 break; | 117 break; |
| 118 } | 118 } |
| 119 } | 119 } |
| 120 } | 120 } |
| 121 | 121 |
| 122 function addResult(string) | 122 function addResult(string) |
| 123 { | 123 { |
| 124 InspectorTest.addResult(string.replace("\u2026", "..")); | 124 InspectorTest.addResult(string.replace("\u2026", "..")); |
| 125 } | 125 } |
| 126 } | 126 } |
| 127 | 127 |
| 128 </script> | 128 </script> |
| 129 </head> | 129 </head> |
| 130 <body onload="runTest()"> | 130 <body onload="runTest()"> |
| 131 <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> |
| 132 <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> |
| 133 </body> | 133 </body> |
| 134 </html> | 134 </html> |
| OLD | NEW |