[tor-commits] [torbrowser/maint-2.4] Fix an exception on New Identity w/ NULL image firstPartyURI.

erinn at torproject.org erinn at torproject.org
Tue Feb 19 17:57:53 UTC 2013


commit bd9d79e513c3cbfc7915442599c2224dff147371
Author: Mike Perry <mikeperry-git at fscked.org>
Date:   Sat Feb 9 16:01:57 2013 -0800

    Fix an exception on New Identity w/ NULL image firstPartyURI.
---
 ...solate-the-Image-Cache-per-url-bar-domain.patch |   59 +++++++++++--------
 1 files changed, 34 insertions(+), 25 deletions(-)

diff --git a/src/current-patches/firefox/0024-Isolate-the-Image-Cache-per-url-bar-domain.patch b/src/current-patches/firefox/0024-Isolate-the-Image-Cache-per-url-bar-domain.patch
index 862673b..3fb55cf 100644
--- a/src/current-patches/firefox/0024-Isolate-the-Image-Cache-per-url-bar-domain.patch
+++ b/src/current-patches/firefox/0024-Isolate-the-Image-Cache-per-url-bar-domain.patch
@@ -1,4 +1,4 @@
-From e2d2cca918467240f4265799ead98defb1139db0 Mon Sep 17 00:00:00 2001
+From 3454d300fca2eea0e652f8982ec996575886dd1a Mon Sep 17 00:00:00 2001
 From: Mike Perry <mikeperry-git at torproject.org>
 Date: Thu, 6 Dec 2012 14:19:34 -0800
 Subject: [PATCH 24/26] Isolate the Image Cache per url bar domain.
@@ -10,7 +10,7 @@ not obey cacheKeys by default.
  embedding/browser/webBrowser/nsContextMenuInfo.cpp |   27 ++-
  extensions/cookie/nsCookiePermission.cpp           |    3 +
  image/public/imgILoader.idl                        |    4 +-
- image/src/imgLoader.cpp                            |  257 +++++++++++++-------
+ image/src/imgLoader.cpp                            |  262 +++++++++++++-------
  image/src/imgLoader.h                              |   20 +-
  image/src/imgRequest.cpp                           |   11 +-
  image/src/imgRequest.h                             |    3 +
@@ -18,7 +18,7 @@ not obey cacheKeys by default.
  netwerk/cookie/nsICookiePermission.idl             |    1 +
  toolkit/system/gnome/nsAlertsIconListener.cpp      |    3 +-
  widget/cocoa/nsMenuItemIconX.mm                    |    9 +-
- 12 files changed, 247 insertions(+), 118 deletions(-)
+ 12 files changed, 250 insertions(+), 120 deletions(-)
 
 diff --git a/content/base/src/nsContentUtils.cpp b/content/base/src/nsContentUtils.cpp
 index 8d58d8b..6a9c87c 100644
@@ -149,7 +149,7 @@ index da26463..ecff309 100644
                          in nsIPrincipal aLoadingPrincipal,
                          in nsILoadGroup aLoadGroup,
 diff --git a/image/src/imgLoader.cpp b/image/src/imgLoader.cpp
-index ea51e8d..4d5cfd2 100644
+index ea51e8d..8f2e0c1 100644
 --- a/image/src/imgLoader.cpp
 +++ b/image/src/imgLoader.cpp
 @@ -39,6 +39,7 @@
@@ -232,11 +232,11 @@ index ea51e8d..4d5cfd2 100644
 +  // content.
 +  nsTArray<nsRefPtr<imgCacheEntry> > entries;
 +  cache.Enumerate(EnumAllEntries, &entries);
