bug 512479 - make pending crash reports more identifiable, r?mconley draft
authorRobert Helmer <rhelmer@mozilla.com>
Tue, 27 Sep 2016 14:47:19 -0700
changeset 419104 67b4b7d99f676a6f73fcdbd6ebc4ad6985b4f665
parent 418052 f82827622145bcd160f63ec48e9606498beefc39
child 532497 a42ae2d9f22d637cb2f0cb42145b9f59e23600f8
push id30849
push userrhelmer@mozilla.com
push dateThu, 29 Sep 2016 18:15:01 +0000
reviewersmconley
bugs512479
milestone52.0a1
bug 512479 - make pending crash reports more identifiable, r?mconley MozReview-Commit-ID: BQ5Ds0wsXvb
toolkit/crashreporter/content/crashes.js
toolkit/crashreporter/content/crashes.xhtml
toolkit/crashreporter/test/browser/browser_aboutCrashes.js
toolkit/crashreporter/test/browser/browser_aboutCrashesResubmit.js
toolkit/locales/en-US/crashreporter/crashes.dtd
--- a/toolkit/crashreporter/content/crashes.js
+++ b/toolkit/crashreporter/content/crashes.js
@@ -75,17 +75,16 @@ function populateReportList() {
     document.getElementById("clear-reports").style.display = "none";
     document.getElementById("reportList").style.display = "none";
     document.getElementById("noReports").style.display = "block";
     return;
   }
 
   var formatter = Cc["@mozilla.org/intl/scriptabledateformat;1"].
                   createInstance(Ci.nsIScriptableDateFormat);
