Bug 1151815 - Remove expiration time from the cache index, r=mayhemer
authorMichal Novotny <michal.novotny@gmail.com>
Mon, 11 Mar 2019 14:29:34 +0000
changeset 521700 7c663cf76b8d561d3334b11314ca41255b7a1b66
parent 521699 17c3b29f3b070a129be84a7f2daeb3fc71d871d1
child 521701 fcdfe2be33a5fa5a531d18f3f4302aa48df5f3e0
push id10867
push userdvarga@mozilla.com
push dateThu, 14 Mar 2019 15:20:45 +0000
treeherdermozilla-beta@abad13547875 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmayhemer
bugs1151815
milestone67.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 1151815 - Remove expiration time from the cache index, r=mayhemer Differential Revision: https://phabricator.services.mozilla.com/D22499
netwerk/cache2/CacheFile.cpp
netwerk/cache2/CacheFileIOManager.cpp
netwerk/cache2/CacheFileIOManager.h
netwerk/cache2/CacheIndex.cpp
netwerk/cache2/CacheIndex.h
--- a/netwerk/cache2/CacheFile.cpp
+++ b/netwerk/cache2/CacheFile.cpp
@@ -1144,20 +1144,16 @@ nsresult CacheFile::SetExpirationTime(ui
   LOG(("CacheFile::SetExpirationTime() this=%p, expiration=%u", this,
        aExpirationTime));
 
   MOZ_ASSERT(mMetadata);
   NS_ENSURE_TRUE(mMetadata, NS_ERROR_UNEXPECTED);
 
   PostWriteTimer();
 
-  if (mHandle && !mHandle->IsDoomed())
-    CacheFileIOManager::UpdateIndexEntry(mHandle, nullptr, &aExpirationTime,
-                                         nullptr, nullptr, nullptr);
-
   return mMetadata->SetExpirationTime(aExpirationTime);
 }
 
 nsresult CacheFile::GetExpirationTime(uint32_t *_retval) {
   CacheFileAutoLock lock(this);
   MOZ_ASSERT(mMetadata);
   NS_ENSURE_TRUE(mMetadata, NS_ERROR_UNEXPECTED);
 
@@ -1171,17 +1167,17 @@ nsresult CacheFile::SetFrecency(uint32_t
 
   MOZ_ASSERT(mMetadata);
   NS_ENSURE_TRUE(mMetadata, NS_ERROR_UNEXPECTED);
 
   PostWriteTimer();
 
   if (mHandle && !mHandle->IsDoomed())
     CacheFileIOManager::UpdateIndexEntry(mHandle, &aFrecency, nullptr, nullptr,
-                                         nullptr, nullptr);
+                                         nullptr);
 
   return mMetadata->SetFrecency(aFrecency);
 }
 
 nsresult CacheFile::GetFrecency(uint32_t *_retval) {
   CacheFileAutoLock lock(this);
   MOZ_ASSERT(mMetadata);
   NS_ENSURE_TRUE(mMetadata, NS_ERROR_UNEXPECTED);
@@ -1219,17 +1215,17 @@ nsresult CacheFile::SetNetworkTimes(uint
 
   uint16_t onStartTime16 = aOnStartTime <= kIndexTimeOutOfBound
                                ? aOnStartTime
                                : kIndexTimeOutOfBound;
   uint16_t onStopTime16 =
       aOnStopTime <= kIndexTimeOutOfBound ? aOnStopTime : kIndexTimeOutOfBound;
 
   if (mHandle && !mHandle->IsDoomed()) {
-    CacheFileIOManager::UpdateIndexEntry(mHandle, nullptr, nullptr, nullptr,
+    CacheFileIOManager::UpdateIndexEntry(mHandle, nullptr, nullptr,
                                          &onStartTime16, &onStopTime16);
   }
   return NS_OK;
 }
 
 nsresult CacheFile::GetOnStartTime(uint64_t *_retval) {
   CacheFileAutoLock lock(this);
 
@@ -1278,18 +1274,18 @@ nsresult CacheFile::SetAltMetadata(const
     mMetadata->SetElement(CacheFileUtils::kAltDataKey, nullptr);
 
     mAltDataOffset = -1;
     mAltDataType.Truncate();
     hasAltData = false;
   }
 
   if (mHandle && !mHandle->IsDoomed()) {
-    CacheFileIOManager::UpdateIndexEntry(mHandle, nullptr, nullptr, &hasAltData,
-                                         nullptr, nullptr);
+    CacheFileIOManager::UpdateIndexEntry(mHandle, nullptr, &hasAltData, nullptr,
+                                         nullptr);
   }
   return rv;
 }
 
 nsresult CacheFile::GetLastModified(uint32_t *_retval) {
   CacheFileAutoLock lock(this);
   MOZ_ASSERT(mMetadata);
   NS_ENSURE_TRUE(mMetadata, NS_ERROR_UNEXPECTED);
@@ -2492,19 +2488,16 @@ nsresult CacheFile::InitIndexEntry() {
 
   nsresult rv;
 
   rv = CacheFileIOManager::InitIndexEntry(
       mHandle, GetOriginAttrsHash(mMetadata->OriginAttributes()),
       mMetadata->IsAnonymous(), mPinned);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  uint32_t expTime;
-  mMetadata->GetExpirationTime(&expTime);
-
   uint32_t frecency;
   mMetadata->GetFrecency(&frecency);
 
   bool hasAltData =
       mMetadata->GetElement(CacheFileUtils::kAltDataKey) ? true : false;
 
   static auto toUint16 = [](const char *s) -> uint16_t {
     if (s) {
@@ -2518,18 +2511,18 @@ nsresult CacheFile::InitIndexEntry() {
 
   const char *onStartTimeStr =
       mMetadata->GetElement("net-response-time-onstart");
   uint16_t onStartTime = toUint16(onStartTimeStr);
 
   const char *onStopTimeStr = mMetadata->GetElement("net-response-time-onstop");
   uint16_t onStopTime = toUint16(onStopTimeStr);
 
-  rv = CacheFileIOManager::UpdateIndexEntry(
-      mHandle, &frecency, &expTime, &hasAltData, &onStartTime, &onStopTime);
+  rv = CacheFileIOManager::UpdateIndexEntry(mHandle, &frecency, &hasAltData,
+                                            &onStartTime, &onStopTime);
   NS_ENSURE_SUCCESS(rv, rv);
 
   return NS_OK;
 }
 
 size_t CacheFile::SizeOfExcludingThis(
     mozilla::MallocSizeOf mallocSizeOf) const {
   CacheFileAutoLock lock(const_cast<CacheFile *>(this));
--- a/netwerk/cache2/CacheFileIOManager.cpp
+++ b/netwerk/cache2/CacheFileIOManager.cpp
@@ -966,59 +966,52 @@ class InitIndexEntryEvent : public Runna
     if (mHandle->IsClosed() || mHandle->IsDoomed()) {
       return NS_OK;
     }
 
     CacheIndex::InitEntry(mHandle->Hash(), mOriginAttrsHash, mAnonymous,
                           mPinning);
 
     // We cannot set the filesize before we init the entry. If we're opening
-    // an existing entry file, frecency and expiration time will be set after
-    // parsing the entry file, but we must set the filesize here since nobody is
-    // going to set it if there is no write to the file.
+    // an existing entry file, frecency will be set after parsing the entry
+    // file, but we must set the filesize here since nobody is going to set it
+    // if there is no write to the file.
     uint32_t sizeInK = mHandle->FileSizeInK();
     CacheIndex::UpdateEntry(mHandle->Hash(), nullptr, nullptr, nullptr, nullptr,
-                            nullptr, &sizeInK);
+                            &sizeInK);
 
     return NS_OK;
   }
 
  protected:
   RefPtr<CacheFileHandle> mHandle;
   OriginAttrsHash mOriginAttrsHash;
   bool mAnonymous;
   bool mPinning;
 };
 
 class UpdateIndexEntryEvent : public Runnable {
  public:
   UpdateIndexEntryEvent(CacheFileHandle *aHandle, const uint32_t *aFrecency,
-                        const uint32_t *aExpirationTime,
                         const bool *aHasAltData, const uint16_t *aOnStartTime,
                         const uint16_t *aOnStopTime)
       : Runnable("net::UpdateIndexEntryEvent"),
         mHandle(aHandle),
         mHasFrecency(false),
-        mHasExpirationTime(false),
         mHasHasAltData(false),
         mHasOnStartTime(false),
         mHasOnStopTime(false),
         mFrecency(0),
-        mExpirationTime(0),
         mHasAltData(false),
         mOnStartTime(0),
         mOnStopTime(0) {
     if (aFrecency) {
       mHasFrecency = true;
       mFrecency = *aFrecency;
     }
-    if (aExpirationTime) {
-      mHasExpirationTime = true;
-      mExpirationTime = *aExpirationTime;
-    }
     if (aHasAltData) {
       mHasHasAltData = true;
       mHasAltData = *aHasAltData;
     }
     if (aOnStartTime) {
       mHasOnStartTime = true;
       mOnStartTime = *aOnStartTime;
     }
@@ -1034,34 +1027,31 @@ class UpdateIndexEntryEvent : public Run
  public:
   NS_IMETHOD Run() override {
     if (mHandle->IsClosed() || mHandle->IsDoomed()) {
       return NS_OK;
     }
 
     CacheIndex::UpdateEntry(mHandle->Hash(),
                             mHasFrecency ? &mFrecency : nullptr,
-                            mHasExpirationTime ? &mExpirationTime : nullptr,
                             mHasHasAltData ? &mHasAltData : nullptr,
                             mHasOnStartTime ? &mOnStartTime : nullptr,
                             mHasOnStopTime ? &mOnStopTime : nullptr, nullptr);
     return NS_OK;
   }
 
  protected:
   RefPtr<CacheFileHandle> mHandle;
 
   bool mHasFrecency;
-  bool mHasExpirationTime;
   bool mHasHasAltData;
   bool mHasOnStartTime;
   bool mHasOnStopTime;
 
   uint32_t mFrecency;
-  uint32_t mExpirationTime;
   bool mHasAltData;
   uint16_t mOnStartTime;
   uint16_t mOnStopTime;
 };
 
 class MetadataWriteScheduleEvent : public Runnable {
  public:
   enum EMode { SCHEDULE, UNSCHEDULE, SHUTDOWN } mMode;
@@ -2047,17 +2037,17 @@ nsresult CacheFileIOManager::WriteIntern
       }
     }
 
     uint32_t newSizeInK = aHandle->FileSizeInK();
 
     if (oldSizeInK != newSizeInK && !aHandle->IsDoomed() &&
         !aHandle->IsSpecialFile()) {
       CacheIndex::UpdateEntry(aHandle->Hash(), nullptr, nullptr, nullptr,
-                              nullptr, nullptr, &newSizeInK);
+                              nullptr, &newSizeInK);
 
       if (oldSizeInK < newSizeInK) {
         EvictIfOverLimitInternal();
       }
     }
   }
 
   if (bytesWritten != aCount) {
@@ -2573,17 +2563,17 @@ nsresult CacheFileIOManager::TruncateSee
 
   uint32_t oldSizeInK = aHandle->FileSizeInK();
   aHandle->mFileSize = aEOFPos;
   uint32_t newSizeInK = aHandle->FileSizeInK();
 
   if (oldSizeInK != newSizeInK && !aHandle->IsDoomed() &&
       !aHandle->IsSpecialFile()) {
     CacheIndex::UpdateEntry(aHandle->Hash(), nullptr, nullptr, nullptr, nullptr,
-                            nullptr, &newSizeInK);
+                            &newSizeInK);
 
     if (oldSizeInK < newSizeInK) {
       EvictIfOverLimitInternal();
     }
   }
 
   return NS_OK;
 }
@@ -2886,19 +2876,18 @@ nsresult CacheFileIOManager::OverLimitEv
       // hack and we must make sure the flag is set by calling
       // EnsureEntryExists().
       rv = CacheIndex::EnsureEntryExists(&hash);
       NS_ENSURE_SUCCESS(rv, rv);
 
       // Move the entry at the end of both lists to make sure we won't end up
       // failing on one entry forever.
       uint32_t frecency = 0;
-      uint32_t expTime = nsICacheEntry::NO_EXPIRATION_TIME;
-      rv = CacheIndex::UpdateEntry(&hash, &frecency, &expTime, nullptr, nullptr,
-                                   nullptr, nullptr);
+      rv = CacheIndex::UpdateEntry(&hash, &frecency, nullptr, nullptr, nullptr,
+                                   nullptr);
       NS_ENSURE_SUCCESS(rv, rv);
 
       consecutiveFailures++;
       if (consecutiveFailures >= cnt) {
         // This doesn't necessarily mean that we've tried to doom every entry
         // but we've reached a sane number of tries. It is likely that another
         // eviction will start soon. And as said earlier, this normally doesn't
         // happen at all.
@@ -3544,43 +3533,40 @@ nsresult CacheFileIOManager::InitIndexEn
   NS_ENSURE_SUCCESS(rv, rv);
 
   return NS_OK;
 }
 
 // static
 nsresult CacheFileIOManager::UpdateIndexEntry(CacheFileHandle *aHandle,
                                               const uint32_t *aFrecency,
-                                              const uint32_t *aExpirationTime,
                                               const bool *aHasAltData,
                                               const uint16_t *aOnStartTime,
                                               const uint16_t *aOnStopTime) {
   LOG(
       ("CacheFileIOManager::UpdateIndexEntry() [handle=%p, frecency=%s, "
-       "expirationTime=%s, hasAltData=%s, onStartTime=%s, onStopTime=%s]",
+       "hasAltData=%s, onStartTime=%s, onStopTime=%s]",
        aHandle, aFrecency ? nsPrintfCString("%u", *aFrecency).get() : "",
-       aExpirationTime ? nsPrintfCString("%u", *aExpirationTime).get() : "",
        aHasAltData ? (*aHasAltData ? "true" : "false") : "",
        aOnStartTime ? nsPrintfCString("%u", *aOnStartTime).get() : "",
        aOnStopTime ? nsPrintfCString("%u", *aOnStopTime).get() : ""));
 
   nsresult rv;
   RefPtr<CacheFileIOManager> ioMan = gInstance;
 
   if (aHandle->IsClosed() || !ioMan) {
     return NS_ERROR_NOT_INITIALIZED;
   }
 
   if (aHandle->IsSpecialFile()) {
     return NS_ERROR_UNEXPECTED;
   }
 
-  RefPtr<UpdateIndexEntryEvent> ev =
-      new UpdateIndexEntryEvent(aHandle, aFrecency, aExpirationTime,
-                                aHasAltData, aOnStartTime, aOnStopTime);
+  RefPtr<UpdateIndexEntryEvent> ev = new UpdateIndexEntryEvent(
+      aHandle, aFrecency, aHasAltData, aOnStartTime, aOnStopTime);
   rv = ioMan->mIOThread->Dispatch(ev, aHandle->mPriority
                                           ? CacheIOThread::WRITE_PRIORITY
                                           : CacheIOThread::WRITE);
   NS_ENSURE_SUCCESS(rv, rv);
 
   return NS_OK;
 }
 
--- a/netwerk/cache2/CacheFileIOManager.h
+++ b/netwerk/cache2/CacheFileIOManager.h
@@ -315,17 +315,16 @@ class CacheFileIOManager final : public 
   static nsresult EvictByContext(nsILoadContextInfo *aLoadContextInfo,
                                  bool aPinning, const nsAString &aOrigin);
 
   static nsresult InitIndexEntry(CacheFileHandle *aHandle,
                                  OriginAttrsHash aOriginAttrsHash,
                                  bool aAnonymous, bool aPinning);
   static nsresult UpdateIndexEntry(CacheFileHandle *aHandle,
                                    const uint32_t *aFrecency,
-                                   const uint32_t *aExpirationTime,
                                    const bool *aHasAltData,
                                    const uint16_t *aOnStartTime,
                                    const uint16_t *aOnStopTime);
 
   static nsresult UpdateIndexEntry();
 
   enum EEnumerateMode { ENTRIES, DOOMED };
 
--- a/netwerk/cache2/CacheIndex.cpp
+++ b/netwerk/cache2/CacheIndex.cpp
@@ -21,17 +21,17 @@
 #include "mozilla/AutoRestore.h"
 #include <algorithm>
 #include "mozilla/Telemetry.h"
 #include "mozilla/Unused.h"
 
 #define kMinUnwrittenChanges 300
 #define kMinDumpInterval 20000  // in milliseconds
 #define kMaxBufSize 16384
-#define kIndexVersion 0x00000005
+#define kIndexVersion 0x00000006
 #define kUpdateIndexStartDelay 50000  // in milliseconds
 
 #define INDEX_NAME "index"
 #define TEMP_INDEX_NAME "index.tmp"
 #define JOURNAL_NAME "index.log"
 
 namespace mozilla {
 namespace net {
@@ -917,27 +917,24 @@ nsresult CacheIndex::RemoveEntry(const S
   index->WriteIndexToDiskIfNeeded();
 
   return NS_OK;
 }
 
 // static
 nsresult CacheIndex::UpdateEntry(const SHA1Sum::Hash *aHash,
                                  const uint32_t *aFrecency,
-                                 const uint32_t *aExpirationTime,
                                  const bool *aHasAltData,
                                  const uint16_t *aOnStartTime,
                                  const uint16_t *aOnStopTime,
                                  const uint32_t *aSize) {
   LOG(
       ("CacheIndex::UpdateEntry() [hash=%08x%08x%08x%08x%08x, "
-       "frecency=%s, expirationTime=%s, hasAltData=%s, onStartTime=%s, "
-       "onStopTime=%s, size=%s]",
+       "frecency=%s, hasAltData=%s, onStartTime=%s, onStopTime=%s, size=%s]",
        LOGSHA1(aHash), aFrecency ? nsPrintfCString("%u", *aFrecency).get() : "",
-       aExpirationTime ? nsPrintfCString("%u", *aExpirationTime).get() : "",
        aHasAltData ? (*aHasAltData ? "true" : "false") : "",
        aOnStartTime ? nsPrintfCString("%u", *aOnStartTime).get() : "",
        aOnStopTime ? nsPrintfCString("%u", *aOnStopTime).get() : "",
        aSize ? nsPrintfCString("%u", *aSize).get() : ""));
 
   MOZ_ASSERT(CacheFileIOManager::IsOnIOThread());
 
   StaticMutexAutoLock lock(sLock);
@@ -968,33 +965,29 @@ nsresult CacheIndex::UpdateEntry(const S
 
       if (!entry) {
         LOG(("CacheIndex::UpdateEntry() - Entry was not found in mIndex!"));
         NS_WARNING(
             ("CacheIndex::UpdateEntry() - Entry was not found in mIndex!"));
         return NS_ERROR_UNEXPECTED;
       }
 
-      if (!HasEntryChanged(entry, aFrecency, aExpirationTime, aHasAltData,
-                           aOnStartTime, aOnStopTime, aSize)) {
+      if (!HasEntryChanged(entry, aFrecency, aHasAltData, aOnStartTime,
+                           aOnStopTime, aSize)) {
         return NS_OK;
       }
 
       MOZ_ASSERT(entry->IsFresh());
       MOZ_ASSERT(entry->IsInitialized());
       entry->MarkDirty();
 
       if (aFrecency) {
         entry->SetFrecency(*aFrecency);
       }
 
-      if (aExpirationTime) {
-        entry->SetExpirationTime(*aExpirationTime);
-      }
-
       if (aHasAltData) {
         entry->SetHasAltData(*aHasAltData);
       }
 
       if (aOnStartTime) {
         entry->SetOnStartTime(*aOnStartTime);
       }
 
@@ -1031,20 +1024,16 @@ nsresult CacheIndex::UpdateEntry(const S
       MOZ_ASSERT(updated->IsFresh());
       MOZ_ASSERT(updated->IsInitialized());
       updated->MarkDirty();
 
       if (aFrecency) {
         updated->SetFrecency(*aFrecency);
       }
 
-      if (aExpirationTime) {
-        updated->SetExpirationTime(*aExpirationTime);
-      }
-
       if (aHasAltData) {
         updated->SetHasAltData(*aHasAltData);
       }
 
       if (aOnStartTime) {
         updated->SetOnStartTime(*aOnStartTime);
       }
 
@@ -1531,29 +1520,24 @@ bool CacheIndex::IsCollision(CacheIndexE
   }
 
   return false;
 }
 
 // static
 bool CacheIndex::HasEntryChanged(CacheIndexEntry *aEntry,
                                  const uint32_t *aFrecency,
-                                 const uint32_t *aExpirationTime,
                                  const bool *aHasAltData,
                                  const uint16_t *aOnStartTime,
                                  const uint16_t *aOnStopTime,
                                  const uint32_t *aSize) {
   if (aFrecency && *aFrecency != aEntry->GetFrecency()) {
     return true;
   }
 
-  if (aExpirationTime && *aExpirationTime != aEntry->GetExpirationTime()) {
-    return true;
-  }
-
   if (aHasAltData && *aHasAltData != aEntry->GetHasAltData()) {
     return true;
   }
 
   if (aOnStartTime && *aOnStartTime != aEntry->GetOnStartTime()) {
     return true;
   }
 
@@ -2631,20 +2615,16 @@ nsresult CacheIndex::InitEntryFromDiskDa
                                            int64_t aFileSize) {
   aEntry->InitNew();
   aEntry->MarkDirty();
   aEntry->MarkFresh();
 
   aEntry->Init(GetOriginAttrsHash(aMetaData->OriginAttributes()),
                aMetaData->IsAnonymous(), aMetaData->Pinned());
 
-  uint32_t expirationTime;
-  aMetaData->GetExpirationTime(&expirationTime);
-  aEntry->SetExpirationTime(expirationTime);
-
   uint32_t frecency;
   aMetaData->GetFrecency(&frecency);
   aEntry->SetFrecency(frecency);
 
   const char *altData = aMetaData->GetElement(CacheFileUtils::kAltDataKey);
   bool hasAltData = altData ? true : false;
   if (hasAltData && NS_FAILED(CacheFileUtils::ParseAlternativeDataInfo(
                         altData, nullptr, nullptr))) {
--- a/netwerk/cache2/CacheIndex.h
+++ b/netwerk/cache2/CacheIndex.h
@@ -65,17 +65,16 @@ static_assert(sizeof(CacheIndexHeader::m
                   sizeof(CacheIndexHeader),
               "Unexpected sizeof(CacheIndexHeader)!");
 
 #pragma pack(push, 4)
 struct CacheIndexRecord {
   SHA1Sum::Hash mHash;
   uint32_t mFrecency;
   OriginAttrsHash mOriginAttrsHash;
-  uint32_t mExpirationTime;
   uint16_t mOnStartTime;
   uint16_t mOnStopTime;
 
   /*
    *    1000 0000 0000 0000 0000 0000 0000 0000 : initialized
    *    0100 0000 0000 0000 0000 0000 0000 0000 : anonymous
    *    0010 0000 0000 0000 0000 0000 0000 0000 : removed
    *    0001 0000 0000 0000 0000 0000 0000 0000 : dirty
@@ -85,27 +84,25 @@ struct CacheIndexRecord {
    *    0000 0001 0000 0000 0000 0000 0000 0000 : reserved
    *    0000 0000 1111 1111 1111 1111 1111 1111 : file size (in kB)
    */
   uint32_t mFlags;
 
   CacheIndexRecord()
       : mFrecency(0),
         mOriginAttrsHash(0),
-        mExpirationTime(nsICacheEntry::NO_EXPIRATION_TIME),
         mOnStartTime(kIndexTimeNotAvailable),
         mOnStopTime(kIndexTimeNotAvailable),
         mFlags(0) {}
 };
 #pragma pack(pop)
 
 static_assert(sizeof(CacheIndexRecord::mHash) +
                       sizeof(CacheIndexRecord::mFrecency) +
                       sizeof(CacheIndexRecord::mOriginAttrsHash) +
-                      sizeof(CacheIndexRecord::mExpirationTime) +
                       sizeof(CacheIndexRecord::mOnStartTime) +
                       sizeof(CacheIndexRecord::mOnStopTime) +
                       sizeof(CacheIndexRecord::mFlags) ==
                   sizeof(CacheIndexRecord),
               "Unexpected sizeof(CacheIndexRecord)!");
 
 class CacheIndexEntry : public PLDHashEntryHdr {
  public:
@@ -148,36 +145,33 @@ class CacheIndexEntry : public PLDHashEn
   bool operator==(const CacheIndexEntry &aOther) const {
     return KeyEquals(&aOther.mRec->mHash);
   }
 
   CacheIndexEntry &operator=(const CacheIndexEntry &aOther) {
     MOZ_ASSERT(
         memcmp(&mRec->mHash, &aOther.mRec->mHash, sizeof(SHA1Sum::Hash)) == 0);
     mRec->mFrecency = aOther.mRec->mFrecency;
-    mRec->mExpirationTime = aOther.mRec->mExpirationTime;
     mRec->mOriginAttrsHash = aOther.mRec->mOriginAttrsHash;
     mRec->mOnStartTime = aOther.mRec->mOnStartTime;
     mRec->mOnStopTime = aOther.mRec->mOnStopTime;
     mRec->mFlags = aOther.mRec->mFlags;
     return *this;
   }
 
   void InitNew() {
     mRec->mFrecency = 0;
-    mRec->mExpirationTime = nsICacheEntry::NO_EXPIRATION_TIME;
     mRec->mOriginAttrsHash = 0;
     mRec->mOnStartTime = kIndexTimeNotAvailable;
     mRec->mOnStopTime = kIndexTimeNotAvailable;
     mRec->mFlags = 0;
   }
 
   void Init(OriginAttrsHash aOriginAttrsHash, bool aAnonymous, bool aPinned) {
     MOZ_ASSERT(mRec->mFrecency == 0);
-    MOZ_ASSERT(mRec->mExpirationTime == nsICacheEntry::NO_EXPIRATION_TIME);
     MOZ_ASSERT(mRec->mOriginAttrsHash == 0);
     MOZ_ASSERT(mRec->mOnStartTime == kIndexTimeNotAvailable);
     MOZ_ASSERT(mRec->mOnStopTime == kIndexTimeNotAvailable);
     // When we init the entry it must be fresh and may be dirty
     MOZ_ASSERT((mRec->mFlags & ~kDirtyMask) == kFreshMask);
 
     mRec->mOriginAttrsHash = aOriginAttrsHash;
     mRec->mFlags |= kInitializedMask;
@@ -209,21 +203,16 @@ class CacheIndexEntry : public PLDHashEn
   bool IsFresh() const { return !!(mRec->mFlags & kFreshMask); }
   void MarkFresh() { mRec->mFlags |= kFreshMask; }
 
   bool IsPinned() const { return !!(mRec->mFlags & kPinnedMask); }
 
   void SetFrecency(uint32_t aFrecency) { mRec->mFrecency = aFrecency; }
   uint32_t GetFrecency() const { return mRec->mFrecency; }
 
-  void SetExpirationTime(uint32_t aExpirationTime) {
-    mRec->mExpirationTime = aExpirationTime;
-  }
-  uint32_t GetExpirationTime() const { return mRec->mExpirationTime; }
-
   void SetHasAltData(bool aHasAltData) {
     aHasAltData ? mRec->mFlags |= kHasAltDataMask
                 : mRec->mFlags &= ~kHasAltDataMask;
   }
   bool GetHasAltData() const { return !!(mRec->mFlags & kHasAltDataMask); }
 
   void SetOnStartTime(uint16_t aTime) { mRec->mOnStartTime = aTime; }
   uint16_t GetOnStartTime() const { return mRec->mOnStartTime; }
@@ -256,18 +245,16 @@ class CacheIndexEntry : public PLDHashEn
   void WriteToBuf(void *aBuf) {
     uint8_t *ptr = static_cast<uint8_t *>(aBuf);
     memcpy(ptr, mRec->mHash, sizeof(SHA1Sum::Hash));
     ptr += sizeof(SHA1Sum::Hash);
     NetworkEndian::writeUint32(ptr, mRec->mFrecency);
     ptr += sizeof(uint32_t);
     NetworkEndian::writeUint64(ptr, mRec->mOriginAttrsHash);
     ptr += sizeof(uint64_t);
-    NetworkEndian::writeUint32(ptr, mRec->mExpirationTime);
-    ptr += sizeof(uint32_t);
     NetworkEndian::writeUint16(ptr, mRec->mOnStartTime);
     ptr += sizeof(uint16_t);
     NetworkEndian::writeUint16(ptr, mRec->mOnStopTime);
     ptr += sizeof(uint16_t);
     // Dirty and fresh flags should never go to disk, since they make sense only
     // during current session.
     NetworkEndian::writeUint32(ptr, mRec->mFlags & ~(kDirtyMask | kFreshMask));
   }
@@ -275,35 +262,32 @@ class CacheIndexEntry : public PLDHashEn
   void ReadFromBuf(void *aBuf) {
     const uint8_t *ptr = static_cast<const uint8_t *>(aBuf);
     MOZ_ASSERT(memcmp(&mRec->mHash, ptr, sizeof(SHA1Sum::Hash)) == 0);
     ptr += sizeof(SHA1Sum::Hash);
     mRec->mFrecency = NetworkEndian::readUint32(ptr);
     ptr += sizeof(uint32_t);
     mRec->mOriginAttrsHash = NetworkEndian::readUint64(ptr);
     ptr += sizeof(uint64_t);
-    mRec->mExpirationTime = NetworkEndian::readUint32(ptr);
-    ptr += sizeof(uint32_t);
     mRec->mOnStartTime = NetworkEndian::readUint16(ptr);
     ptr += sizeof(uint16_t);
     mRec->mOnStopTime = NetworkEndian::readUint16(ptr);
     ptr += sizeof(uint16_t);
     mRec->mFlags = NetworkEndian::readUint32(ptr);
   }
 
   void Log() const {
     LOG(
         ("CacheIndexEntry::Log() [this=%p, hash=%08x%08x%08x%08x%08x, fresh=%u,"
          " initialized=%u, removed=%u, dirty=%u, anonymous=%u, "
-         "originAttrsHash=%" PRIx64 ", frecency=%u, expirationTime=%u, "
-         "hasAltData=%u, onStartTime=%u, onStopTime=%u, size=%u]",
+         "originAttrsHash=%" PRIx64 ", frecency=%u, hasAltData=%u, "
+         "onStartTime=%u, onStopTime=%u, size=%u]",
          this, LOGSHA1(mRec->mHash), IsFresh(), IsInitialized(), IsRemoved(),
          IsDirty(), Anonymous(), OriginAttrsHash(), GetFrecency(),
-         GetExpirationTime(), GetHasAltData(), GetOnStartTime(),
-         GetOnStopTime(), GetFileSize()));
+         GetHasAltData(), GetOnStartTime(), GetOnStopTime(), GetFileSize()));
   }
 
   static bool RecordMatchesLoadContextInfo(CacheIndexRecord *aRec,
                                            nsILoadContextInfo *aInfo) {
     MOZ_ASSERT(aInfo);
 
     if (!aInfo->IsPrivate() &&
         GetOriginAttrsHash(*aInfo->OriginAttributesPtr()) ==
@@ -374,32 +358,27 @@ class CacheIndexEntryUpdate : public Cac
     MOZ_ASSERT(
         memcmp(&mRec->mHash, &aOther.mRec->mHash, sizeof(SHA1Sum::Hash)) == 0);
     mUpdateFlags = 0;
     *(static_cast<CacheIndexEntry *>(this)) = aOther;
     return *this;
   }
 
   void InitNew() {
-    mUpdateFlags = kFrecencyUpdatedMask | kExpirationUpdatedMask |
-                   kHasAltDataUpdatedMask | kOnStartTimeUpdatedMask |
-                   kOnStopTimeUpdatedMask | kFileSizeUpdatedMask;
+    mUpdateFlags = kFrecencyUpdatedMask | kHasAltDataUpdatedMask |
+                   kOnStartTimeUpdatedMask | kOnStopTimeUpdatedMask |
+                   kFileSizeUpdatedMask;
     CacheIndexEntry::InitNew();
   }
 
   void SetFrecency(uint32_t aFrecency) {
     mUpdateFlags |= kFrecencyUpdatedMask;
     CacheIndexEntry::SetFrecency(aFrecency);
   }
 
-  void SetExpirationTime(uint32_t aExpirationTime) {
-    mUpdateFlags |= kExpirationUpdatedMask;
-    CacheIndexEntry::SetExpirationTime(aExpirationTime);
-  }
-
   void SetHasAltData(bool aHasAltData) {
     mUpdateFlags |= kHasAltDataUpdatedMask;
     CacheIndexEntry::SetHasAltData(aHasAltData);
   }
 
   void SetOnStartTime(uint16_t aTime) {
     mUpdateFlags |= kOnStartTimeUpdatedMask;
     CacheIndexEntry::SetOnStartTime(aTime);
@@ -416,19 +395,16 @@ class CacheIndexEntryUpdate : public Cac
   }
 
   void ApplyUpdate(CacheIndexEntry *aDst) {
     MOZ_ASSERT(
         memcmp(&mRec->mHash, &aDst->mRec->mHash, sizeof(SHA1Sum::Hash)) == 0);
     if (mUpdateFlags & kFrecencyUpdatedMask) {
       aDst->mRec->mFrecency = mRec->mFrecency;
     }
-    if (mUpdateFlags & kExpirationUpdatedMask) {
-      aDst->mRec->mExpirationTime = mRec->mExpirationTime;
-    }
     aDst->mRec->mOriginAttrsHash = mRec->mOriginAttrsHash;
     if (mUpdateFlags & kOnStartTimeUpdatedMask) {
       aDst->mRec->mOnStartTime = mRec->mOnStartTime;
     }
     if (mUpdateFlags & kOnStopTimeUpdatedMask) {
       aDst->mRec->mOnStopTime = mRec->mOnStopTime;
     }
     if (mUpdateFlags & kHasAltDataUpdatedMask &&
@@ -444,17 +420,16 @@ class CacheIndexEntryUpdate : public Cac
       // Copy all flags except |HasAltData| and file size.
       aDst->mRec->mFlags &= kFileSizeMask;
       aDst->mRec->mFlags |= (mRec->mFlags & ~kHasAltDataMask & ~kFileSizeMask);
     }
   }
 
  private:
   static const uint32_t kFrecencyUpdatedMask = 0x00000001;
-  static const uint32_t kExpirationUpdatedMask = 0x00000002;
   static const uint32_t kFileSizeUpdatedMask = 0x00000004;
   static const uint32_t kHasAltDataUpdatedMask = 0x00000008;
   static const uint32_t kOnStartTimeUpdatedMask = 0x00000010;
   static const uint32_t kOnStopTimeUpdatedMask = 0x00000020;
 
   uint32_t mUpdateFlags;
 };
 
@@ -681,17 +656,16 @@ class CacheIndex final : public CacheFil
   static nsresult RemoveEntry(const SHA1Sum::Hash *aHash);
 
   // Update some information in entry. The entry MUST be present in index and
   // MUST be initialized. Call to AddEntry() or EnsureEntryExists() and to
   // InitEntry() must precede the call to this method.
   // Pass nullptr if the value didn't change.
   static nsresult UpdateEntry(const SHA1Sum::Hash *aHash,
                               const uint32_t *aFrecency,
-                              const uint32_t *aExpirationTime,
                               const bool *aHasAltData,
                               const uint16_t *aOnStartTime,
                               const uint16_t *aOnStopTime,
                               const uint32_t *aSize);
 
   // Remove all entries from the index. Called when clearing the whole cache.
   static nsresult RemoveAll();
 
@@ -786,17 +760,16 @@ class CacheIndex final : public CacheFil
   // since these values are part of the key that we hash and we use a strong
   // hash function.
   static bool IsCollision(CacheIndexEntry *aEntry,
                           OriginAttrsHash aOriginAttrsHash, bool aAnonymous);
 
   // Checks whether any of the information about the entry has changed.
   static bool HasEntryChanged(CacheIndexEntry *aEntry,
                               const uint32_t *aFrecency,
-                              const uint32_t *aExpirationTime,
                               const bool *aHasAltData,
                               const uint16_t *aOnStartTime,
                               const uint16_t *aOnStopTime,
                               const uint32_t *aSize);
 
   // Merge all pending operations from mPendingUpdates into mIndex.
   void ProcessPendingOperations();