Bug 1370783 - use QI instead of static cast from nsIChannel to nsIRequest. r?smaug draft
authorShih-Chiang Chien <schien@mozilla.com>
Wed, 28 Jun 2017 10:48:00 -0700
changeset 601582 2e1d643e1b3c114b18250bf840234fdf439a898f
parent 601255 cc903e3f61894e60c3b0efaf05e9a446d1d85888
child 635316 1b97a3e0281fda8389736ad583f7b6b3a75623d0
push id66122
push userbmo:schien@mozilla.com
push dateWed, 28 Jun 2017 22:23:53 +0000
reviewerssmaug
bugs1370783
milestone56.0a1
Bug 1370783 - use QI instead of static cast from nsIChannel to nsIRequest. r?smaug MozReview-Commit-ID: A0rJgWTWvu9
docshell/base/nsDocShell.cpp
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -11160,17 +11160,18 @@ nsDocShell::DoURILoad(nsIURI* aURI,
           NS_ShouldCheckAppCache(principal));
       }
     }
   }
 
   // Make sure to give the caller a channel if we managed to create one
   // This is important for correct error page/session history interaction
   if (aRequest) {
-    NS_ADDREF(*aRequest = channel);
+    nsCOMPtr<nsIRequest> req = do_QueryInterface(channel);
+    req.forget(aRequest);
   }
 
   if (aOriginalURI) {
     channel->SetOriginalURI(aOriginalURI);
     // The LOAD_REPLACE flag and its handling here will be removed as part
     // of bug 1319110.  For now preserve its restoration here to not break
     // any code expecting it being set specially on redirected channels.
     // If the flag has originally been set to change result of