fix: Lifetime of auth_info_ in login handler (#15042)

This commit is contained in:
Nitish Sakhawalkar 2018-10-09 16:50:44 -07:00 committed by Samuel Attard
parent 36ee83875a
commit 185fe6ced9
2 changed files with 3 additions and 3 deletions

View file

@ -25,7 +25,7 @@ LoginHandler::LoginHandler(
net::AuthCredentials* credentials, net::AuthCredentials* credentials,
const content::ResourceRequestInfo* resource_request_info) const content::ResourceRequestInfo* resource_request_info)
: credentials_(credentials), : credentials_(credentials),
auth_info_(auth_info), auth_info_(&auth_info),
auth_callback_(std::move(callback)), auth_callback_(std::move(callback)),
weak_factory_(this) { weak_factory_(this) {
DCHECK_CURRENTLY_ON(BrowserThread::IO); DCHECK_CURRENTLY_ON(BrowserThread::IO);

View file

@ -40,7 +40,7 @@ class LoginHandler : public base::RefCountedThreadSafe<LoginHandler> {
// thread. // thread.
content::WebContents* GetWebContents() const; content::WebContents* GetWebContents() const;
const net::AuthChallengeInfo* auth_info() const { return &auth_info_; } const net::AuthChallengeInfo* auth_info() const { return auth_info_.get(); }
private: private:
friend class base::RefCountedThreadSafe<LoginHandler>; friend class base::RefCountedThreadSafe<LoginHandler>;
@ -56,7 +56,7 @@ class LoginHandler : public base::RefCountedThreadSafe<LoginHandler> {
net::AuthCredentials* credentials_; net::AuthCredentials* credentials_;
// Who/where/what asked for the authentication. // Who/where/what asked for the authentication.
const net::AuthChallengeInfo& auth_info_; scoped_refptr<const net::AuthChallengeInfo> auth_info_;
// WebContents associated with the login request. // WebContents associated with the login request.
content::ResourceRequestInfo::WebContentsGetter web_contents_getter_; content::ResourceRequestInfo::WebContentsGetter web_contents_getter_;