Bug 688233 - Don't abort about:memory when a memory reporter throws an exception. r=khuey
authorJustin Lebar <justin.lebar@gmail.com>
Mon, 26 Sep 2011 14:53:55 -0400
changeset 78918 fa1a7fb55799ee10971b362a27356187e85cea23
parent 78917 a2f97b48ed3e7f9f82b83aa845863d3016d264aa
child 78919 03188e4fd2000d87c692e13d900f98a01a694439
push id78
push userclegnitto@mozilla.com
push dateFri, 16 Dec 2011 17:32:24 +0000
treeherdermozilla-release@79d24e644fdd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskhuey
bugs688233
milestone9.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 688233 - Don't abort about:memory when a memory reporter throws an exception. r=khuey
toolkit/components/aboutmemory/content/aboutMemory.js
--- a/toolkit/components/aboutmemory/content/aboutMemory.js
+++ b/toolkit/components/aboutmemory/content/aboutMemory.js
@@ -274,23 +274,34 @@ function getReportersByProcess()
       reporters[r._path] = r;
     }
   }
 
   // Process vanilla reporters first, then multi-reporters.
   var e = mgr.enumerateReporters();
   while (e.hasMoreElements()) {
     var rOrig = e.getNext().QueryInterface(Ci.nsIMemoryReporter);
-    addReporter(rOrig.process, rOrig.path, rOrig.kind, rOrig.units,
-                rOrig.amount, rOrig.description);
+    try {
+      addReporter(rOrig.process, rOrig.path, rOrig.kind, rOrig.units,
+                  rOrig.amount, rOrig.description);
+    }
+    catch(e) {
+      debug("An error occurred when collecting results from the memory reporter " +
+            rOrig.path + ": " + e);
+    }
   }
   var e = mgr.enumerateMultiReporters();
   while (e.hasMoreElements()) {
     var mrOrig = e.getNext().QueryInterface(Ci.nsIMemoryMultiReporter);
-    mrOrig.collectReports(addReporter, null);
+    try {
+      mrOrig.collectReports(addReporter, null);
+    }
+    catch(e) {
+      debug("An error occurred when collecting a multi-reporter's results: " + e);
+    }
   }
 
   return reportersByProcess;
 }
 
 /**
  * Top-level function that does the work of generating the page.
  */
@@ -1068,9 +1079,8 @@ function assert(aCond, aMsg)
 
 function debug(x)
 {
   var content = $("content");
   var div = document.createElement("div");
   div.innerHTML = JSON.stringify(x);
   content.appendChild(div);
 }
-