Commit 102f9173 authored by Mike Perry's avatar Mike Perry
Browse files

Add a string-based cacheKey.

Used for isolating cache according to same-origin policy.
parent 3db9a852
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -64,6 +64,13 @@ interface nsICachingChannel : nsICacheInfoChannel
     */
    attribute nsISupports cacheKey;

    /**
     * Set/get the cache domain... uniquely identifies the data in the cache
     * for this channel.  Holding a reference to this key does NOT prevent
     * the cached data from being removed.
     */
    attribute AUTF8String cacheDomain;

    /**************************************************************************
     * Caching channel specific load flags:
     */
+22 −0
Original line number Diff line number Diff line
@@ -2726,6 +2726,12 @@ nsHttpChannel::AssembleCacheKey(const char *spec, uint32_t postID,
        cacheKey.Append(buf);
    }

    if (strlen(mCacheDomain.get()) > 0) {
        cacheKey.AppendLiteral("domain=");
        cacheKey.Append(mCacheDomain.get());
        cacheKey.AppendLiteral("&");
    }

    if (!cacheKey.IsEmpty()) {
        cacheKey.AppendLiteral("uri=");
    }
@@ -5270,6 +5276,22 @@ nsHttpChannel::SetCacheTokenCachedCharset(const nsACString &aCharset)
// nsHttpChannel::nsICachingChannel
//-----------------------------------------------------------------------------

NS_IMETHODIMP
nsHttpChannel::GetCacheDomain(nsACString &value)
{
    value = mCacheDomain;

    return NS_OK;
}

NS_IMETHODIMP
nsHttpChannel::SetCacheDomain(const nsACString &value)
{
    mCacheDomain = value;

    return NS_OK;
}

NS_IMETHODIMP
nsHttpChannel::GetCacheToken(nsISupports **token)
{
+1 −0
Original line number Diff line number Diff line
@@ -313,6 +313,7 @@ private:
    nsCacheAccessMode                 mOfflineCacheAccess;
    uint32_t                          mOfflineCacheLastModifiedTime;
    nsCOMPtr<nsIApplicationCache>     mApplicationCacheForWrite;
    nsCString                         mCacheDomain;

    // auth specific data
    nsCOMPtr<nsIHttpChannelAuthProvider> mAuthProvider;