-  var body = document.getElementById("tbody");
   var ios = Cc["@mozilla.org/network/io-service;1"].
             getService(Ci.nsIIOService);
   var reportURI = ios.newURI(reportURL, null, null);
   // resolving this URI relative to /report/index
   var aboutThrottling = ios.newURI("../../about/throttling", null, reportURI);
 
   for (var i = 0; i < reports.length; i++) {
     var row = document.createElement("tr");
@@ -95,16 +94,17 @@ function populateReportList() {
     if (reports[i].pending) {
       link.setAttribute("href", aboutThrottling.spec);
       link.addEventListener("click", submitPendingReport, true);
     }
     else {
       link.setAttribute("href", reportURL + reports[i].id);
     }
     link.setAttribute("id", reports[i].id);
+    link.classList.add("crashReport");
     link.appendChild(document.createTextNode(reports[i].id));
     cell.appendChild(link);
 
     var date = new Date(reports[i].date);
     cell = document.createElement("td");
     var datestr = formatter.FormatDate("",
                                        Ci.nsIScriptableDateFormat.dateFormatShort,
                                        date.getFullYear(),
@@ -115,17 +115,21 @@ function populateReportList() {
     cell = document.createElement("td");
     var timestr = formatter.FormatTime("",
                                        Ci.nsIScriptableDateFormat.timeFormatNoSeconds,
                                        date.getHours(),
                                        date.getMinutes(),
                                        date.getSeconds());
     cell.appendChild(document.createTextNode(timestr));
     row.appendChild(cell);
-    body.appendChild(row);
+    if (reports[i].pending) {
+      document.getElementById("unsubmitted").appendChild(row);
+    } else {
+      document.getElementById("submitted").appendChild(row);
+    }
   }
 }
 
 var clearReports = Task.async(function*() {
   let bundle = Services.strings.createBundle("chrome://global/locale/crashes.properties");
 
   if (!Services.
          prompt.confirm(window,
--- a/toolkit/crashreporter/content/crashes.xhtml
+++ b/toolkit/crashreporter/content/crashes.xhtml
@@ -80,29 +80,44 @@ td:last-child {
     background-image: url(chrome://global/skin/icons/loading@2x.png);
   }
 }
 </style>
 <link rel="stylesheet" media="screen, projection" type="text/css"
       href="chrome://global/skin/in-content/common.css"/>
 <script type="application/javascript;version=1.8" src="chrome://global/content/crashes.js"/>
 
-<title>&crashes.title;</title>
+<title>&crashReports.title;</title>
 </head><body onload="populateReportList()" dir="&locale.dir;">
 <button chromedir="&locale.dir;" id="clear-reports"
         onclick="clearReports().then(null, Cu.reportError)">&clearAllReports.label;</button>
-<h1>&crashes.title;</h1>
 <div id="reportList">
-  <table>
-    <thead>
-      <tr>
-        <th chromedir="&locale.dir;">&id.heading;</th>
-        <th chromedir="&locale.dir;" colspan="2">&date.heading;</th>
-      </tr>
-    </thead>
-    <tbody id="tbody">
-    </tbody>
-  </table>
+  <div id="reportListUnsubmitted">
+    <h1>&crashesUnsubmitted.label;</h1>
+    <table>
+      <thead>
+        <tr>
+          <th chromedir="&locale.dir;">&id.heading;</th>
+          <th chromedir="&locale.dir;" colspan="2">&dateCrashed.heading;</th>
+        </tr>
+      </thead>
+      <tbody id="unsubmitted">
+      </tbody>
+    </table>
+  </div>
+  <div id="reportListSubmitted">
+    <h1>&crashesSubmitted.label;</h1>
+    <table>
+      <thead>
+        <tr>
+          <th chromedir="&locale.dir;">&id.heading;</th>
+          <th chromedir="&locale.dir;" colspan="2">&dateSubmitted.heading;</th>
+        </tr>
+      </thead>
+      <tbody id="submitted">
+      </tbody>
+    </table>
+  </div>
 </div>
 <p id="noReports" style="display: none">&noReports.label;</p>
 <p id="noConfig" style="display: none">&noConfig.label;</p>
 </body>
 </html>
--- a/toolkit/crashreporter/test/browser/browser_aboutCrashes.js
+++ b/toolkit/crashreporter/test/browser/browser_aboutCrashes.js
@@ -8,17 +8,17 @@ add_task(function* test() {
                          .getService(Components.interfaces.nsIProperties);
   let appDtest = dirSvc.get("UAppData", Components.interfaces.nsILocalFile);
   ok(appD.equals(appDtest), "directory service provider registered ok");
 
   yield BrowserTestUtils.withNewTab({ gBrowser, url: "about:crashes" }, function (browser) {
     info("about:crashes loaded");
     return ContentTask.spawn(browser, crashes, function (crashes) {
       let doc = content.document;
-      let crashlinks = doc.getElementById("tbody").getElementsByTagName("a");
+      let crashlinks = doc.getElementById("submitted").querySelectorAll(".crashReport");
       Assert.equal(crashlinks.length, crashes.length,
         "about:crashes lists correct number of crash reports");
       for (let i = 0; i < crashes.length; i++) {
         Assert.equal(crashlinks[i].firstChild.textContent, crashes[i].id,
           i + ": crash ID is correct");
       }
     });
   });
--- a/toolkit/crashreporter/test/browser/browser_aboutCrashesResubmit.js
+++ b/toolkit/crashreporter/test/browser/browser_aboutCrashesResubmit.js
@@ -11,17 +11,17 @@ function cleanup_and_finish() {
  *
  * Check that the list of crashes displayed by about:crashes matches
  * the list of crashes that we placed in the pending+submitted directories.
  *
  * NB: This function is run in the child process via ContentTask.spawn.
  */
 function check_crash_list(crashes) {
   let doc = content.document;
-  let crashlinks = doc.getElementById("tbody").getElementsByTagName("a");
+  let crashlinks = doc.getElementsByClassName("crashReport");
   Assert.equal(crashlinks.length, crashes.length,
     "about:crashes lists correct number of crash reports");
   // no point in checking this if the lists aren't the same length
   if (crashlinks.length == crashes.length) {
     for (let i=0; i<crashes.length; i++) {
       Assert.equal(crashlinks[i].id, crashes[i].id, i + ": crash ID is correct");
       if (crashes[i].pending) {
         // we set the breakpad.reportURL pref in test()
--- a/toolkit/locales/en-US/crashreporter/crashes.dtd
+++ b/toolkit/locales/en-US/crashreporter/crashes.dtd
@@ -1,11 +1,13 @@
 <!-- This Source Code Form is subject to the terms of the Mozilla Public
    - License, v. 2.0. If a copy of the MPL was not distributed with this
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 
-<!ENTITY crashes.title              "Submitted Crash Reports">
+<!ENTITY crashReports.title         "Crash Reports">
+<!ENTITY crashesUnsubmitted.label   "Unsubmitted Crash Reports">
+<!ENTITY crashesSubmitted.label     "Submitted Crash Reports">
 <!ENTITY id.heading                 "Report ID">
-<!ENTITY date.heading               "Date Submitted">
+<!ENTITY dateCrashed.heading        "Date Crashed">
+<!ENTITY dateSubmitted.heading      "Date Submitted">
 <!ENTITY noReports.label            "No crash reports have been submitted.">
 <!ENTITY noConfig.label             "This application has not been configured to display crash reports. The preference <code>breakpad.reportURL</code> must be set.">
 <!ENTITY clearAllReports.label      "Remove All Reports">
-