Bug 1087442 - Attach LoadInfo inside each individual ProtocolHandler - chrome/ changes (r=sicking)
☠☠ backed out by bb7e85f193b8 ☠ ☠
authorChristoph Kerschbaumer <mozilla@christophkerschbaumer.com>
Thu, 11 Dec 2014 20:45:43 -0800
changeset 246886 0b5b07cfef0eb9c5dbe89f566f29a4616267acd9
parent 246885 2931c35342a4c0c57f6388c85752dae21ed43c4e
child 246887 a2c76343f7a9efdb6e6a75d446f987ef4cc857b6
push id698
push userjlund@mozilla.com
push dateMon, 23 Mar 2015 22:08:11 +0000
treeherdermozilla-release@b0c0ae7b02a3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssicking
bugs1087442
milestone37.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1087442 - Attach LoadInfo inside each individual ProtocolHandler - chrome/ changes (r=sicking)
chrome/nsChromeProtocolHandler.cpp
--- a/chrome/nsChromeProtocolHandler.cpp
+++ b/chrome/nsChromeProtocolHandler.cpp
@@ -95,17 +95,17 @@ nsChromeProtocolHandler::NewURI(const ns
     surl->SetMutable(false);
 
     NS_ADDREF(*result = url);
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsChromeProtocolHandler::NewChannel2(nsIURI* aURI,
-                                     nsILoadInfo* aLoadinfo,
+                                     nsILoadInfo* aLoadInfo,
                                      nsIChannel** aResult)
 {
     nsresult rv;
 
     NS_ENSURE_ARG_POINTER(aURI);
     NS_PRECONDITION(aResult, "Null out param");
 
 #ifdef DEBUG
@@ -142,22 +142,32 @@ nsChromeProtocolHandler::NewChannel2(nsI
 #ifdef DEBUG
         nsAutoCString spec;
         aURI->GetSpec(spec);
         printf("Couldn't convert chrome URL: %s\n", spec.get());
 #endif
         return rv;
     }
 
-    nsCOMPtr<nsIIOService> ioServ(do_GetIOService(&rv));
+    // Bug 1087720 (and Bug 1099296):
+    // Once all callsites have been updated to call NewChannel2() instead of NewChannel()
+    // we should have a non-null loadInfo consistently. Until then we have to branch on the
+    // loadInfo.
+    if (aLoadInfo) {
+        rv = NS_NewChannelInternal(getter_AddRefs(result),
+                                   resolvedURI,
+                                   aLoadInfo);
+    }
+    else {
+        nsCOMPtr<nsIIOService> ioServ(do_GetIOService(&rv));
+        NS_ENSURE_SUCCESS(rv, rv);
+        rv = ioServ->NewChannelFromURI(resolvedURI, getter_AddRefs(result));
+    }
     NS_ENSURE_SUCCESS(rv, rv);
 
-    rv = ioServ->NewChannelFromURI(resolvedURI, getter_AddRefs(result));
-    if (NS_FAILED(rv)) return rv;
-
 #ifdef DEBUG
     nsCOMPtr<nsIFileChannel> fileChan(do_QueryInterface(result));
     if (fileChan) {
         nsCOMPtr<nsIFile> file;
         fileChan->GetFile(getter_AddRefs(file));
 
         bool exists = false;
         file->Exists(&exists);