Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(193)

Unified Diff: ios/chrome/browser/passwords/password_controller.mm

Issue 1967473002: PasswordController should give up on WebState destruction (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2661
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/passwords/password_controller.mm
diff --git a/ios/chrome/browser/passwords/password_controller.mm b/ios/chrome/browser/passwords/password_controller.mm
index 1938757d5af90ad507bb7f9f11041de8b2e5c704..f6cabb7e6df4e793b13d2e59d8fa06549ebac57c 100644
--- a/ios/chrome/browser/passwords/password_controller.mm
+++ b/ios/chrome/browser/passwords/password_controller.mm
@@ -48,6 +48,13 @@ using password_manager::PasswordManager;
using password_manager::PasswordManagerClient;
using password_manager::PasswordManagerDriver;
+@interface PasswordController ()
+
+// This is set to YES as soon as the associated WebState is destroyed.
+@property(readonly) BOOL isWebStateDestroyed;
+
+@end
+
@interface PasswordController ()<CRWWebStateObserver, FormSuggestionProvider>
// Parses the |jsonString| which contatins the password forms found on a web
@@ -242,6 +249,8 @@ bool GetPageURLAndCheckTrustLevel(web::WebState* web_state, GURL* page_url) {
scoped_ptr<web::WebStateObserverBridge> webStateObserverBridge_;
}
+@synthesize isWebStateDestroyed = isWebStateDestroyed_;
+
- (instancetype)initWithWebState:(web::WebState*)webState
passwordsUiDelegate:(id<PasswordsUiDelegate>)UIDelegate {
DCHECK(webState);
@@ -364,7 +373,7 @@ bool GetPageURLAndCheckTrustLevel(web::WebState* web_state, GURL* page_url) {
// the race.
// TODO(crbug.com/418827): Fix this by passing in more data from the JS side.
id completionHandler = ^(BOOL found, const autofill::PasswordForm& form) {
- if (weakSelf) {
+ if (weakSelf && ![weakSelf isWebStateDestroyed]) {
weakSelf.get()->passwordManager_->OnPasswordFormSubmitted(
weakSelf.get()->passwordManagerDriver_.get(), form);
}
@@ -374,6 +383,7 @@ bool GetPageURLAndCheckTrustLevel(web::WebState* web_state, GURL* page_url) {
}
- (void)webStateDestroyed:(web::WebState*)webState {
+ isWebStateDestroyed_ = YES;
[self detach];
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698