about:startup - record app and platform version numbers on every startup, so that we can show changes in those versions on the graph. also, move back to an xhtml file for l10n
authorDaniel Brooks <db48x@db48x.net>
Thu, 09 Sep 2010 07:57:53 -0400
changeset 58826 80da5e79c398bef20e93d1677ff6e6eac9c93d03
parent 58825 4b7fd492029fdc689fa099b1efec6e1c719401d6
child 58827 fbe8fbf75b6f78a7db45a437471b5a478852e00b
push id1
push usershaver@mozilla.com
push dateTue, 04 Jan 2011 17:58:04 +0000
milestone2.0b6pre
about:startup - record app and platform version numbers on every startup, so that we can show changes in those versions on the graph. also, move back to an xhtml file for l10n
browser/base/content/aboutStartup.html
browser/base/content/aboutStartup.js
browser/base/content/aboutStartup.xhtml
browser/base/jar.mn
browser/locales/en-US/chrome/browser/aboutStartup.dtd
browser/locales/jar.mn
toolkit/components/startup/src/nsAppStartup.cpp
--- a/browser/base/content/aboutStartup.js
+++ b/browser/base/content/aboutStartup.js
@@ -42,31 +42,35 @@ var table = document.getElementsByTagNam
 var file = Components.classes["@mozilla.org/file/directory_service;1"]
                      .getService(Components.interfaces.nsIProperties)
                      .get("ProfD", Components.interfaces.nsIFile);
 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 FROM duration");
