Bug 1282750 - Convert AboutCache to use AsyncOpen2() r=honza,a=lizzard FIREFOX_49_0_2_BUILD2 FIREFOX_49_0_2_RELEASE
authorChristoph Kerschbaumer <ckerschb@christophkerschbaumer.com>
Wed, 29 Jun 2016 15:42:13 +0200
changeset 433616 7356baae8e736a6c9444bdd21562df806a39766b
parent 433615 ea6157b86ae2b200ca3433d462516bf75559e056
child 433617 cdb23b9684eee0a58ce69e13c75dd42be982005e
push id34626
push usercpearce@mozilla.com
push dateFri, 04 Nov 2016 03:43:53 +0000
reviewershonza, lizzard
bugs1282750
milestone49.0.2
Bug 1282750 - Convert AboutCache to use AsyncOpen2() r=honza,a=lizzard
netwerk/protocol/about/nsAboutCache.cpp
--- a/netwerk/protocol/about/nsAboutCache.cpp
+++ b/netwerk/protocol/about/nsAboutCache.cpp
@@ -141,48 +141,42 @@ NS_IMETHODIMP nsAboutCache::Channel::Asy
     if (!mChannel) {
         return NS_ERROR_UNEXPECTED;
     }
 
     // Kick the walk loop.
     rv = VisitNextStorage();
     if (NS_FAILED(rv)) return rv;
 
-    rv = mChannel->AsyncOpen(aListener, aContext);
+    MOZ_ASSERT(!aContext, "asyncOpen2() does not take a context argument");
+
+    nsCOMPtr<nsILoadInfo> loadInfo = mChannel->GetLoadInfo();
+    if (loadInfo && loadInfo->GetSecurityMode() != 0) {
+      rv = mChannel->AsyncOpen2(aListener);
+    } else {
+      rv = mChannel->AsyncOpen(aListener, nullptr);
+    }
     if (NS_FAILED(rv)) return rv;
 
     return NS_OK;
 }
 
 NS_IMETHODIMP nsAboutCache::Channel::AsyncOpen2(nsIStreamListener *aListener)
 {
     return AsyncOpen(aListener, nullptr);
 }
 
 NS_IMETHODIMP nsAboutCache::Channel::Open(nsIInputStream * *_retval)
 {
-    nsresult rv;
-
-    if (!mChannel) {
-        return NS_ERROR_UNEXPECTED;
-    }
-
-    // Kick the walk loop.
-    rv = VisitNextStorage();
-    if (NS_FAILED(rv)) return rv;
-
-    rv = mChannel->Open(_retval);
-    if (NS_FAILED(rv)) return rv;
-
-    return NS_OK;
+    return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP nsAboutCache::Channel::Open2(nsIInputStream * *_retval)
 {
-    return Open(_retval);
+    return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 nsresult
 nsAboutCache::Channel::ParseURI(nsIURI * uri, nsACString & storage)
 {
     //
     // about:cache[?storage=<storage-name>[&context=<context-key>]]
     //