author | Boris Zbarsky <bzbarsky@mit.edu> |
Tue, 29 Mar 2011 00:41:01 -0400 | |
changeset 64088 | 79487686ac2983577e95a8edc74ba61b87b01f8b |
parent 64087 | 8373a20bb449b902678a748ef26ddd971deede39 |
child 64132 | 021f973484346c8f750361d385dcfd1f4c21e4c4 |
child 64421 | 5867ed624b37f8a912748a82eb81dd264ded0af4 |
push id | 1 |
push user | root |
push date | Tue, 26 Apr 2011 22:38:44 +0000 |
treeherder | mozilla-beta@bfdb6e623a36 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | sicking |
bugs | 644069 |
milestone | 2.2a1pre |
first release with | nightly linux32
79487686ac29
/
4.2a1pre
/
20110329030437
/
files
nightly linux64
79487686ac29
/
4.2a1pre
/
20110329030437
/
files
nightly mac
79487686ac29
/
4.2a1pre
/
20110329030437
/
files
nightly win32
79487686ac29
/
4.2a1pre
/
20110329030437
/
files
nightly win64
79487686ac29
/
4.2a1pre
/
20110329030205
/
files
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
releases | nightly linux32
4.2a1pre
/
20110329030437
/
pushlog to previous
nightly linux64
4.2a1pre
/
20110329030437
/
pushlog to previous
nightly mac
4.2a1pre
/
20110329030437
/
pushlog to previous
nightly win32
4.2a1pre
/
20110329030437
/
pushlog to previous
nightly win64
4.2a1pre
/
20110329030205
/
pushlog to previous
|
--- a/content/base/src/nsCrossSiteListenerProxy.cpp +++ b/content/base/src/nsCrossSiteListenerProxy.cpp @@ -232,49 +232,49 @@ nsPreflightCache::GetEntry(nsIURI* aURI, // This is a new entry, allocate and insert into the table now so that any // failures don't cause items to be removed from a full cache. entry = new CacheEntry(key); if (!entry) { NS_WARNING("Failed to allocate new cache entry!"); return nsnull; } - if (!mTable.Put(key, entry)) { - // Failed, clean up the new entry. - delete entry; - - NS_WARNING("Failed to add entry to the CORS cache!"); - return nsnull; - } - - PR_INSERT_LINK(entry, &mList); - - NS_ASSERTION(mTable.Count() <= PREFLIGHT_CACHE_SIZE + 1, + NS_ASSERTION(mTable.Count() <= PREFLIGHT_CACHE_SIZE, "Something is borked, too many entries in the cache!"); // Now enforce the max count. - if (mTable.Count() > PREFLIGHT_CACHE_SIZE) { + if (mTable.Count() == PREFLIGHT_CACHE_SIZE) { // Try to kick out all the expired entries. PRTime now = PR_Now(); mTable.Enumerate(RemoveExpiredEntries, &now); // If that didn't remove anything then kick out the least recently used // entry. - if (mTable.Count() > PREFLIGHT_CACHE_SIZE) { + if (mTable.Count() == PREFLIGHT_CACHE_SIZE) { CacheEntry* lruEntry = static_cast<CacheEntry*>(PR_LIST_TAIL(&mList)); PR_REMOVE_LINK(lruEntry); // This will delete 'lruEntry'. mTable.Remove(lruEntry->mKey); - NS_ASSERTION(mTable.Count() == PREFLIGHT_CACHE_SIZE, + NS_ASSERTION(mTable.Count() == PREFLIGHT_CACHE_SIZE - 1, "Somehow tried to remove an entry that was never added!"); } } + if (!mTable.Put(key, entry)) { + // Failed, clean up the new entry. + delete entry; + + NS_WARNING("Failed to add entry to the CORS preflight cache!"); + return nsnull; + } + + PR_INSERT_LINK(entry, &mList); + return entry; } void nsPreflightCache::RemoveEntries(nsIURI* aURI, nsIPrincipal* aPrincipal) { CacheEntry* entry; nsCString key; @@ -303,17 +303,17 @@ nsPreflightCache::RemoveExpiredEntries(c nsAutoPtr<CacheEntry>& aValue, void* aUserData) { PRTime* now = static_cast<PRTime*>(aUserData); aValue->PurgeExpired(*now); if (aValue->mHeaders.IsEmpty() && - aValue->mHeaders.IsEmpty()) { + aValue->mMethods.IsEmpty()) { // Expired, remove from the list as well as the hash table. PR_REMOVE_LINK(aValue); return PL_DHASH_REMOVE; } return PL_DHASH_NEXT; }