about:startup - hide empty message when the duration table isn't empty
authorDaniel Brooks <db48x@db48x.net>
Mon, 13 Sep 2010 04:28:00 -0400
changeset 58836 906ff114be2539484084743d537ab76bb6b0636c
parent 58835 8ebd4ef668962e2d8e5b7ba6307d4502e14eaf1f
child 58837 a8c463d09234b158ce80346824c1c1907fb421d5
push idunknown
push userunknown
push dateunknown
milestone2.0b6pre
about:startup - hide empty message when the duration table isn't empty
toolkit/content/aboutStartup.js
toolkit/content/aboutStartup.xhtml
--- a/toolkit/content/aboutStartup.js
+++ b/toolkit/content/aboutStartup.js
@@ -73,43 +73,48 @@ file.append("startup.sqlite");
 var svc = Components.classes["@mozilla.org/storage/service;1"]
                     .getService(Components.interfaces.mozIStorageService);
 var db = svc.openDatabase(file);
 var query = db.createStatement("SELECT timestamp, launch, startup, appVersion, appBuild, platformVersion, platformBuild FROM duration");
 var lastver, lastbuild;
 query.executeAsync({
   handleResult: function(results)
   {
+    let hasresults = false;
     for (let row = results.getNextRow(); row; row = results.getNextRow())
     {
-      var stamp = row.getResultByName("timestamp");
-      var version = row.getResultByName("appVersion");
-      var build = row.getResultByName("appBuild");
+      hasresults = true;
+      let stamp = row.getResultByName("timestamp");
+      let version = row.getResultByName("appVersion");
+      let build = row.getResultByName("appBuild");
       if (lastver != version)
       {
         options.grid.markings.push(majorMark(stamp, "Firefox "+ version +" ("+ build +")"));
       }
       else
         if (lastbuild != build)
           options.grid.markings.push(minorMark(stamp, "Firefox "+ version +" ("+ build +")"));
 
       lastver = version;
       lastbuild = build;
-      var l, s;
-      series[1].data.push(point(stamp, l = row.getResultByName("launch"), version, build));
-      series[0].data.push(point(stamp, l + (s = row.getResultByName("startup")), version, build));
+      let l = row.getResultByName("launch"),
+          s = row.getResultByName("startup");
+      series[1].data.push(point(stamp, l, version, build));
+      series[0].data.push(point(stamp, l + s, version, build));
       table.appendChild(tr(td(formatstamp(stamp)),
                            td(formatms(msFromµs(l))),
                            td(formatms(msFromµs(s))),
                            td(formatms(msFromµs((l + s)))),
                            td(version),
                            td(build),
                            td(row.getResultByName("platformVersion")),
                            td(row.getResultByName("platformBuild"))));
     }
+    if (hasresults)
+      $("#duration-table > .empty").hide();
   },
   handleError: function(error)
   {
     table.appendChild(tr(td("Error: "+ error.message +" ("+ error.result +")")));
   },
   handleCompletion: function()
   {
     var table = $("table");
@@ -124,26 +129,16 @@ query.executeAsync({
     options.yaxis.max = max;
 
     graph = $.plot($("#graph"), series, options);
 
     var offset = graph.getPlotOffset().left;
     $("#overview").width($("#overview").width() - offset);
     $("#overview").css("margin-left", offset);
     overview = $.plot($("#overview"), series, overviewOpts);
-
-    //var axes = graph.getAxes();
-    //overview.setSelection({ xaxis: { min: axes.xaxis.min,
-    //                                 max: axes.xaxis.max
-    //                               },
-    //                        yaxis: { min: axes.yaxis.min,
-    //                                 max: axes.yaxis.max
-    //                               }
-    //                      },
-    //                      true);
   },
 });
 
 $("#graph").bind("plotselected", function (event, ranges)
 {
   // do the zooming
   graph = $.plot($("#graph"),
                  series,
--- a/toolkit/content/aboutStartup.xhtml
+++ b/toolkit/content/aboutStartup.xhtml
@@ -28,25 +28,25 @@
       <tr><td>&about.startup.app.started;</td><td id="started">—</td><td>—</td></tr>
       <tr><td>&about.startup.app.ready;</td><td id="restored">—</td><td>—</td></tr>
     </table>
 
     <div id="graph"/>
     <div id="overview"/>
 
     <h1>&about.startup.table;</h1>
-    <table>
+    <table id="duration-table">
       <tr>
         <th>&about.startup.timestamp;</th>
         <th>&about.startup.duration.launch;</th>
         <th>&about.startup.duration.startup;</th>
         <th>&about.startup.duration.ready;</th>
         <th colspan="4">&about.startup.version;</th>
       </tr>
-      <tr><td colspan="8"><i>&about.startup.noevents;</i></td></tr>
+      <tr class="empty"><td colspan="8"><i>&about.startup.noevents;</i></td></tr>
     </table>
-    <table>
+    <table id="event-table">
       <tr><th>&about.startup.timestamp;</th><th>&about.startup.eventdesc;</th></tr>
-      <tr><td colspan="2"><i>&about.startup.noevents;</i></td></tr>
+      <tr class="empty"><td colspan="2"><i>&about.startup.noevents;</i></td></tr>
     </table>
     <script type="application/javascript;version=1.8" src="chrome://global/content/aboutStartup.js"/>
   </body>
 </html>