- 
--    nsRefPtr<imgRequest> request = getter_AddRefs(entry->GetRequest());
++
 +  for (uint32_t i = 0; i < entries.Length(); ++i) {
 +    bool isEqual = false;
-+
+ 
+-    nsRefPtr<imgRequest> request = getter_AddRefs(entry->GetRequest());
 +    nsRefPtr<imgRequest> request = getter_AddRefs(entries[i]->GetRequest());
      if (request) {
 -      *_retval = request->Properties();
@@ -437,14 +437,14 @@ index ea51e8d..4d5cfd2 100644
 +
 +  return rv;
 +}
- 
--  LOG_STATIC_FUNC_WITH_PARAM(gImgLog, "imgLoader::RemoveFromCache", "uri", spec.get());
++
 +bool imgLoader::RemoveKeyFromCache(imgCacheTable &cache, 
 +                                   imgCacheQueue &queue,
 +                                   nsCAutoString key)
 +{
 +  if (key.IsEmpty()) return false;
-+
+ 
+-  LOG_STATIC_FUNC_WITH_PARAM(gImgLog, "imgLoader::RemoveFromCache", "uri", spec.get());
 +  LOG_STATIC_FUNC_WITH_PARAM(gImgLog, "imgLoader::RemoveKeyFromCache", "uri", key.get());
  
    nsRefPtr<imgCacheEntry> entry;
@@ -468,14 +468,14 @@ index ea51e8d..4d5cfd2 100644
 +    nsCOMPtr<nsIURI> imgURI = request->mURI;
 +    nsCOMPtr<nsIURI> firstPartyURI = request->mFirstPartyURI;
 +
-+    if (imgURI && firstPartyURI) {
++    if (imgURI) {
 +      imgCacheTable &cache = GetCache(imgURI);
 +      imgCacheQueue &queue = GetCacheQueue(imgURI);
 +      nsCAutoString spec = GetCacheKey(firstPartyURI, imgURI);
  
        LOG_STATIC_FUNC_WITH_PARAM(gImgLog, "imgLoader::RemoveFromCache", "entry's uri", spec.get());
  
-@@ -1438,18 +1485,6 @@ bool imgLoader::RemoveFromCache(imgCacheEntry *entry)
+@@ -1438,32 +1485,21 @@ bool imgLoader::RemoveFromCache(imgCacheEntry *entry)
    return false;
  }
  
@@ -493,8 +493,9 @@ index ea51e8d..4d5cfd2 100644
 -
  nsresult imgLoader::EvictEntries(imgCacheTable &aCacheToClear)
  {
++  nsresult rv = NS_OK;
    LOG_STATIC_FUNC(gImgLog, "imgLoader::EvictEntries table");
-@@ -1457,7 +1492,7 @@ nsresult imgLoader::EvictEntries(imgCacheTable &aCacheToClear)
+ 
    // We have to make a temporary, since RemoveFromCache removes the element
    // from the queue, invalidating iterators.
    nsTArray<nsRefPtr<imgCacheEntry> > entries;
@@ -503,7 +504,15 @@ index ea51e8d..4d5cfd2 100644
  
    for (uint32_t i = 0; i < entries.Length(); ++i)
      if (!RemoveFromCache(entries[i]))
-@@ -1490,11 +1525,10 @@ nsresult imgLoader::EvictEntries(imgCacheQueue &aQueueToClear)
+-      return NS_ERROR_FAILURE;
++      rv = NS_ERROR_FAILURE;
+ 
+-  return NS_OK;
++  return rv;
+ }
+ 
+ nsresult imgLoader::EvictEntries(imgCacheQueue &aQueueToClear)
+@@ -1490,11 +1526,10 @@ nsresult imgLoader::EvictEntries(imgCacheQueue &aQueueToClear)
                                    nsIRequest::VALIDATE_NEVER |    \
                                    nsIRequest::VALIDATE_ONCE_PER_SESSION)
  
@@ -517,7 +526,7 @@ index ea51e8d..4d5cfd2 100644
                                     nsIURI *aReferrerURI,
                                     nsIPrincipal* aLoadingPrincipal,
                                     nsILoadGroup *aLoadGroup,
-@@ -1513,8 +1547,8 @@ NS_IMETHODIMP imgLoader::LoadImage(nsIURI *aURI,
+@@ -1513,8 +1548,8 @@ NS_IMETHODIMP imgLoader::LoadImage(nsIURI *aURI,
    if (!aURI)
      return NS_ERROR_NULL_POINTER;
  
@@ -528,7 +537,7 @@ index ea51e8d..4d5cfd2 100644
    LOG_SCOPE_WITH_PARAM(gImgLog, "imgLoader::LoadImage", "aURI", spec.get());
  
    *_retval = nullptr;
-@@ -1566,7 +1600,7 @@ NS_IMETHODIMP imgLoader::LoadImage(nsIURI *aURI,
+@@ -1566,7 +1601,7 @@ NS_IMETHODIMP imgLoader::LoadImage(nsIURI *aURI,
    imgCacheTable &cache = GetCache(aURI);
  
    if (cache.Get(spec, getter_AddRefs(entry)) && entry) {
@@ -537,7 +546,7 @@ index ea51e8d..4d5cfd2 100644
                        aLoadGroup, aObserver, aCX, requestFlags, true,
                        aRequest, _retval, aPolicy, aLoadingPrincipal, corsmode)) {
        request = getter_AddRefs(entry->GetRequest());
-@@ -1605,7 +1639,7 @@ NS_IMETHODIMP imgLoader::LoadImage(nsIURI *aURI,
+@@ -1605,7 +1640,7 @@ NS_IMETHODIMP imgLoader::LoadImage(nsIURI *aURI,
      rv = NewImageChannel(getter_AddRefs(newChannel),
                           &forcePrincipalCheck,
                           aURI,
@@ -546,7 +555,7 @@ index ea51e8d..4d5cfd2 100644
                           aReferrerURI,
                           aLoadGroup,
                           mAcceptHeader,
-@@ -1627,8 +1661,8 @@ NS_IMETHODIMP imgLoader::LoadImage(nsIURI *aURI,
+@@ -1627,8 +1662,8 @@ NS_IMETHODIMP imgLoader::LoadImage(nsIURI *aURI,
          do_CreateInstance(NS_LOADGROUP_CONTRACTID);
      newChannel->SetLoadGroup(loadGroup);
  
@@ -557,7 +566,7 @@ index ea51e8d..4d5cfd2 100644
  
      // Pass the inner window ID of the loading document, if possible.
      nsCOMPtr<nsIDocument> doc = do_QueryInterface(aCX);
-@@ -1676,7 +1710,7 @@ NS_IMETHODIMP imgLoader::LoadImage(nsIURI *aURI,
+@@ -1676,7 +1711,7 @@ NS_IMETHODIMP imgLoader::LoadImage(nsIURI *aURI,
      }
  
      // Try to add the new request into the cache.
@@ -566,7 +575,7 @@ index ea51e8d..4d5cfd2 100644
    } else {
      LOG_MSG_WITH_PARAM(gImgLog, 
                         "imgLoader::LoadImage |cache hit|", "request", request);
-@@ -1736,6 +1770,49 @@ NS_IMETHODIMP imgLoader::LoadImage(nsIURI *aURI,
+@@ -1736,6 +1771,49 @@ NS_IMETHODIMP imgLoader::LoadImage(nsIURI *aURI,
    return NS_OK;
  }
  
@@ -616,7 +625,7 @@ index ea51e8d..4d5cfd2 100644
  /* imgIRequest loadImageWithChannel(in nsIChannel channel, in imgIDecoderObserver aObserver, in nsISupports cx, out nsIStreamListener); */
  NS_IMETHODIMP imgLoader::LoadImageWithChannel(nsIChannel *channel, imgIDecoderObserver *aObserver, nsISupports *aCX, nsIStreamListener **listener, imgIRequest **_retval)
  {
-@@ -1746,22 +1823,27 @@ NS_IMETHODIMP imgLoader::LoadImageWithChannel(nsIChannel *channel, imgIDecoderOb
+@@ -1746,22 +1824,27 @@ NS_IMETHODIMP imgLoader::LoadImageWithChannel(nsIChannel *channel, imgIDecoderOb
    nsCOMPtr<nsIURI> uri;
    channel->GetURI(getter_AddRefs(uri));
  
@@ -649,7 +658,7 @@ index ea51e8d..4d5cfd2 100644
  
      if (cache.Get(spec, getter_AddRefs(entry)) && entry) {
        // We don't want to kick off another network load. So we ask
-@@ -1833,7 +1915,7 @@ NS_IMETHODIMP imgLoader::LoadImageWithChannel(nsIChannel *channel, imgIDecoderOb
+@@ -1833,7 +1916,7 @@ NS_IMETHODIMP imgLoader::LoadImageWithChannel(nsIChannel *channel, imgIDecoderOb
      channel->GetOriginalURI(getter_AddRefs(originalURI));
  
      // No principal specified here, because we're not passed one.
@@ -658,7 +667,7 @@ index ea51e8d..4d5cfd2 100644
                    aCX, nullptr, imgIRequest::CORS_NONE);
  
      ProxyListener *pl = new ProxyListener(static_cast<nsIStreamListener *>(request.get()));
-@@ -1845,7 +1927,7 @@ NS_IMETHODIMP imgLoader::LoadImageWithChannel(nsIChannel *channel, imgIDecoderOb
+@@ -1845,7 +1928,7 @@ NS_IMETHODIMP imgLoader::LoadImageWithChannel(nsIChannel *channel, imgIDecoderOb
      NS_RELEASE(pl);
  
      // Try to add the new request into the cache.
@@ -667,7 +676,7 @@ index ea51e8d..4d5cfd2 100644
  
      rv = CreateNewProxyForRequest(request, loadGroup, aObserver,
                                    requestFlags, nullptr, _retval);
-@@ -2132,6 +2214,7 @@ NS_IMETHODIMP imgCacheValidator::OnStartRequest(nsIRequest *aRequest, nsISupport
+@@ -2132,6 +2215,7 @@ NS_IMETHODIMP imgCacheValidator::OnStartRequest(nsIRequest *aRequest, nsISupport
  
    int32_t corsmode = mRequest->GetCORSMode();
    nsCOMPtr<nsIPrincipal> loadingPrincipal = mRequest->GetLoadingPrincipal();
@@ -675,7 +684,7 @@ index ea51e8d..4d5cfd2 100644
  
    // Doom the old request's cache entry
    mRequest->RemoveFromCache();
-@@ -2142,16 +2225,16 @@ NS_IMETHODIMP imgCacheValidator::OnStartRequest(nsIRequest *aRequest, nsISupport
+@@ -2142,16 +2226,16 @@ NS_IMETHODIMP imgCacheValidator::OnStartRequest(nsIRequest *aRequest, nsISupport
    // We use originalURI here to fulfil the imgIRequest contract on GetURI.
    nsCOMPtr<nsIURI> originalURI;
    channel->GetOriginalURI(getter_AddRefs(originalURI));





More information about the tor-commits mailing list