Bug 1161477 - getLogFromFile sometimes returns the wrong log for grouped logs. r=aleth, a=rkent
authorNihanth Subramanya <nhnt11@gmail.com>
Tue, 05 May 2015 20:41:33 +0530
changeset 22073 1f1b195494998f32c389a9bdeaa5811787f4d656
parent 22072 84606fed62928af1d0721455bc8bc00c82d136e3
child 22074 257c59adc0ec53930f0f701d67642d6f05f6995a
push id1378
push userkent@caspia.com
push dateThu, 07 May 2015 19:52:23 +0000
treeherdercomm-beta@257c59adc0ec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaleth, rkent
bugs1161477
Bug 1161477 - getLogFromFile sometimes returns the wrong log for grouped logs. r=aleth, a=rkent
chat/components/src/logger.js
--- a/chat/components/src/logger.js
+++ b/chat/components/src/logger.js
@@ -650,30 +650,29 @@ Logger.prototype = {
   }),
   getLogFromFile: function logger_getLogFromFile(aFilePath, aGroupByDay) {
     if (!aGroupByDay)
       return Promise.resolve(new Log(aFilePath));
     let [targetDate] = getDateFromFilename(OS.Path.basename(aFilePath));
     if (!targetDate)
       return null;
 
-    let targetDay = Math.floor(targetDate / (86400 * 1000));
+    targetDate = targetDate.toDateString();
 
     // We'll assume that the files relevant to our interests are
     // in the same folder as the one provided.
     let iterator = new OS.File.DirectoryIterator(OS.Path.dirname(aFilePath));
     let relevantEntries = [];
     return iterator.forEach(function(aEntry) {
       if (aEntry.isDir)
         return;
       let path = aEntry.path;
       let [logTime] = getDateFromFilename(OS.Path.basename(path));
 
-      let day = Math.floor(logTime / (86400 * 1000));
-      if (targetDay == day) {
+      if (targetDate == logTime.toDateString()) {
         relevantEntries.push({
           path: path,
           time: logTime
         });
       }
     }).then(() => {
       iterator.close();
       return new Log(relevantEntries);