Bug 1161477 - getLogFromFile sometimes returns the wrong log for grouped logs. r=aleth
authorNihanth Subramanya <nhnt11@gmail.com>
Tue, 05 May 2015 20:41:33 +0530
changeset 22573 35b3b990996d70dcecc118aa1d76ca1c4ec57793
parent 22572 afaa7fc3aab357d9878794285fd7932332dbd1e3
child 22574 c6b02f52cc888791639635f0f5357ddece25534b
push id1420
push usermbanner@mozilla.com
push dateMon, 29 Jun 2015 20:47:24 +0000
treeherdercomm-beta@b3db00bb24e8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaleth
bugs1161477
Bug 1161477 - getLogFromFile sometimes returns the wrong log for grouped logs. r=aleth
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);