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 26005 5a29ac144d71170185c86be9ef3ceddd3f54799f
parent 26004 b1b14a3738a04d2697830aeaf39105e979b76428
child 26006 9cb911a699c93c1bce05d89c717e46ea4f28bfb7
push id1850
push userclokep@gmail.com
push dateWed, 08 Mar 2017 19:29:12 +0000
treeherdercomm-esr52@028df196b2d9 [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);