Closed Bug 723402 Opened 13 years ago Closed 13 years ago

Auto-expand sub-trees containing invalid values in about:memory

Categories

(Toolkit :: about:memory, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla13

People

(Reporter: n.nethercote, Assigned: n.nethercote)

References

Details

(Whiteboard: [MemShrink:P2])

Attachments

(1 file)

Bug 698930 added highlighting of bogus values in about:memory.  This has already shown its use (bug 723324, bug 723088).

One minor shortcoming is that bogus values are sometimes hidden by default in about:memory, esp. when they're negative, and you have to do some clicking to expose them.  It would be nice if sub-trees containing bogus values were auto-expanded.
Attached patch patchSplinter Review
The patch is a little fiddly, but straightforward.
Attachment #594877 - Flags: review?(justin.lebar+bug)
Comment on attachment 594877 [details] [diff] [review]
patch

Hm, so if there's an error in a memory reporter and then we update(), if the error goes away, the node will be hidden again.  I guess that's OK.
Comment on attachment 594877 [details] [diff] [review]
patch

>+function assertClassName(e, className) {
>+  assert(e, "undefined " + className);
>+  assert(e.classList.contains(className), "classname isn't " + className);
>+}

Maybe assertHasClass() or assertElementHasClass() would be a better name.  I'd
fix up the second assertion's error message, too (s/isn't/doesn't contain/, or
something).

>+function expandPathToThisElement(aElement)
>+{
>+  if (aElement.classList.contains("kids")) {
>+    // Unhide the kids.
>+    aElement.classList.remove("hidden");
>+    expandPathToThisElement(aElement.previousSibling);  // hasKids
>+
>+  } else if (aElement.classList.contains("hasKids")) {
>+    // Unhide the '--' separator and hide the '++' separator.
>+    var  plusSpan = aElement.childNodes[2];
>+    var minusSpan = aElement.childNodes[3];
>+    assertClassName(plusSpan,  "mrSep");
>+    assertClassName(minusSpan, "mrSep");
>+    plusSpan.classList.add("hidden");
>+    minusSpan.classList.remove("hidden");
>+    expandPathToThisElement(aElement.parentNode);       // kids or pre.tree
>+
>+  } else {
>+    assertClassName(aElement, "tree");
>+  }
>+}

I guess it's OK that unhidden nodes don't count as toggle()'d.  It's bit weird,
though, since if you refreshed and the memory reporter became valid, you'd want
the path to it to remain expanded, so you could see the new value.  Up to you
if you want to change it.
Attachment #594877 - Flags: review?(justin.lebar+bug) → review+
Whiteboard: [MemShrink] → [MemShrink:P2]
> I guess it's OK that unhidden nodes don't count as toggle()'d.  It's bit
> weird,
> though, since if you refreshed and the memory reporter became valid, you'd
> want
> the path to it to remain expanded, so you could see the new value.  Up to you
> if you want to change it.

Good point.  It's a little painful to do here.  It should be easier once bug 724863 is fixed, I'll add a reminder to myself to do it there.
https://hg.mozilla.org/mozilla-central/rev/9c4e640fb4d8
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla13
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: