Bug 451572 - Allow prefetching between all combinations of HTTP and HTTPS
authorChristian Biesinger <cbiesinger@gmail.com>
Tue, 30 Sep 2008 10:53:48 +0200
changeset 19909 ecf324f616d254621b2551d258b1599af58c05ee
parent 19908 1c681814281d68baac8110aedb6f83fc48614ed4
child 19910 86b982e8b73e58cea334e9d80344311729463706
child 19934 fa472fbd399ecc42033a2c4235173611dc237037
push id2538
push usercbiesinger@gmail.com
push dateTue, 30 Sep 2008 08:54:16 +0000
treeherdermozilla-central@ecf324f616d2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs451572
milestone1.9.1b1pre
Bug 451572 - Allow prefetching between all combinations of HTTP and HTTPS source and target r+sr=bzbarsky
uriloader/prefetch/nsPrefetchService.cpp
--- a/uriloader/prefetch/nsPrefetchService.cpp
+++ b/uriloader/prefetch/nsPrefetchService.cpp
@@ -373,18 +373,21 @@ nsPrefetchNode::OnChannelRedirect(nsICha
         return rv;
 
     nsCOMPtr<nsICachingChannel> oldCachingChannel =
         do_QueryInterface(aOldChannel);
 
     PRBool match;
     rv = newURI->SchemeIs("http", &match); 
     if (NS_FAILED(rv) || !match) {
-        LOG(("rejected: URL is not of type http\n"));
-        return NS_ERROR_ABORT;
+        rv = newURI->SchemeIs("https", &match); 
+        if (NS_FAILED(rv) || !match) {
+            LOG(("rejected: URL is not of type http/https\n"));
+            return NS_ERROR_ABORT;
+        }
     }
 
     // HTTP request headers are not automatically forwarded to the new channel.
     nsCOMPtr<nsIHttpChannel> httpChannel = do_QueryInterface(aNewChannel);
     NS_ENSURE_STATE(httpChannel);
 
     httpChannel->SetRequestHeader(NS_LITERAL_CSTRING("X-Moz"),
                                   NS_LITERAL_CSTRING("prefetch"),
@@ -683,29 +686,31 @@ nsPrefetchService::Prefetch(nsIURI *aURI
     //
     // XXX we might want to either leverage nsIProtocolHandler::protocolFlags
     // or possibly nsIRequest::loadFlags to determine if this URI should be
     // prefetched.
     //
     PRBool match;
     rv = aURI->SchemeIs("http", &match); 
     if (NS_FAILED(rv) || !match) {
+        rv = aURI->SchemeIs("https", &match); 
         if (NS_FAILED(rv) || !match) {
-            LOG(("rejected: URL is not of type http\n"));
+            LOG(("rejected: URL is not of type http/https\n"));
             return NS_ERROR_ABORT;
         }
     }
 
     // 
     // the referrer URI must be http:
     //
     rv = aReferrerURI->SchemeIs("http", &match);
     if (NS_FAILED(rv) || !match) {
+        rv = aReferrerURI->SchemeIs("https", &match);
         if (NS_FAILED(rv) || !match) {
-            LOG(("rejected: referrer URL is not of type http\n"));
+            LOG(("rejected: referrer URL is neither http nor https\n"));
             return NS_ERROR_ABORT;
         }
     }
 
     // skip URLs that contain query strings, except URLs for which prefetching
     // has been explicitly requested.
     if (!aExplicit) {
         nsCOMPtr<nsIURL> url(do_QueryInterface(aURI, &rv));