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
;
20 InspectorTest
.startDebuggerTest(step1
);
24 var watchExpressionsPane
= WebInspector
.panels
.sources
.sidebarPanes
.watchExpressions
;
25 watchExpressionsPane
.expand();
27 watchExpressionsSection
= watchExpressionsPane
.section
;
28 watchExpressionsSection
.watchExpressions
= [];
29 watchExpressionsSection
.watchExpressions
.push("globalObject");
30 watchExpressionsSection
.watchExpressions
.push("windowAlias");
32 InspectorTest
.addSniffer(WebInspector
.WatchExpressionsSection
.prototype, "updateProperties", step2
);
33 watchExpressionsSection
.update();
36 function expandProperty(parent
, path
, callback
)
38 if (!path
.length
) return callback();
39 var childName
= path
.shift();
40 var child
= InspectorTest
._findChildPropertyTreeElement(parent
, childName
);
42 InspectorTest
.addResult("Child not found: " + childName
);
43 InspectorTest
.completeTest()
46 InspectorTest
.addResult("expanded " + childName
+ " " + child
.property
.value
);
47 function afterGetOwnProperties() {
48 InspectorTest
.runAfterPendingDispatches(expandProperty
.bind(this, child
, path
, callback
));
50 InspectorTest
.addSniffer(child
.property
.value
, "getOwnProperties", afterGetOwnProperties
.bind(this));
55 function dumpObjectPropertiesTreeElement(treeElement
, indent
)
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
], " " + indent
);
65 InspectorTest
.addResult("Watch expressions added.");
66 expandProperty(watchExpressionsSection
.propertiesTreeOutline
, ["globalObject", "foo", "bar"], step3
);
71 InspectorTest
.addResult("Watch expressions expanded.");
72 dumpObjectPropertiesTreeElement(watchExpressionsSection
.propertiesTreeOutline
, "");
73 InspectorTest
.reloadPage(step4
);
78 InspectorTest
.addResult("Watch expressions after page reload:");
79 dumpObjectPropertiesTreeElement(watchExpressionsSection
.propertiesTreeOutline
, "");
81 // Clear watch expressions after execution.
82 watchExpressionsSection
.watchExpressions
= [];
83 watchExpressionsSection
.update();
84 InspectorTest
.completeDebuggerTest();
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>