diff --git a/extensions/cookie/test/unit/test_domain_eviction.js b/extensions/cookie/test/unit/test_domain_eviction.js index 34bfd56dfaea..198fbbbc02d7 100644 --- a/extensions/cookie/test/unit/test_domain_eviction.js +++ b/extensions/cookie/test/unit/test_domain_eviction.js @@ -4,6 +4,9 @@ function run_test() { + // Set the base domain limit to 50 so we have a known value. + Services.prefs.setIntPref("network.cookie.maxPerHost", 50); + var cm = Cc["@mozilla.org/cookiemanager;1"].getService(Ci.nsICookieManager2); cm.removeAll(); diff --git a/netwerk/cache/nsDiskCacheDevice.cpp b/netwerk/cache/nsDiskCacheDevice.cpp index 84cd7e7def6f..2eae82f8062e 100644 --- a/netwerk/cache/nsDiskCacheDevice.cpp +++ b/netwerk/cache/nsDiskCacheDevice.cpp @@ -775,8 +775,8 @@ nsDiskCacheDevice::OnDataSizeChange(nsCacheEntry * entry, PRInt32 deltaSize) PRUint32 newSizeK = ((newSize + 0x3FF) >> 10); // If the new size is larger than max. file size or larger than - // half the cache capacity (which is in KiB's), doom the entry and abort - if ((newSize > kMaxDataFileSize) || (newSizeK > mCacheCapacity/2)) { + // 1/8 the cache capacity (which is in KiB's), doom the entry and abort + if ((newSize > kMaxDataFileSize) || (newSizeK > mCacheCapacity/8)) { #ifdef DEBUG nsresult rv = #endif diff --git a/netwerk/cache/nsDiskCacheMap.h b/netwerk/cache/nsDiskCacheMap.h index 5c6d31872666..78676c9bad54 100644 --- a/netwerk/cache/nsDiskCacheMap.h +++ b/netwerk/cache/nsDiskCacheMap.h @@ -90,7 +90,8 @@ struct nsDiskCacheEntry; #define kMinRecordCount 512 #define kSeparateFile 0 -#define kMaxDataFileSize 0x3FFFC00 // 65535 KiB (see bug #443067) +// #define must always be <= 65535KB, or overflow. See bug 443067 Comment 8 +#define kMaxDataFileSize 5 * 1024 * 1024 // 5 MB (in bytes) #define kBuckets (1 << 5) // must be a power of 2! class nsDiskCacheRecord { diff --git a/netwerk/cookie/nsCookieService.cpp b/netwerk/cookie/nsCookieService.cpp index bfdc8cc40944..546a08402af8 100644 --- a/netwerk/cookie/nsCookieService.cpp +++ b/netwerk/cookie/nsCookieService.cpp @@ -116,7 +116,7 @@ static const char kOldCookieFileName[] = "cookies.txt"; // default limits for the cookie list. these can be tuned by the // network.cookie.maxNumber and network.cookie.maxPerHost prefs respectively. static const PRUint32 kMaxNumberOfCookies = 3000; -static const PRUint32 kMaxCookiesPerHost = 50; +static const PRUint32 kMaxCookiesPerHost = 150; static const PRUint32 kMaxBytesPerCookie = 4096; static const PRUint32 kMaxBytesPerPath = 1024; diff --git a/netwerk/protocol/http/HttpChannelParent.cpp b/netwerk/protocol/http/HttpChannelParent.cpp index 263b5ebf022a..f6cb057c9637 100644 --- a/netwerk/protocol/http/HttpChannelParent.cpp +++ b/netwerk/protocol/http/HttpChannelParent.cpp @@ -133,7 +133,7 @@ HttpChannelParent::RecvAsyncOpen(const IPC::URI& aURI, return SendCancelEarly(rv); nsHttpChannel *httpChan = static_cast(mChannel.get()); - httpChan->SetRemoteChannel(true); + httpChan->SetServicingRemoteChannel(PR_TRUE); if (doResumeAt) httpChan->ResumeAt(startPos, entityID); diff --git a/netwerk/protocol/http/nsHttpChannel.cpp b/netwerk/protocol/http/nsHttpChannel.cpp index ffb12f9e743a..897cbf1f89b6 100644 --- a/netwerk/protocol/http/nsHttpChannel.cpp +++ b/netwerk/protocol/http/nsHttpChannel.cpp @@ -3062,10 +3062,6 @@ nsHttpChannel::SetupReplacementChannel(nsIURI *newURI, if (!httpChannel) return NS_OK; // no other options to set - // transfer the remote flag - nsHttpChannel *httpChannelImpl = static_cast(httpChannel.get()); - httpChannelImpl->SetRemoteChannel(mRemoteChannel); - // convey the mApplyConversion flag (bug 91862) nsCOMPtr encodedChannel = do_QueryInterface(httpChannel); if (encodedChannel) @@ -3081,6 +3077,12 @@ nsHttpChannel::SetupReplacementChannel(nsIURI *newURI, resumableChannel->ResumeAt(mStartPos, mEntityID); } + // transfer the remote flag + nsCOMPtr httpInternal = + do_QueryInterface(newChannel); + if (httpInternal) + httpInternal->SetServicingRemoteChannel(mRemoteChannel); + return NS_OK; } @@ -3531,6 +3533,23 @@ nsHttpChannel::SetupFallbackChannel(const char *aFallbackKey) return NS_OK; } + +//----------------------------------------------------------------------------- +// nsHttpChannel::nsIHttpChannelParentInternal +//----------------------------------------------------------------------------- + +NS_IMETHODIMP +nsHttpChannel::GetServicingRemoteChannel(PRBool *value) +{ + *value = mRemoteChannel; + return NS_OK; +} +NS_IMETHODIMP +nsHttpChannel::SetServicingRemoteChannel(PRBool value) +{ + mRemoteChannel = value; + return NS_OK; +} //----------------------------------------------------------------------------- // nsHttpChannel::nsIEncodedChannel //----------------------------------------------------------------------------- diff --git a/netwerk/protocol/http/nsHttpChannel.h b/netwerk/protocol/http/nsHttpChannel.h index fa8539fc20b9..46219d4477c3 100644 --- a/netwerk/protocol/http/nsHttpChannel.h +++ b/netwerk/protocol/http/nsHttpChannel.h @@ -86,6 +86,7 @@ class nsHttpChannel : public HttpBaseChannel , public nsITraceableChannel , public nsIApplicationCacheChannel , public nsIAsyncVerifyRedirectCallback + , public nsIHttpChannelParentInternal { public: NS_DECL_ISUPPORTS_INHERITED @@ -102,6 +103,7 @@ public: NS_DECL_NSIAPPLICATIONCACHECONTAINER NS_DECL_NSIAPPLICATIONCACHECHANNEL NS_DECL_NSIASYNCVERIFYREDIRECTCALLBACK + NS_DECL_NSIHTTPCHANNELPARENTINTERNAL // nsIHttpAuthenticableChannel. We can't use // NS_DECL_NSIHTTPAUTHENTICABLECHANNEL because it duplicates cancel() and @@ -148,7 +150,6 @@ public: public: /* internal necko use only */ typedef void (nsHttpChannel:: *nsAsyncCallback)(void); nsHttpResponseHead * GetResponseHead() const { return mResponseHead; } - void SetRemoteChannel(bool aRemote) { mRemoteChannel = aRemote; } void InternalSetUploadStream(nsIInputStream *uploadStream) { mUploadStream = uploadStream; } void SetUploadStreamHasHeaders(PRBool hasHeaders) diff --git a/netwerk/protocol/http/nsIHttpChannelInternal.idl b/netwerk/protocol/http/nsIHttpChannelInternal.idl index 302040503916..e27e37388be0 100644 --- a/netwerk/protocol/http/nsIHttpChannelInternal.idl +++ b/netwerk/protocol/http/nsIHttpChannelInternal.idl @@ -89,3 +89,13 @@ interface nsIHttpChannelInternal : nsISupports */ readonly attribute boolean canceled; }; + +[uuid(b18290f1-ff34-4e33-93a2-29aeb7b95425)] +interface nsIHttpChannelParentInternal : nsISupports +{ + /** + * True for a chrome channel that is servicing a child channel (i.e. request + * originated in child process, not chrome). + */ + [noscript] attribute boolean servicingRemoteChannel; +}; diff --git a/netwerk/test/TestCookie.cpp b/netwerk/test/TestCookie.cpp index 107cda64a9cd..c6415945ab30 100644 --- a/netwerk/test/TestCookie.cpp +++ b/netwerk/test/TestCookie.cpp @@ -61,6 +61,7 @@ static const char kCookiesLifetimeDays[] = "network.cookie.lifetime.days"; static const char kCookiesLifetimeCurrentSession[] = "network.cookie.lifetime.behavior"; static const char kCookiesP3PString[] = "network.cookie.p3p"; static const char kCookiesAskPermission[] = "network.cookie.warnAboutCookies"; +static const char kCookiesMaxPerHost[] = "network.cookie.maxPerHost"; static char *sBuffer; @@ -215,6 +216,8 @@ InitPrefs(nsIPrefBranch *aPrefBranch) aPrefBranch->SetIntPref(kCookiesLifetimeCurrentSession, 0); aPrefBranch->SetIntPref(kCookiesLifetimeDays, 1); aPrefBranch->SetBoolPref(kCookiesAskPermission, PR_FALSE); + // Set the base domain limit to 50 so we have a known value. + aPrefBranch->SetIntPref(kCookiesMaxPerHost, 50); } class ScopedXPCOM diff --git a/toolkit/components/places/src/nsNavHistory.cpp b/toolkit/components/places/src/nsNavHistory.cpp index 89acf7c8b7fa..4015751525f7 100644 --- a/toolkit/components/places/src/nsNavHistory.cpp +++ b/toolkit/components/places/src/nsNavHistory.cpp @@ -224,6 +224,37 @@ static PRInt64 GetSimpleBookmarksQueryFolder( static void ParseSearchTermsFromQueries(const nsCOMArray& aQueries, nsTArray*>* aTerms); +class VacuumDBListener : public AsyncStatementCallback +{ +public: + NS_DECL_ISUPPORTS + + VacuumDBListener(nsIPrefBranch* aBranch) + : mPrefBranch(aBranch) + { + } + + NS_IMETHOD HandleResult(mozIStorageResultSet*) + { + // 'PRAGMA journal_mode' statements always return a result. Ignore it. + return NS_OK; + } + + NS_IMETHOD HandleCompletion(PRUint16 aReason) + { + if (aReason == REASON_FINISHED && mPrefBranch) { + (void)mPrefBranch->SetIntPref(PREF_LAST_VACUUM, + (PRInt32)(PR_Now() / PR_USEC_PER_SEC)); + } + return NS_OK; + } + +private: + nsCOMPtr mPrefBranch; +}; + +NS_IMPL_ISUPPORTS1(VacuumDBListener, mozIStorageStatementCallback) + } // anonymous namespace namespace mozilla { @@ -5926,14 +5957,11 @@ nsNavHistory::VacuumDatabase() journalToDefault }; nsCOMPtr ps; - rv = mDBConn->ExecuteAsync(stmts, NS_ARRAY_LENGTH(stmts), nsnull, - getter_AddRefs(ps)); + nsRefPtr vacuumDBListener = + new VacuumDBListener(mPrefBranch); + rv = mDBConn->ExecuteAsync(stmts, NS_ARRAY_LENGTH(stmts), + vacuumDBListener, getter_AddRefs(ps)); NS_ENSURE_SUCCESS(rv, rv); - - if (mPrefBranch) { - (void)mPrefBranch->SetIntPref(PREF_LAST_VACUUM, - (PRInt32)(PR_Now() / PR_USEC_PER_SEC)); - } } return NS_OK;