| Index: chrome/browser/net/predictor.cc
|
| diff --git a/chrome/browser/net/predictor.cc b/chrome/browser/net/predictor.cc
|
| index 9299b63358dec01e1bdd97292cf68ec474d075b8..aa852a6525a8adbd5ed86efe16393643a90912f4 100644
|
| --- a/chrome/browser/net/predictor.cc
|
| +++ b/chrome/browser/net/predictor.cc
|
| @@ -87,6 +87,9 @@ const int Predictor::kMaxSpeculativeResolveQueueDelayMs =
|
| (kExpectedResolutionTimeMs * Predictor::kTypicalSpeculativeGroupSize) /
|
| Predictor::kMaxSpeculativeParallelResolves;
|
|
|
| +// The default value of the credentials flag when preconnecting.
|
| +static bool kAllowCredentialsOnPreconnectByDefault = true;
|
| +
|
| static int g_max_queueing_delay_ms =
|
| Predictor::kMaxSpeculativeResolveQueueDelayMs;
|
| static size_t g_max_parallel_resolves =
|
| @@ -265,8 +268,9 @@ void Predictor::AnticipateOmniboxUrl(const GURL& url, bool preconnectable) {
|
| return; // We've done a preconnect recently.
|
| last_omnibox_preconnect_ = now;
|
| const int kConnectionsNeeded = 1;
|
| - PreconnectUrl(
|
| - CanonicalizeUrl(url), GURL(), motivation, kConnectionsNeeded);
|
| + PreconnectUrl(CanonicalizeUrl(url), GURL(), motivation,
|
| + kConnectionsNeeded,
|
| + kAllowCredentialsOnPreconnectByDefault);
|
| return; // Skip pre-resolution, since we'll open a connection.
|
| }
|
| } else {
|
| @@ -305,8 +309,8 @@ void Predictor::PreconnectUrlAndSubresources(const GURL& url,
|
|
|
| UrlInfo::ResolutionMotivation motivation(UrlInfo::EARLY_LOAD_MOTIVATED);
|
| const int kConnectionsNeeded = 1;
|
| - PreconnectUrl(CanonicalizeUrl(url), first_party_for_cookies,
|
| - motivation, kConnectionsNeeded);
|
| + PreconnectUrl(CanonicalizeUrl(url), first_party_for_cookies, motivation,
|
| + kConnectionsNeeded, kAllowCredentialsOnPreconnectByDefault);
|
| PredictFrameSubresources(url.GetWithEmptyPath(), first_party_for_cookies);
|
| }
|
|
|
| @@ -840,19 +844,20 @@ void Predictor::SaveDnsPrefetchStateForNextStartupAndTrim(
|
| void Predictor::PreconnectUrl(const GURL& url,
|
| const GURL& first_party_for_cookies,
|
| UrlInfo::ResolutionMotivation motivation,
|
| - int count) {
|
| + int count,
|
| + bool allow_credentials) {
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI) ||
|
| BrowserThread::CurrentlyOn(BrowserThread::IO));
|
|
|
| if (BrowserThread::CurrentlyOn(BrowserThread::IO)) {
|
| - PreconnectUrlOnIOThread(url, first_party_for_cookies, motivation, count);
|
| + PreconnectUrlOnIOThread(url, first_party_for_cookies, motivation, count,
|
| + allow_credentials);
|
| } else {
|
| BrowserThread::PostTask(
|
| - BrowserThread::IO,
|
| - FROM_HERE,
|
| - base::Bind(&Predictor::PreconnectUrlOnIOThread,
|
| - base::Unretained(this), url, first_party_for_cookies,
|
| - motivation, count));
|
| + BrowserThread::IO, FROM_HERE,
|
| + base::Bind(&Predictor::PreconnectUrlOnIOThread, base::Unretained(this),
|
| + url, first_party_for_cookies, motivation, count,
|
| + allow_credentials));
|
| }
|
| }
|
|
|
| @@ -860,7 +865,8 @@ void Predictor::PreconnectUrlOnIOThread(
|
| const GURL& original_url,
|
| const GURL& first_party_for_cookies,
|
| UrlInfo::ResolutionMotivation motivation,
|
| - int count) {
|
| + int count,
|
| + bool allow_credentials) {
|
| // Skip the HSTS redirect.
|
| GURL url = GetHSTSRedirectOnIOThread(original_url);
|
|
|
| @@ -869,11 +875,8 @@ void Predictor::PreconnectUrlOnIOThread(
|
| url, first_party_for_cookies, motivation, count);
|
| }
|
|
|
| - PreconnectOnIOThread(url,
|
| - first_party_for_cookies,
|
| - motivation,
|
| - count,
|
| - url_request_context_getter_.get());
|
| + PreconnectOnIOThread(url, first_party_for_cookies, motivation, count,
|
| + url_request_context_getter_.get(), allow_credentials);
|
| }
|
|
|
| void Predictor::PredictFrameSubresources(const GURL& url,
|
| @@ -941,7 +944,8 @@ void Predictor::PrepareFrameSubresources(const GURL& original_url,
|
| // provide a more carefully estimated preconnection count.
|
| if (preconnect_enabled_) {
|
| PreconnectUrlOnIOThread(url, first_party_for_cookies,
|
| - UrlInfo::SELF_REFERAL_MOTIVATED, 2);
|
| + UrlInfo::SELF_REFERAL_MOTIVATED, 2,
|
| + kAllowCredentialsOnPreconnectByDefault);
|
| }
|
| return;
|
| }
|
| @@ -966,7 +970,8 @@ void Predictor::PrepareFrameSubresources(const GURL& original_url,
|
| if (url.host() == future_url->first.host())
|
| ++count;
|
| PreconnectUrlOnIOThread(future_url->first, first_party_for_cookies,
|
| - motivation, count);
|
| + motivation, count,
|
| + kAllowCredentialsOnPreconnectByDefault);
|
| } else if (connection_expectation > kDNSPreresolutionWorthyExpectedValue) {
|
| evalution = PRERESOLUTION;
|
| future_url->second.preresolution_increment();
|
|
|