mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-04-02 12:32:55 +00:00
Fix JS object display in Inspector. Bug 160254, r=timeless, sr=hewitt.
This commit is contained in:
parent
b1feb4fe5f
commit
a2d7014f95
@ -193,11 +193,12 @@ JSObjectViewer.prototype =
|
|||||||
|
|
||||||
buildPropertyTree: function(aTreeChildren, aObject)
|
buildPropertyTree: function(aTreeChildren, aObject)
|
||||||
{
|
{
|
||||||
try {
|
for (var prop in aObject) {
|
||||||
for (var prop in aObject)
|
try {
|
||||||
this.addTreeItem(aTreeChildren, prop, aObject[prop], aObject);
|
this.addTreeItem(aTreeChildren, prop, aObject[prop], aObject);
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
// hide unsightly NOT YET IMPLEMENTED errors when accessing certain properties
|
// hide unsightly NOT YET IMPLEMENTED errors when accessing certain properties
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -207,12 +208,21 @@ JSObjectViewer.prototype =
|
|||||||
ti.__JSObject__ = aObject;
|
ti.__JSObject__ = aObject;
|
||||||
ti.__JSValue__ = aValue;
|
ti.__JSValue__ = aValue;
|
||||||
|
|
||||||
var value = aValue.toString();
|
var value;
|
||||||
value = value.replace(/\n|\r|\t/, " ");
|
if (aValue === null) {
|
||||||
|
value = "(null)"
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
value = aValue.toString();
|
||||||
|
value = value.replace(/\n|\r|\t|\v/g, " ");
|
||||||
|
} catch (ex) {
|
||||||
|
value = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ti.setAttribute("typeOf", typeof(aValue));
|
ti.setAttribute("typeOf", typeof(aValue));
|
||||||
|
|
||||||
if (typeof(aValue) == "object") {
|
if (typeof(aValue) == "object" && aValue !== null) {
|
||||||
ti.setAttribute("container", "true");
|
ti.setAttribute("container", "true");
|
||||||
} else if (typeof(aValue) == "string")
|
} else if (typeof(aValue) == "string")
|
||||||
value = "\"" + value + "\"";
|
value = "\"" + value + "\"";
|
||||||
@ -225,6 +235,9 @@ JSObjectViewer.prototype =
|
|||||||
tr.appendChild(tc);
|
tr.appendChild(tc);
|
||||||
tc = document.createElement("treecell");
|
tc = document.createElement("treecell");
|
||||||
tc.setAttribute("label", value);
|
tc.setAttribute("label", value);
|
||||||
|
if (aValue === null) {
|
||||||
|
tc.setAttribute("class", "inspector-null-value-treecell");
|
||||||
|
}
|
||||||
if (aName == "nodeType")
|
if (aName == "nodeType")
|
||||||
tc.setAttribute("tooltiptext", nodeTypeToText(aValue));
|
tc.setAttribute("tooltiptext", nodeTypeToText(aValue));
|
||||||
tr.appendChild(tc);
|
tr.appendChild(tc);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user