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>
15 var windowAlias = window;
19 var watchExpressionsSection;
21 // We need to initialize sources panel so that watch expressions section is created.
22 WebInspector.showPanel("sources");
23 InspectorTest.startDebuggerTest(step1);
27 var watchExpressionsPane = WebInspector.panels.sources.sidebarPanes.watchExpressions;
28 watchExpressionsPane.expand();
30 watchExpressionsSection = watchExpressionsPane.section;
31 watchExpressionsSection.watchExpressions = [];
32 watchExpressionsSection.watchExpressions.push("globalObject");
33 watchExpressionsSection.watchExpressions.push("windowAlias");
35 InspectorTest.addSniffer(WebInspector.WatchExpressionsSection.prototype, "updateProperties", step2);
36 watchExpressionsSection.update();
39 function expandProperty(parent, path, callback)
41 if (!path.length) return callback();
42 var childName = path.shift();
43 var child = InspectorTest._findChildPropertyTreeElement(parent, childName);
45 InspectorTest.addResult("Child not found: " + childName);
46 InspectorTest.completeTest()
49 InspectorTest.addResult("expanded " + childName + " " + child.property.value);
50 function afterGetOwnProperties() {
51 InspectorTest.runAfterPendingDispatches(expandProperty.bind(this, child, path, callback));
53 InspectorTest.addSniffer(child.property.value, "getOwnProperties", afterGetOwnProperties.bind(this));
58 function dumpObjectPropertiesTreeElement(treeElement, indent)
60 if (treeElement.property)
61 InspectorTest.addResult(indent + treeElement.property.name + ": " + treeElement.property.value._description);
62 for (var i = 0; i < treeElement.children.length; i++)
63 dumpObjectPropertiesTreeElement(treeElement.children[i], " " + indent);
68 InspectorTest.addResult("Watch expressions added.");
69 expandProperty(watchExpressionsSection.propertiesTreeOutline, ["globalObject", "foo", "bar"], step3);
74 InspectorTest.addResult("Watch expressions expanded.");
75 dumpObjectPropertiesTreeElement(watchExpressionsSection.propertiesTreeOutline, "");
76 InspectorTest.reloadPage(step4);
81 InspectorTest.addResult("Watch expressions after page reload:");
82 dumpObjectPropertiesTreeElement(watchExpressionsSection.propertiesTreeOutline, "");
84 // Clear watch expressions after execution.
85 watchExpressionsSection.watchExpressions = [];
86 watchExpressionsSection.update();
87 InspectorTest.completeDebuggerTest();
93 <body onload="runTest()">
94 <p>Test that watch expressions expansion state is restored after update.</p>
95 <a href="https://bugs.webkit.org/show_bug.cgi?id=99304">Bug 99304</a>