Backed out changeset b4cf9833464e (bug 715837)

This commit is contained in:
Geoff Lankow 2012-05-07 23:42:18 +12:00
parent 5f734d1558
commit 85b0375b2b
4 changed files with 9 additions and 52 deletions

View File

@ -43,6 +43,7 @@
#include "mozilla/net/NeckoParent.h"
#include "mozilla/unused.h"
#include "HttpChannelParentListener.h"
#include "nsHttpChannel.h"
#include "nsHttpHandler.h"
#include "nsNetUtil.h"
#include "nsISupportsPriority.h"
@ -393,11 +394,8 @@ HttpChannelParent::RecvDocumentChannelCleanup()
bool
HttpChannelParent::RecvMarkOfflineCacheEntryAsForeign()
{
if (mOfflineForeignMarker) {
mOfflineForeignMarker->MarkAsForeign();
mOfflineForeignMarker = 0;
}
nsHttpChannel *httpChan = static_cast<nsHttpChannel *>(mChannel.get());
httpChan->MarkOfflineCacheEntryAsForeign();
return true;
}
@ -423,7 +421,6 @@ HttpChannelParent::OnStartRequest(nsIRequest *aRequest, nsISupports *aContext)
bool loadedFromApplicationCache;
chan->GetLoadedFromApplicationCache(&loadedFromApplicationCache);
if (loadedFromApplicationCache) {
mOfflineForeignMarker = chan->GetOfflineCacheEntryAsForeignMarker();
nsCOMPtr<nsIApplicationCache> appCache;
chan->GetApplicationCache(getter_AddRefs(appCache));
nsCString appCacheGroupId;

View File

@ -49,7 +49,6 @@
#include "nsIParentRedirectingChannel.h"
#include "nsIProgressEventSink.h"
#include "nsITabParent.h"
#include "nsHttpChannel.h"
using namespace mozilla::dom;
@ -129,8 +128,6 @@ private:
nsCOMPtr<nsIChannel> mRedirectChannel;
nsCOMPtr<nsIAsyncVerifyRedirectCallback> mRedirectCallback;
nsAutoPtr<class nsHttpChannel::OfflineCacheEntryAsForeignMarker> mOfflineForeignMarker;
// state for combining OnStatus/OnProgress with OnDataAvailable
// into one IPDL call to child.
nsresult mStoredStatus;

View File

@ -5176,40 +5176,20 @@ nsHttpChannel::SetChooseApplicationCache(bool aChoose)
return NS_OK;
}
nsHttpChannel::OfflineCacheEntryAsForeignMarker*
nsHttpChannel::GetOfflineCacheEntryAsForeignMarker()
NS_IMETHODIMP
nsHttpChannel::MarkOfflineCacheEntryAsForeign()
{
if (!mApplicationCache)
return nsnull;
return NS_ERROR_NOT_AVAILABLE;
nsresult rv;
nsCAutoString cacheKey;
rv = GenerateCacheKey(mPostID, cacheKey);
NS_ENSURE_SUCCESS(rv, nsnull);
NS_ENSURE_SUCCESS(rv, rv);
return new OfflineCacheEntryAsForeignMarker(mApplicationCache, cacheKey);
}
nsresult
nsHttpChannel::OfflineCacheEntryAsForeignMarker::MarkAsForeign()
{
return mApplicationCache->MarkEntry(mCacheKey,
nsIApplicationCache::ITEM_FOREIGN);
}
NS_IMETHODIMP
nsHttpChannel::MarkOfflineCacheEntryAsForeign()
{
nsresult rv;
nsAutoPtr<OfflineCacheEntryAsForeignMarker> marker
= GetOfflineCacheEntryAsForeignMarker();
if (!marker)
return NS_ERROR_NOT_AVAILABLE;
rv = marker->MarkAsForeign();
rv = mApplicationCache->MarkEntry(cacheKey,
nsIApplicationCache::ITEM_FOREIGN);
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;

View File

@ -161,23 +161,6 @@ public: /* internal necko use only */
return NS_OK;
}
// This allows cache entry to be marked as foreign even after channel itself
// is gone. Needed for e10s (see HttpChannelParent::RecvDocumentChannelCleanup)
class OfflineCacheEntryAsForeignMarker {
nsCOMPtr<nsIApplicationCache> mApplicationCache;
nsCString mCacheKey;
public:
OfflineCacheEntryAsForeignMarker(nsIApplicationCache* appCache,
const nsCSubstring& key)
: mApplicationCache(appCache)
, mCacheKey(key)
{}
nsresult MarkAsForeign();
};
OfflineCacheEntryAsForeignMarker* GetOfflineCacheEntryAsForeignMarker();
private:
typedef nsresult (nsHttpChannel::*nsContinueRedirectionFunc)(nsresult result);