Bug 812608 - Part 3: further tweaks to profile age fetch. r=trivial
authorRichard Newman <rnewman@mozilla.com>
Sun, 06 Jan 2013 14:07:34 -0800
changeset 127704 ba2d808f5634d54e25245c5e24cd83aff0990f3c
parent 127703 66786ce0c5fb77dee8e985da64b45e3f25025d8f
child 127705 1bbcfe1c66087835db2a9e4eed9b8e8a5db69b48
push id297
push userlsblakk@mozilla.com
push dateTue, 26 Mar 2013 17:28:00 +0000
treeherdermozilla-release@64d7b45c34e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstrivial
bugs812608
milestone20.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 812608 - Part 3: further tweaks to profile age fetch. r=trivial
services/healthreport/profile.jsm
--- a/services/healthreport/profile.jsm
+++ b/services/healthreport/profile.jsm
@@ -124,37 +124,24 @@ ProfileCreationTimeAccessor.prototype = 
     if (!iterator) {
       throw new Error("Unable to fetch oldest profile entry: no profile iterator.");
     }
 
     function onEntry(entry) {
       function onStatSuccess(info) {
         // OS.File doesn't seem to be behaving. See Bug 827148.
         // Let's do the best we can. This whole function is defensive.
-        let date;
-        if ("winBirthDate" in info) {
-          date = info.winBirthDate;
-        } else if ("macBirthDate" in info) {
-          date = info.macBirthDate;
-        }
-
+        let date = info.winBirthDate || info.macBirthDate;
         if (!date || !date.getTime()) {
-          // Hack: as of this writing, OS.File will only return file
-          // creation times of any kind of Mac and Windows, where birthTime
-          // is defined. That means we're unable to function on Linux.
-          // Use ctime, fall back to mtime.
-          // Oh, and info.macBirthDate doesn't work.
-          self._log.debug("No birth date: using ctime/mtime.");
-          try {
-            date = info.creationDate ||
-                   info.lastModificationDate ||
-                   info.unixLastStatusChangeDate;
-          } catch (ex) {
-            self._log.debug("Exception fetching creation date: " + ex);
-          }
+          // OS.File will only return file creation times of any kind on Mac
+          // and Windows, where birthTime is defined.
+          // That means we're unable to function on Linux, so we use mtime
+          // instead.
+          self._log.debug("No birth date. Using mtime.");
+          date = info.lastModificationDate;
         }
 
         if (date) {
           let timestamp = date.getTime();
           self._log.debug("Using date: " + entry.path + " = " + date);
           if (timestamp < oldest) {
             oldest = timestamp;
           }