4 <script type="text/javascript">
6 if (window.layoutTestController)
7 layoutTestController.dumpAsText();
9 var logDiv = document.getElementById("log");
12 function log(string) {
13 var newDiv = document.createElement('DIV');
14 newDiv.appendChild(document.createTextNode(string));
15 logDiv.appendChild(newDiv);
19 function shouldSkipProperty(fullPropertyName, propertyValue) {
20 if (fullPropertyName.match(/_childrenPrintedUnderName$/))
24 function shouldSkipChildren(fullPropertyName, propertyValue) {
25 if (propertyValue == logDiv
26 || fullPropertyName == 'window.document.body.lastChild')
30 function havePrintedChildren(fullPropertyName, propertyValue) {
32 var childrenPrintedUnderName = propertyValue._childrenPrintedUnderName;
33 if (!childrenPrintedUnderName)
34 propertyValue._childrenPrintedUnderName = fullPropertyName;
35 return childrenPrintedUnderName;
37 log(fullPropertyName + " : ERROR determining if we have already printed children, assuming true");
42 function printProperties(object, parentString) {
43 for (propertyName in object) {
44 var fullPropertyName = parentString + '.' + propertyName;
47 propertyValue = object[propertyName]; // Firefox throws here for certain unimplemented DOM3 properties
49 log(fullPropertyName + " : ERROR accessing property, exception thrown: " + e);
52 if (shouldSkipProperty(fullPropertyName, propertyValue))
54 var type = (propertyValue === null ? 'null' : typeof(propertyValue));
55 log(fullPropertyName + " : " + type);
56 var previousPropertyName = '';
57 if (propertyValue && type == 'object') {
58 if (shouldSkipChildren(fullPropertyName, propertyValue))
59 log(fullPropertyName + ' *** children skipped (explicitly)');
60 else if (previousPropertyName = havePrintedChildren(fullPropertyName, propertyValue))
61 log(fullPropertyName + " *** children skipped, already printed above under '" + previousPropertyName + "'");
63 printProperties(propertyValue, fullPropertyName);
68 log('window : ' + typeof(window));
69 havePrintedChildren(window, 'window');
70 printProperties(window, 'window');