1 function Sys$_Debug$_traceDump(object, name, recursive, indentationPadding, loopArray) {
2 name = name? name : 'traceDump';
3 indentationPadding = indentationPadding? indentationPadding : '';
4 if (object === null) {
5 this.trace(indentationPadding + name + ': null');
6 return;
7 }
8 switch(typeof(object)) {
9 case 'undefined':
10 this.trace(indentationPadding + name + ': Undefined');
11 break;
12 case 'number': case 'string': case 'boolean':
13 this.trace(indentationPadding + name + ': ' + object);
14 break;
15 default:
16 if (Date.isInstanceOfType(object) || RegExp.isInstanceOfType(object)) {
17 this.trace(indentationPadding + name + ': ' + object.toString());
18 break;
19 }
20 if (!loopArray) {
21 loopArray = [];
22 }
23 else if (Array.contains(loopArray, object)) {
24 this.trace(indentationPadding + name + ': ...');
25 return;
26 }
27 Array.add(loopArray, object);
28 if ((object == window) || (object === document) ||
29 (window.HTMLElement && (object instanceof HTMLElement)) ||
30 (typeof(object.nodeName) === 'string')) {
31 var tag = object.tagName? object.tagName : 'DomElement';
32 if (object.id) {
33 tag += ' - ' + object.id;
34 }
35 this.trace(indentationPadding + name + ' {' + tag + '}');
36 }
37 else {
38 var typeName = Object.getTypeName(object);
39 this.trace(indentationPadding + name + (typeof(typeName) === 'string' ? ' {' + typeName + '}' : ''));
40 if ((indentationPadding === '') || recursive) {
41 indentationPadding += " ";
42 var i, length, properties, p, v;
43 if (Array.isInstanceOfType(object)) {
44 length = object.length;
45 for (i = 0; i < length; i++) {
46 this._traceDump(object[i], '[' + i + ']', recursive, indentationPadding, loopArray);
47 }
48 }
49 else {
50 for (p in object) {
51 v = object[p];
52 if (!Function.isInstanceOfType(v)) {
53 this._traceDump(v, p, recursive, indentationPadding, loopArray);
54 }
55 }
56 }
57 }
58 }
59 Array.remove(loopArray, object);
60 }
61 }