Merge e10s -> m-c.

This commit is contained in:
Dan Witte 2010-09-07 15:34:44 -07:00
commit eb0eeec501
10 changed files with 82 additions and 17 deletions

View File

@ -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();

View File

@ -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

View File

@ -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 {

View File

@ -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;

View File

@ -133,7 +133,7 @@ HttpChannelParent::RecvAsyncOpen(const IPC::URI& aURI,
return SendCancelEarly(rv);
nsHttpChannel *httpChan = static_cast<nsHttpChannel *>(mChannel.get());
httpChan->SetRemoteChannel(true);
httpChan->SetServicingRemoteChannel(PR_TRUE);
if (doResumeAt)
httpChan->ResumeAt(startPos, entityID);

View File

@ -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<nsHttpChannel*>(httpChannel.get());
httpChannelImpl->SetRemoteChannel(mRemoteChannel);
// convey the mApplyConversion flag (bug 91862)
nsCOMPtr<nsIEncodedChannel> encodedChannel = do_QueryInterface(httpChannel);
if (encodedChannel)
@ -3081,6 +3077,12 @@ nsHttpChannel::SetupReplacementChannel(nsIURI *newURI,
resumableChannel->ResumeAt(mStartPos, mEntityID);
}
// transfer the remote flag
nsCOMPtr<nsIHttpChannelParentInternal> 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
//-----------------------------------------------------------------------------

View File

@ -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)

View File

@ -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;
};

View File

@ -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

View File

@ -224,6 +224,37 @@ static PRInt64 GetSimpleBookmarksQueryFolder(
static void ParseSearchTermsFromQueries(const nsCOMArray<nsNavHistoryQuery>& aQueries,
nsTArray<nsTArray<nsString>*>* 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<nsIPrefBranch> mPrefBranch;
};
NS_IMPL_ISUPPORTS1(VacuumDBListener, mozIStorageStatementCallback)
} // anonymous namespace
namespace mozilla {
@ -5926,14 +5957,11 @@ nsNavHistory::VacuumDatabase()
journalToDefault
};
nsCOMPtr<mozIStoragePendingStatement> ps;
rv = mDBConn->ExecuteAsync(stmts, NS_ARRAY_LENGTH(stmts), nsnull,
getter_AddRefs(ps));
nsRefPtr<VacuumDBListener> 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;