Bug 451572 - Allow prefetching between all combinations of HTTP and HTTPS
source and target
r+sr=bzbarsky
--- 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));