Bug 633747 - about:cache displays "Expires: 1970-01-01 01:00:00" r?mayhemer draft
authorAmar Lakshya <amar.lakshya@xaviers.edu.in>
Sat, 29 Apr 2017 01:24:29 +0530
changeset 570389 2e97c62fad342eea68fbfa8d694bfd57d6f311b6
parent 570046 84762dbeb5380461fe27f0afa0e27e8ba9dd3b01
child 571407 7a38effcfd8ffb1fe18344d3bbd02b95f2cd8bc0
push id56471
push userbmo:amar.lakshya@xaviers.edu.in
push dateFri, 28 Apr 2017 19:56:28 +0000
reviewersmayhemer
bugs633747
milestone55.0a1
Bug 633747 - about:cache displays "Expires: 1970-01-01 01:00:00" r?mayhemer MozReview-Commit-ID: BAn8EFYGeux
netwerk/protocol/about/nsAboutCache.cpp
netwerk/protocol/about/nsAboutCacheEntry.cpp
--- a/netwerk/protocol/about/nsAboutCache.cpp
+++ b/netwerk/protocol/about/nsAboutCache.cpp
@@ -486,17 +486,28 @@ nsAboutCache::Channel::OnCacheEntryInfo(
         mBuffer.Append(buf);
     } else {
         mBuffer.AppendLiteral("No last modified time");
     }
     mBuffer.AppendLiteral("</td>\n");
 
     // Expires time
     mBuffer.AppendLiteral("    <td>");
-    if (aExpirationTime < 0xFFFFFFFF) {
+
+    // Bug - 633747.
+    // It says in the bug that the odd expiration time is: 1970-01-01 01:00:00
+    // However, that time is in local time(Africa in the bug).
+    // variable 'mExpirationTime' gets the conversion:
+    // 1970-01-01 01:00:00 --> 1970-01-01 00:00:00 GMT which is 0 in hex
+    // So, 0 represents the UNIX timestamp 1970-01-01 00:00:00 GMT.
+    // We just find out if the expiration time is equal
+    // to 0 and if so, we simply show "expired immediately"
+    if (aExpirationTime == 0) {
+        mBuffer.AppendLiteral("Expired Immediately");
+    } else if (aExpirationTime < 0xFFFFFFFF) {
         PrintTimeString(buf, sizeof(buf), aExpirationTime);
         mBuffer.Append(buf);
     } else {
         mBuffer.AppendLiteral("No expiration time");
     }
     mBuffer.AppendLiteral("</td>\n");
 
     // Pinning
--- a/netwerk/protocol/about/nsAboutCacheEntry.cpp
+++ b/netwerk/protocol/about/nsAboutCacheEntry.cpp
@@ -422,17 +422,28 @@ nsAboutCacheEntry::Channel::WriteCacheEn
         PrintTimeString(timeBuf, sizeof(timeBuf), u);
         APPEND_ROW("last modified", timeBuf);
     } else {
         APPEND_ROW("last modified", "No last modified time (bug 1000338)");
     }
 
     // Expiration Time
     entry->GetExpirationTime(&u);
-    if (u < 0xFFFFFFFF) {
+
+    // Bug - 633747.
+    // It says in the bug that the odd expiration time is: 1970-01-01 01:00:00
+    // However, that time is in local time(Africa in the bug).
+    // variable 'u' gets the conversion:
+    // 1970-01-01 01:00:00 --> 1970-01-01 00:00:00 GMT which is 0 in hex
+    // So, 0 represents the UNIX timestamp 1970-01-01 00:00:00 GMT.
+    // We just find out if the expiration time is equal
+    // to 0 and if so, we simply show "expired immediately"
+    if (u == 0) {
+        APPEND_ROW("expires", "Expired Immediately");
+    } else if (u < 0xFFFFFFFF) {
         PrintTimeString(timeBuf, sizeof(timeBuf), u);
         APPEND_ROW("expires", timeBuf);
     } else {
         APPEND_ROW("expires", "No expiration time");
     }
 
     // Data Size
     s.Truncate();