0

[ios] Set ClearBrowsingDataTableViewController and its NavigationController to nil immediately after completing dismiss

When a URL is opened, CBD dismisses itself. Then History checks with the CBD coordinator to make sure that CBD is dismissed (nav controller is nil) before dismissing itself. Since we don't set the navController to nil before calling the completion block in dismissClearBrowsingDataWithCompletion:, the CBD coordinator thinks that it still exists so it attempts `[self dismissClearBrowsingDataWithCompletion:completionHandler];`, which then doesn't execute the completion block since there was nothing to dismiss.

Video: https://drive.google.com/open?id=1A7-W5LXhjzvh4DcUQguQEv0qWC88Ncp1

Bug: 877243

Change-Id: Id2f67c934e0ef2033abc28f97bb9bf211dbb5ddb
Reviewed-on: https://chromium-review.googlesource.com/1187631
Reviewed-by: Sergio Collazos <sczs@chromium.org>
Commit-Queue: Chris Lu <thegreenfrog@chromium.org>
Cr-Commit-Position: refs/heads/master@{#585857}
This commit is contained in:
Chris Lu
2018-08-24 15:55:38 +00:00
committed by Commit Bot
parent f7610825f0
commit 40b6cd645a

@ -101,12 +101,19 @@
[self.historyClearBrowsingDataNavigationController
dismissViewControllerAnimated:YES
completion:^() {
if (completionHandler) {
completionHandler();
}
// completionHandler might trigger
// dismissHistoryWithCompletion, which will call
// stopWithCompletion:, so
// historyClearBrowsingDataNavigationController needs
// to be nil, otherwise stopWithCompletion: will call
// dismiss with nothing to dismiss and therefore not
// trigger its own completionHandler.
self.clearBrowsingDataTableViewController = nil;
self.historyClearBrowsingDataNavigationController =
nil;
if (completionHandler) {
completionHandler();
}
}];
}