| OLD | NEW |
| (Empty) |
| 1 <html> | |
| 2 <head> | |
| 3 <script src="../../../http/tests/inspector/inspector-test.js"></script> | |
| 4 <script src="../../../http/tests/inspector/elements-test.js"></script> | |
| 5 <script src="../../../http/tests/inspector/debugger-test.js"></script> | |
| 6 <script> | |
| 7 | |
| 8 var globalObject = { | |
| 9 foo: { | |
| 10 bar: { | |
| 11 baz: 2012 | |
| 12 } | |
| 13 } | |
| 14 }; | |
| 15 var windowAlias = window; | |
| 16 | |
| 17 var test = function() | |
| 18 { | |
| 19 var watchExpressionsSection; | |
| 20 InspectorTest.startDebuggerTest(step1); | |
| 21 | |
| 22 function step1() | |
| 23 { | |
| 24 var watchExpressionsPane = WebInspector.panels.sources.sidebarPanes.watc
hExpressions; | |
| 25 watchExpressionsPane.expand(); | |
| 26 | |
| 27 watchExpressionsSection = watchExpressionsPane.section; | |
| 28 watchExpressionsSection.watchExpressions = []; | |
| 29 watchExpressionsSection.watchExpressions.push("globalObject"); | |
| 30 watchExpressionsSection.watchExpressions.push("windowAlias"); | |
| 31 | |
| 32 InspectorTest.addSniffer(WebInspector.WatchExpressionsSection.prototype,
"updateProperties", step2); | |
| 33 watchExpressionsSection.update(); | |
| 34 } | |
| 35 | |
| 36 function expandProperty(parent, path, callback) | |
| 37 { | |
| 38 if (!path.length) return callback(); | |
| 39 var childName = path.shift(); | |
| 40 var child = InspectorTest._findChildPropertyTreeElement(parent, childNam
e); | |
| 41 if (!child) { | |
| 42 InspectorTest.addResult("Child not found: " + childName); | |
| 43 InspectorTest.completeTest() | |
| 44 return; | |
| 45 } | |
| 46 InspectorTest.addResult("expanded " + childName + " " + child.property.v
alue); | |
| 47 function afterGetOwnProperties() { | |
| 48 InspectorTest.runAfterPendingDispatches(expandProperty.bind(this, ch
ild, path, callback)); | |
| 49 } | |
| 50 InspectorTest.addSniffer(child.property.value, "getOwnProperties", after
GetOwnProperties.bind(this)); | |
| 51 child.expand(); | |
| 52 | |
| 53 } | |
| 54 | |
| 55 function dumpObjectPropertiesTreeElement(treeElement, indent) | |
| 56 { | |
| 57 if (treeElement.property) | |
| 58 InspectorTest.addResult(indent + treeElement.property.name + ": " +
treeElement.property.value._description); | |
| 59 for (var i = 0; i < treeElement.children.length; i++) | |
| 60 dumpObjectPropertiesTreeElement(treeElement.children[i], " " + inde
nt); | |
| 61 } | |
| 62 | |
| 63 function step2() | |
| 64 { | |
| 65 InspectorTest.addResult("Watch expressions added."); | |
| 66 expandProperty(watchExpressionsSection.propertiesTreeOutline, ["globalOb
ject", "foo", "bar"], step3); | |
| 67 } | |
| 68 | |
| 69 function step3() | |
| 70 { | |
| 71 InspectorTest.addResult("Watch expressions expanded."); | |
| 72 dumpObjectPropertiesTreeElement(watchExpressionsSection.propertiesTreeOu
tline, ""); | |
| 73 InspectorTest.reloadPage(step4); | |
| 74 } | |
| 75 | |
| 76 function step4() | |
| 77 { | |
| 78 InspectorTest.addResult("Watch expressions after page reload:"); | |
| 79 dumpObjectPropertiesTreeElement(watchExpressionsSection.propertiesTreeOu
tline, ""); | |
| 80 | |
| 81 // Clear watch expressions after execution. | |
| 82 watchExpressionsSection.watchExpressions = []; | |
| 83 watchExpressionsSection.update(); | |
| 84 InspectorTest.completeDebuggerTest(); | |
| 85 } | |
| 86 } | |
| 87 | |
| 88 </script> | |
| 89 </head> | |
| 90 <body onload="runTest()"> | |
| 91 <p>Test that watch expressions expansion state is restored after update.</p> | |
| 92 <a href="https://bugs.webkit.org/show_bug.cgi?id=99304">Bug 99304</a> | |
| 93 </body> | |
| 94 </html> | |
| OLD | NEW |