1 <p>This test dumps all of the properties that are reachable from the window
2 object, along with their types.</p>
7 if (window.layoutTestController)
8 layoutTestController.dumpAsText();
16 var pre = document.getElementById('pre');
19 var logMessage = logBuffer.join("");
20 pre.appendChild(document.createTextNode(logMessage));
23 function tryEval(string)
28 return new String("Caught exception: " + e);
32 function typeOfNullAware(value)
34 if (typeof value == "object" && value == null) //;
39 function typeStringNullAware(value)
41 var valueType = typeOfNullAware(value);
42 return valueType == "object"
43 ? Object.prototype.toString.call(value)
44 : "[" + valueType + "]";
47 function logValue(valueName)
49 var value = tryEval(valueName);
50 var valueType = typeOfNullAware(value);
52 // Don't taint the test with our own variables
53 if (value == logBuffer || value == pre)
56 // Don't taint the test with our own properties
57 if (/__visitedByLogValue__/.test(valueName) || /__nameWhenVisitedByLogValue__/.test(valueName))
60 // Work around DumpRenderTree bug where previous tests add window properties
61 if ("window.opener" == valueName)
64 // Work around http://bugs.webkit.org/show_bug.cgi?id=11373
65 if ("window.layoutTestController" == valueName)
68 // Work around Firefox infinite recursion
69 if (/\.[0-9]/.test(valueName))
72 // Work around Firefox exception
73 if ("window.Components" == valueName)
76 // Avoid infinite recursion
77 if (valueType == "object" && value.__visitedByLogValue__) { //;
78 log(valueName + " [printed above as " + value.__nameWhenVisitedByLogValue__ + "]\n");
82 log(valueName + " " + typeStringNullAware(value) + "\n");
84 if (valueType == "object") {
85 value.__visitedByLogValue__ = true;
86 value.__nameWhenVisitedByLogValue__ = valueName;
87 logProperties(value, valueName);
91 function logProperties(object, objectName)
93 var array = new Array;
94 for (var property in object) {
98 for (var i = 0; i < array.length; i++) {
99 var property = array[i];
100 logValue(objectName + "." + property);
105 logValue('window.getSelection()');