+var query = db.createStatement("SELECT timestamp, launch, startup, appVersion, appBuild, platformVersion, platformBuild FROM duration");
 query.executeAsync({
   handleResult: function(results)
   {
     for (let row = results.getNextRow(); row; row = results.getNextRow())
     {
-        table.appendChild(tr(td(formatstamp(row.getResultByName("timestamp"))),
-                             td(formatµs(l = row.getResultByName("launch"))),
-                             td(formatµs(s = row.getResultByName("startup"))),
-                             td(formatµs(l + s))));
+      table.appendChild(tr(td(formatstamp(row.getResultByName("timestamp"))),
+                           td(formatµs(l = row.getResultByName("launch"))),
+                           td(formatµs(s = row.getResultByName("startup"))),
+                           td(formatµs(l + s)),
+                           td(row.getResultByName("appVersion")),
+                           td(row.getResultByName("appBuild")),
+                           td(row.getResultByName("platformVersion")),
+                           td(row.getResultByName("platformBuild"))));
     }
   },
   handleError: function(error)
   {
-      table.appendChild(tr(td("Error: "+ error.message +" ("+ error.result +")")));
+    table.appendChild(tr(td("Error: "+ error.message +" ("+ error.result +")")));
   },
   handleCompletion: function() { },
 });
 
 function td(str)
 {
   let cell = document.createElement("td");
   cell.innerHTML = str;
rename from browser/base/content/aboutStartup.html
rename to browser/base/content/aboutStartup.xhtml
--- a/browser/base/content/aboutStartup.html
+++ b/browser/base/content/aboutStartup.xhtml
@@ -1,26 +1,37 @@
-<!DOCTYPE html>
-<html>
-<head>
-  <title>App Startup Timing</title>
-  <link rel="stylesheet" href="chrome://global/skin/aboutSupport.css" type="text/css">
-</head>
-<body>
-  <h1>App Startup Timing</h1>
-  <table>
-    <tr><th>Event</th><th>Timestamp</th><th>Elapsed Time</th></tr>
-    <tr><td>Application Launched</td><td id="launched">—</td><td>—</td></tr>
-    <tr><td>Application Started</td><td id="started">—</td><td>—</td></tr>
-    <tr><td>Session Restored</td><td id="restored">—</td><td>—</td></tr>
-  </table>
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html [
+  <!ENTITY % htmlDTD PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
+  %htmlDTD;
+  <!ENTITY % globalDTD SYSTEM "chrome://global/locale/global.dtd">
+  %globalDTD;
+  <!ENTITY % aboutStartupDTD SYSTEM "chrome://browser/locale/aboutStartup.dtd">
+  %aboutStartupDTD;
+]>
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <title>&title;</title>
+    <link rel="stylesheet" href="chrome://global/skin/aboutSupport.css" type="text/css"/>
+  </head>
 
-  <h1>Chart</h1>
-  <table>
-    <tr><th>Timestamp</th><th>Launch Duration</th><th>Startup Duration</th><th>Total Duration</th></tr>
-  </table>
-  <table>
-    <tr><th>Timestamp</th><th>Event Description</th></tr>
-    <tr><td colspan="2"><i>No Events Recorded</i></td></tr>
-  </table>
-  <script type="application/javascript;version=1.8" src="chrome://browser/content/aboutStartup.js"></script>
-</body>
+  <body>
+    <h1>&title;</h1>
+    <table>
+      <tr><th></th><th>&timestamp;</th><th>&elapsed;</th></tr>
+      <tr><td>&applaunched;</td><td id="launched">—</td><td>—</td></tr>
+      <tr><td>&appstarted;</td><td id="started">—</td><td>—</td></tr>
+      <tr><td>&sessrestored;</td><td id="restored">—</td><td>—</td></tr>
+    </table>
+
+    <h1>&chart;</h1>
+    <table>
+      <tr><th>&timestamp;</th><th>&launchdur;</th><th>&startupdur;</th><th>&elapsed;</th><th colspan="4">&version;</th></tr>
+      <tr><td colspan="8"><i>&noevents;</i></td></tr>
+    </table>
+    <table>
+      <tr><th>&timestamp;</th><th>&eventdesc;</th></tr>
+      <tr><td colspan="2"><i>&noevents;</i></td></tr>
+    </table>
+    <script type="application/javascript;version=1.8" src="chrome://browser/content/aboutStartup.js"/>
+  </body>
 </html>
--- a/browser/base/jar.mn
+++ b/browser/base/jar.mn
@@ -19,17 +19,17 @@ browser.jar:
 *       content/browser/aboutRobots.xhtml             (content/aboutRobots.xhtml)
 *       content/browser/aboutHome.xhtml               (content/aboutHome.xhtml)
 *       content/browser/aboutHome.js                  (content/aboutHome.js)
 *       content/browser/aboutHome.css                 (content/aboutHome.css)
         content/browser/aboutRobots-icon.png          (content/aboutRobots-icon.png)
         content/browser/aboutRobots-icon-rtl.png      (content/aboutRobots-icon-rtl.png)
         content/browser/aboutRobots-widget-left.png   (content/aboutRobots-widget-left.png)
         content/browser/aboutRobots-widget-right.png  (content/aboutRobots-widget-right.png)
-        content/browser/aboutStartup.html             (content/aboutStartup.html)
+        content/browser/aboutStartup.xhtml            (content/aboutStartup.xhtml)
         content/browser/aboutStartup.js               (content/aboutStartup.js)
 *       content/browser/browser.css                   (content/browser.css)
 *       content/browser/browser.js                    (content/browser.js)
 *       content/browser/browser.xul                   (content/browser.xul)
 *       content/browser/browser-tabPreviews.xml       (content/browser-tabPreviews.xml)
 *       content/browser/credits.xhtml                 (content/credits.xhtml)
 *       content/browser/fullscreen-video.xhtml        (content/fullscreen-video.xhtml)
 *       content/browser/inspector.html                (content/inspector.html)
new file mode 100644
--- /dev/null
+++ b/browser/locales/en-US/chrome/browser/aboutStartup.dtd
@@ -0,0 +1,13 @@
+<!ENTITY title "Application Startup Timing">
+<!ENTITY timestamp "Timestamp">
+<!ENTITY elapsed "Elapsed Time">
+<!ENTITY applaunched "Application Launched">
+<!ENTITY launchdur "Launch Duration">
+<!ENTITY appstarted "Application Started">
+<!ENTITY startupdur "Startup Duration">
+<!ENTITY sessrestored "Session Restored">
+<!ENTITY version "Version">
+<!ENTITY chart "Chart">
+<!ENTITY graph "Graph">
+<!ENTITY eventdesc "Event Description">
+<!ENTITY noevents "No Events Recorded">
--- a/browser/locales/jar.mn
+++ b/browser/locales/jar.mn
@@ -2,16 +2,17 @@
 
 @AB_CD@.jar:
 % locale browser @AB_CD@ %locale/browser/
     locale/browser/aboutCertError.dtd              (%chrome/browser/aboutCertError.dtd)
     locale/browser/aboutDialog.dtd                 (%chrome/browser/aboutDialog.dtd)
     locale/browser/aboutPrivateBrowsing.dtd        (%chrome/browser/aboutPrivateBrowsing.dtd)
     locale/browser/aboutRobots.dtd                 (%chrome/browser/aboutRobots.dtd)
     locale/browser/aboutHome.dtd                   (%chrome/browser/aboutHome.dtd)
+    locale/browser/aboutStartup.dtd                (%chrome/browser/aboutStartup.dtd)
     locale/browser/aboutSessionRestore.dtd         (%chrome/browser/aboutSessionRestore.dtd)
 #ifdef MOZ_SERVICES_SYNC
     locale/browser/aboutSyncTabs.dtd               (%chrome/browser/aboutSyncTabs.dtd)
 #endif
     locale/browser/credits.dtd                     (%chrome/browser/credits.dtd)
 *   locale/browser/browser.dtd                     (%chrome/browser/browser.dtd)
     locale/browser/baseMenuOverlay.dtd             (%chrome/browser/baseMenuOverlay.dtd)
     locale/browser/browser.properties              (%chrome/browser/browser.properties)
--- a/toolkit/components/startup/src/nsAppStartup.cpp
+++ b/toolkit/components/startup/src/nsAppStartup.cpp
@@ -68,16 +68,17 @@
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsWidgetsCID.h"
 #include "nsAppShellCID.h"
 #include "mozilla/Services.h"
 #include "mozilla/storage.h"
 #include "mozilla/FunctionTimer.h"
 #include "nsAppDirectoryServiceDefs.h"
 #include "nsIXULRuntime.h"
+#include "nsIXULAppInfo.h"
 #include "nsXPCOMCIDInternal.h"
 
 static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID);
 
 class nsAppExitEvent : public nsRunnable {
 private:
   nsRefPtr<nsAppStartup> mService;
 
@@ -525,45 +526,63 @@ nsAppStartup::Observe(nsISupports *aSubj
   }
 
   return NS_OK;
 }
 
 nsresult RecordStartupDuration()
 {
   nsresult rv;
-  nsCOMPtr<nsIXULRuntime> runtime = do_GetService(XULRUNTIME_SERVICE_CONTRACTID);
-
   PRTime launched, started, finished;
-  runtime->GetLaunchTimestamp((PRUint64*)&launched);
-  runtime->GetStartupTimestamp((PRUint64*)&started);
+  finished = PR_Now();
 
   nsCOMPtr<mozIStorageConnection> db;
   rv = OpenStartupDatabase(getter_AddRefs(db));
   NS_ENSURE_SUCCESS(rv, rv);
 
-  rv = EnsureTable(db, NS_LITERAL_CSTRING("duration"),
-                   NS_LITERAL_CSTRING("timestamp INTEGER, launch INTEGER, startup INTEGER"));
+  rv = EnsureTable(db,
+                   NS_LITERAL_CSTRING("duration"),
+                   NS_LITERAL_CSTRING("timestamp INTEGER, launch INTEGER, startup INTEGER, appVersion TEXT, appBuild TEXT, platformVersion TEXT, platformBuild TEXT"));
   NS_ENSURE_SUCCESS(rv, rv);
-  rv = EnsureTable(db, NS_LITERAL_CSTRING("events"),
-                   NS_LITERAL_CSTRING("timestamp INTEGER, description TEXT"));
+  rv = EnsureTable(db,
+                   NS_LITERAL_CSTRING("events"),
+                   NS_LITERAL_CSTRING("timestamp INTEGER, extensionID TEXT, extensionVersion TEXT"));
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCOMPtr<mozIStorageStatement> statement;
-  rv = db->CreateStatement(NS_LITERAL_CSTRING("INSERT INTO duration VALUES (?1, ?2, ?3)"),
+  rv = db->CreateStatement(NS_LITERAL_CSTRING("INSERT INTO duration VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7)"),
                            getter_AddRefs(statement));
   NS_ENSURE_SUCCESS(rv, rv);
 
+  nsCOMPtr<nsIXULRuntime> runtime = do_GetService(XULRUNTIME_SERVICE_CONTRACTID);
+  nsCOMPtr<nsIXULAppInfo> appinfo = do_QueryInterface(runtime);
+
+  runtime->GetLaunchTimestamp((PRUint64*)&launched);
+  runtime->GetStartupTimestamp((PRUint64*)&started);
+
+  nsCAutoString appVersion, appBuild, platformVersion, platformBuild;
+  appinfo->GetVersion(appVersion);
+  appinfo->GetAppBuildID(appBuild);
+  appinfo->GetPlatformVersion(platformVersion);
+  appinfo->GetPlatformBuildID(platformBuild);
+
   rv = statement->BindInt64Parameter(0, launched);
   NS_ENSURE_SUCCESS(rv, rv);
   rv = statement->BindInt64Parameter(1, started - launched);
   NS_ENSURE_SUCCESS(rv, rv);
-  finished = PR_Now();
   rv = statement->BindInt64Parameter(2, finished - started);
   NS_ENSURE_SUCCESS(rv, rv);
+  rv = statement->BindStringParameter(3, NS_ConvertUTF8toUTF16(appVersion));
+  NS_ENSURE_SUCCESS(rv, rv); 
+  rv = statement->BindStringParameter(4, NS_ConvertUTF8toUTF16(appBuild));
+  NS_ENSURE_SUCCESS(rv, rv); 
+  rv = statement->BindStringParameter(5, NS_ConvertUTF8toUTF16(platformVersion));
+  NS_ENSURE_SUCCESS(rv, rv);
+  rv = statement->BindStringParameter(6, NS_ConvertUTF8toUTF16(platformBuild));
+  NS_ENSURE_SUCCESS(rv, rv);
 
   statement->Execute();
   return NS_OK;
 }
 
 nsresult OpenStartupDatabase(mozIStorageConnection **db)
 {
   nsresult rv;