Backed out 3 changesets (bug 1054572) for being the apparent cause of ASAN m-3 leaks

Backed out changeset cbd1a7c4d0b0 (bug 1054572)
Backed out changeset 466d677dacc0 (bug 1054572)
Backed out changeset 8b49480288aa (bug 1054572)
This commit is contained in:
Wes Kocher 2014-08-22 12:45:29 -07:00
parent b94f1f1e66
commit 1032aeef55
19 changed files with 88 additions and 32 deletions

View File

@ -12,6 +12,7 @@
#include "nsCPrefetchService.h"
#include "nsNetUtil.h"
#include "nsNetCID.h"
#include "nsICacheSession.h"
#include "nsIOfflineCacheUpdate.h"
#include "nsAutoPtr.h"
#include "nsContentUtils.h"

View File

@ -18,7 +18,7 @@ function OfflineCacheContents(urls) {
OfflineCacheContents.prototype = {
QueryInterface: function(iid) {
if (!iid.equals(Ci.nsISupports) &&
!iid.equals(Ci.nsICacheEntryOpenCallback)) {
!iid.equals(Ci.nsICacheListener)) {
throw Cr.NS_ERROR_NO_INTERFACE;
}
return this;

View File

@ -6,7 +6,7 @@
#include "mozIThirdPartyUtil.h"
#include "nsNetUtil.h"
#include "nsICacheEntry.h"
#include "nsICacheEntryDescriptor.h"
#include "nsICachingChannel.h"
#include "nsIChannel.h"
#include "nsIDocShell.h"
@ -41,7 +41,6 @@ NS_IMPL_ISUPPORTS(nsChannelClassifier,
nsIURIClassifierCallback)
nsChannelClassifier::nsChannelClassifier()
: mIsAllowListed(false)
{
#if defined(PR_LOGGING)
if (!gChannelClassifierLog)
@ -123,12 +122,7 @@ nsChannelClassifier::ShouldEnableTrackingProtection(nsIChannel *aChannel,
}
#endif
if (permissions == nsIPermissionManager::ALLOW_ACTION) {
mIsAllowListed = true;
*result = false;
} else {
*result = true;
}
*result = permissions != nsIPermissionManager::ALLOW_ACTION;
// Tracking protection will be enabled so return without updating
// the security state. If any channels are subsequently cancelled
@ -265,7 +259,7 @@ void
nsChannelClassifier::MarkEntryClassified(nsresult status)
{
// Don't cache tracking classifications because we support allowlisting.
if (status == NS_ERROR_TRACKING_URI || mIsAllowListed) {
if (status == NS_ERROR_TRACKING_URI) {
return;
}
@ -281,7 +275,7 @@ nsChannelClassifier::MarkEntryClassified(nsresult status)
return;
}
nsCOMPtr<nsICacheEntry> cacheEntry =
nsCOMPtr<nsICacheEntryDescriptor> cacheEntry =
do_QueryInterface(cacheToken);
if (!cacheEntry) {
return;
@ -313,7 +307,7 @@ nsChannelClassifier::HasBeenClassified(nsIChannel *aChannel)
return false;
}
nsCOMPtr<nsICacheEntry> cacheEntry =
nsCOMPtr<nsICacheEntryDescriptor> cacheEntry =
do_QueryInterface(cacheToken);
if (!cacheEntry) {
return false;

View File

@ -24,8 +24,6 @@ public:
private:
nsCOMPtr<nsIChannel> mSuspendedChannel;
// Set true if the channel is on the allow list.
bool mIsAllowListed;
~nsChannelClassifier() {}
void MarkEntryClassified(nsresult status);

View File

@ -9,7 +9,6 @@
#include "HttpLog.h"
#include "nsHttp.h"
#include "nsICacheEntry.h"
#include "mozilla/unused.h"
#include "mozilla/dom/ContentChild.h"
#include "mozilla/dom/TabChild.h"
@ -42,7 +41,7 @@ HttpChannelChild::HttpChannelChild()
: HttpAsyncAborter<HttpChannelChild>(MOZ_THIS_IN_INITIALIZER_LIST())
, mIsFromCache(false)
, mCacheEntryAvailable(false)
, mCacheExpirationTime(nsICacheEntry::NO_EXPIRATION_TIME)
, mCacheExpirationTime(nsICache::NO_EXPIRATION_TIME)
, mSendResumeAt(false)
, mIPCOpen(false)
, mKeptAlive(false)

View File

@ -572,7 +572,7 @@ HttpChannelParent::OnStartRequest(nsIRequest *aRequest, nsISupports *aContext)
nsHttpRequestHead *requestHead = chan->GetRequestHead();
bool isFromCache = false;
chan->IsFromCache(&isFromCache);
uint32_t expirationTime = nsICacheEntry::NO_EXPIRATION_TIME;
uint32_t expirationTime = nsICache::NO_EXPIRATION_TIME;
chan->GetCacheTokenExpirationTime(&expirationTime);
nsCString cachedCharset;
chan->GetCacheTokenCachedCharset(cachedCharset);

View File

@ -58,6 +58,7 @@
#include "nsInputStreamPump.h"
#include "nsURLHelper.h"
#include "nsISocketTransport.h"
#include "nsICacheSession.h"
#include "nsIStreamConverterService.h"
#include "nsISiteSecurityService.h"
#include "nsCRT.h"

View File

@ -25,6 +25,7 @@
class nsIPrincipal;
class nsDNSPrefetch;
class nsICacheEntryDescriptor;
class nsICancelable;
class nsIHttpChannelAuthProvider;
class nsInputStreamPump;

View File

@ -38,6 +38,7 @@
#include "EventTokenBucket.h"
#include "Tickler.h"
#include "nsIXULAppInfo.h"
#include "nsICacheSession.h"
#include "nsICookieService.h"
#include "nsIObserverService.h"
#include "nsISiteSecurityService.h"
@ -193,6 +194,7 @@ nsHttpHandler::nsHttpHandler()
, mSpdyPingThreshold(PR_SecondsToInterval(58))
, mSpdyPingTimeout(PR_SecondsToInterval(8))
, mConnectTimeout(90000)
, mBypassCacheLockThreshold(250.0)
, mParallelSpeculativeConnectLimit(6)
, mRequestTokenBucketEnabled(true)
, mRequestTokenBucketMinParallelism(6)
@ -1240,6 +1242,16 @@ nsHttpHandler::PrefsChanged(nsIPrefBranch *prefs, const char *pref)
mConnectTimeout = clamped(val, 1, 0xffff) * PR_MSEC_PER_SEC;
}
// The maximum amount of time the cache session lock can be held
// before a new transaction bypasses the cache. In milliseconds.
if (PREF_CHANGED(HTTP_PREF("bypass-cachelock-threshold"))) {
rv = prefs->GetIntPref(HTTP_PREF("bypass-cachelock-threshold"), &val);
if (NS_SUCCEEDED(rv))
// the pref and variable are both in milliseconds
mBypassCacheLockThreshold =
static_cast<double>(clamped(val, 0, 0x7ffffff));
}
// The maximum number of current global half open sockets allowable
// for starting a new speculative connection.
if (PREF_CHANGED(HTTP_PREF("speculative-parallel-limit"))) {
@ -1762,6 +1774,35 @@ nsHttpHandler::GetMisc(nsACString &value)
return NS_OK;
}
/*static*/ void
nsHttpHandler::GetCacheSessionNameForStoragePolicy(
nsCacheStoragePolicy storagePolicy,
bool isPrivate,
uint32_t appId,
bool inBrowser,
nsACString& sessionName)
{
MOZ_ASSERT(!isPrivate || storagePolicy == nsICache::STORE_IN_MEMORY);
switch (storagePolicy) {
case nsICache::STORE_IN_MEMORY:
sessionName.AssignASCII(isPrivate ? "HTTP-memory-only-PB" : "HTTP-memory-only");
break;
case nsICache::STORE_OFFLINE:
sessionName.AssignLiteral("HTTP-offline");
break;
default:
sessionName.AssignLiteral("HTTP");
break;
}
if (appId != NECKO_NO_APP_ID || inBrowser) {
sessionName.Append('~');
sessionName.AppendInt(appId);
sessionName.Append('~');
sessionName.AppendInt(inBrowser);
}
}
//-----------------------------------------------------------------------------
// nsHttpHandler::nsIObserver
//-----------------------------------------------------------------------------

View File

@ -18,6 +18,7 @@
#include "nsIHttpProtocolHandler.h"
#include "nsIObserver.h"
#include "nsISpeculativeConnect.h"
#include "nsICache.h"
class nsIHttpChannel;
class nsIPrefBranch;
@ -109,6 +110,7 @@ public:
uint32_t ConnectTimeout() { return mConnectTimeout; }
uint32_t ParallelSpeculativeConnectLimit() { return mParallelSpeculativeConnectLimit; }
bool CriticalRequestPrioritization() { return mCriticalRequestPrioritization; }
double BypassCacheLockThreshold() { return mBypassCacheLockThreshold; }
uint32_t MaxConnectionsPerOrigin() { return mMaxPersistentConnectionsPerServer; }
bool UseRequestTokenBucket() { return mRequestTokenBucketEnabled; }
@ -298,6 +300,13 @@ public:
// returns true in between Init and Shutdown states
bool Active() { return mHandlerActive; }
static void GetCacheSessionNameForStoragePolicy(
nsCacheStoragePolicy storagePolicy,
bool isPrivate,
uint32_t appId,
bool inBrowser,
nsACString& sessionName);
// When the disk cache is responding slowly its use is suppressed
// for 1 minute for most requests. Callable from main thread only.
TimeStamp GetCacheSkippedUntil() { return mCacheSkippedUntil; }
@ -465,6 +474,10 @@ private:
// established. In milliseconds.
uint32_t mConnectTimeout;
// The maximum amount of time the nsICacheSession lock can be held
// before a new transaction bypasses the cache. In milliseconds.
double mBypassCacheLockThreshold;
// The maximum number of current global half open sockets allowable
// when starting a new speculative connection.
uint32_t mParallelSpeculativeConnectLimit;

View File

@ -1,5 +1,8 @@
var _ios;
var ACCESS_WRITE = Ci.nsICache.ACCESS_WRITE;
var ACCESS_READ = Ci.nsICache.ACCESS_READ;
var KEY_CORRUPT_SECINFO = "http://corruptSecurityInfo/";
var ENTRY_DATA = "foobar";

View File

@ -38,6 +38,17 @@ function make_uri(url) {
return ios.newURI(url, null, null);
}
function CacheListener() { }
CacheListener.prototype = {
QueryInterface : function(iid)
{
if (iid.equals(Components.interfaces.nsICacheListener))
return this;
throw Components.results.NS_NOINTERFACE;
},
};
const responseBody = "response body";
// A HTTP channel for updating the offline cache should normally succeed.

View File

@ -13,6 +13,7 @@
#include "nsIStringStream.h"
#include "nsIChannel.h"
#include "nsICachingChannel.h"
#include "nsICacheEntryDescriptor.h"
#include "nsIInputStream.h"
#include "CNavDTD.h"
#include "prenv.h"

View File

@ -15,15 +15,6 @@ function checkLoads() {
var style = document.defaultView.getComputedStyle(elt, "");
window.parent.isnot(style.visibility, "hidden", "Should not load bad css");
// Call parent.loadTestFrame again to test classification metadata in HTTP
// cache entries.
if (window.parent.firstLoad) {
window.parent.info("Reloading from cache...");
window.parent.firstLoad = false;
window.parent.loadTestFrame();
return;
}
// End (parent) test.
window.parent.SimpleTest.finish();
}

View File

@ -15,7 +15,6 @@
var Cc = SpecialPowers.Cc;
var Ci = SpecialPowers.Ci;
var firstLoad = true;
// Add some URLs to the malware database.
var testData = "malware.example.com/";
@ -27,10 +26,6 @@ var testUpdate =
var dbService = Cc["@mozilla.org/url-classifier/dbservice;1"]
.getService(Ci.nsIUrlClassifierDBService);
function loadTestFrame() {
document.getElementById("testFrame").src = "classifierFrame.html";
}
function doUpdate(update) {
var listener = {
QueryInterface: function(iid)
@ -51,7 +46,10 @@ function doUpdate(update) {
updateSuccess: function(requestedTimeout) {
SpecialPowers.pushPrefEnv(
{"set" : [["browser.safebrowsing.malware.enabled", true]]},
loadTestFrame);
function loadTestFrame() {
document.getElementById("testFrame").src = "classifierFrame.html";
}
);
}
};

View File

@ -14,6 +14,7 @@
#include "nsIApplicationCacheContainer.h"
#include "nsIApplicationCacheChannel.h"
#include "nsIApplicationCacheService.h"
#include "nsICache.h"
#include "nsICachingChannel.h"
#include "nsIContent.h"
#include "mozilla/dom/Element.h"

View File

@ -36,6 +36,7 @@
class nsOfflineCacheUpdate;
class nsICacheEntryDescriptor;
class nsIUTF8StringEnumerator;
class nsILoadContext;

View File

@ -31,6 +31,7 @@
#include "nsIWebProgress.h"
#include "nsIWebNavigation.h"
#include "nsICryptoHash.h"
#include "nsICacheEntryDescriptor.h"
#include "nsIPermissionManager.h"
#include "nsIPrincipal.h"
#include "nsIScriptSecurityManager.h"

View File

@ -10,6 +10,7 @@
#include "nsIWebProgress.h"
#include "nsCURILoader.h"
#include "nsICachingChannel.h"
#include "nsICacheVisitor.h"
#include "nsIHttpChannel.h"
#include "nsIURL.h"
#include "nsISimpleEnumerator.h"