Chromium Code Reviews| Index: net/proxy/proxy_service.cc |
| diff --git a/net/proxy/proxy_service.cc b/net/proxy/proxy_service.cc |
| index 48cbadb352fce8624bc02b9cb0bfe9bcd5cc4a07..c868a3d2cc4b0b3a78e6e8e9c4f43dbf1407a245 100644 |
| --- a/net/proxy/proxy_service.cc |
| +++ b/net/proxy/proxy_service.cc |
| @@ -880,6 +880,10 @@ class ProxyService::PacRequest |
| int QueryDidComplete(int result_code) { |
| DCHECK(!was_cancelled()); |
| + // Clear |resolve_job_| so is_started() returns false while |
| + // DidFinishResolvingProxy() runs. |
| + resolve_job_ = nullptr; |
| + |
| // Note that DidFinishResolvingProxy might modify |results_|. |
| int rv = service_->DidFinishResolvingProxy(url_, load_flags_, |
| network_delegate_, results_, |
| @@ -894,7 +898,6 @@ class ProxyService::PacRequest |
| results_->proxy_resolve_end_time_ = TimeTicks::Now(); |
| // Reset the state associated with in-progress-resolve. |
| - resolve_job_ = NULL; |
| config_id_ = ProxyConfig::kInvalidConfigID; |
| config_source_ = PROXY_CONFIG_SOURCE_UNKNOWN; |
| @@ -1411,6 +1414,22 @@ int ProxyService::DidFinishResolvingProxy(const GURL& url, |
| net_log.AddEventWithNetErrorCode( |
| NetLog::TYPE_PROXY_SERVICE_RESOLVED_PROXY_LIST, result_code); |
| + if (result_code == ERR_PAC_SCRIPT_TERMINATED) { |
| + // If the ProxyResolver crashed, force it to be re-initialized for the |
| + // next request by resetting the proxy config. If there are other |
| + // requests, trigger the recreation immediately so those requests retry. |
| + bool requests_in_progress = false; |
| + for (const auto& request : pending_requests_) { |
| + if (request->is_started()) { |
|
eroman
2015/04/15 00:56:52
why not reset the config whenever there are reques
Sam McNally
2015/04/15 04:35:56
Done.
|
| + requests_in_progress = true; |
| + break; |
| + } |
| + } |
| + ResetProxyConfig(false); |
| + if (requests_in_progress) |
| + ApplyProxyConfigIfAvailable(); |
| + } |
| + |
| if (!config_.pac_mandatory()) { |
|
eroman
2015/04/15 00:56:52
config_ should not be tested and relied upon after
Sam McNally
2015/04/15 04:35:56
Done.
|
| // Fall-back to direct when the proxy resolver fails. This corresponds |
| // with a javascript runtime error in the PAC script. |