URLRequestJob::GetResponseCode returns the response code for a request. Intuitively, it should be the same as URLRequest::response_info()->headers->GetResponseCode()...However, this is not the case. For URLRequestHttpJob, it's set before response_info(), and this behavior is externally observable - it's set to the response code before the URLRequest's ResponseInfo is set, and the difference can be noticed during the NetworkDelegate::OnHeadersReceived call. It also crashes when there is a ResponseInfo but no headers (Instead of, say, returning -1, which it does for other URLRequestJob types without headers).
This is weird and unexpected. We should work towards being able to get rid of the method, and making URLRequest::GetResponseCode just grab it from URLRequest's ResponseInfo call.
Comment 1 by mmenke@chromium.org
, Feb 3 2017