@@ -163,7 +163,8 @@ NS_IMPL_ISUPPORTS(CacheEntry,
163
163
CacheEntry::CacheEntry (const nsACString& aStorageID,
164
164
nsIURI* aURI,
165
165
const nsACString& aEnhanceID,
166
- bool aUseDisk)
166
+ bool aUseDisk,
167
+ uint32_t aPinningAppId)
167
168
: mFrecency (0 )
168
169
, mSortingExpirationTime (uint32_t (-1 ))
169
170
, mLock (" CacheEntry" )
@@ -172,6 +173,7 @@ CacheEntry::CacheEntry(const nsACString& aStorageID,
172
173
, mEnhanceID (aEnhanceID)
173
174
, mStorageID (aStorageID)
174
175
, mUseDisk (aUseDisk)
176
+ , mPinningAppId (aPinningAppId)
175
177
, mIsDoomed (false )
176
178
, mSecurityInfoLoaded (false )
177
179
, mPreventCallbacks (false )
@@ -341,7 +343,8 @@ bool CacheEntry::Load(bool aTruncate, bool aPriority)
341
343
// as a new one.
342
344
// 2. When this is a memory-only entry, check there is a disk file.
343
345
// If there is or could be, doom that file.
344
- if ((!aTruncate || !mUseDisk ) && NS_SUCCEEDED(rv)) {
346
+ if ((!aTruncate || !mUseDisk ) && NS_SUCCEEDED(rv) &&
347
+ !mPinningAppId ) {
345
348
// Check the index right now to know we have or have not the entry
346
349
// as soon as possible.
347
350
CacheIndex::EntryStatus status;
@@ -391,6 +394,7 @@ bool CacheEntry::Load(bool aTruncate, bool aPriority)
391
394
rv = mFile ->Init (fileKey,
392
395
aTruncate,
393
396
!mUseDisk ,
397
+ mPinningAppId ,
394
398
aPriority,
395
399
directLoad ? nullptr : this );
396
400
}
@@ -486,6 +490,7 @@ already_AddRefed<CacheEntryHandle> CacheEntry::ReopenTruncated(bool aMemoryOnly,
486
490
nsresult rv = CacheStorageService::Self ()->AddStorageEntry (
487
491
GetStorageID (), GetURI (), GetEnhanceID (),
488
492
mUseDisk && !aMemoryOnly,
493
+ mPinningAppId ,
489
494
true , // always create
490
495
true , // truncate existing (this one)
491
496
getter_AddRefs (handle));
0 commit comments