about:startup - handle a failure from nsIXULRuntime::GetLaunchTimestamp properly
authorDaniel Brooks <db48x@db48x.net>
Sun, 26 Sep 2010 06:35:58 -0400
changeset 58856 d2099fa3d15419e4a6e6f47aa20bbcea30d14f77
parent 58855 4e82cb73ec344549ab6ce705017ecca250d9c7c5
child 58857 b063d5eef7a1d31c1327217264328bcf57a0b216
push idunknown
push userunknown
push dateunknown
milestone2.0b7pre
about:startup - handle a failure from nsIXULRuntime::GetLaunchTimestamp properly
toolkit/components/startup/src/nsAppStartup.cpp
--- a/toolkit/components/startup/src/nsAppStartup.cpp
+++ b/toolkit/components/startup/src/nsAppStartup.cpp
@@ -531,17 +531,17 @@ nsAppStartup::Observe(nsISupports *aSubj
   }
 
   return NS_OK;
 }
 
 nsresult nsAppStartup::RecordStartupDuration()
 {
   nsresult rv;
-  PRTime launched, started;
+  PRTime launched = 0, started = 0;
   mRestoredTimestamp = PR_Now();
 
   nsCOMPtr<mozIStorageConnection> db;
   rv = OpenStartupDatabase(getter_AddRefs(db));
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCOMPtr<mozIStorageStatement> statement;
   rv = db->CreateStatement(NS_LITERAL_CSTRING("INSERT INTO duration VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7)"),
@@ -549,16 +549,19 @@ nsresult nsAppStartup::RecordStartupDura
   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);
 
+  if (!launched)
+    launched = 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);