From 33004757156ed47e3bea007b0731fb03c22ae8b5 Mon Sep 17 00:00:00 2001 From: Eugene But Date: Wed, 30 Jan 2019 01:35:42 +0000 Subject: [PATCH] Call WebState::WasHidden on Tab removal. The primary purpose of this CL is to fix a bug, when Download Manager UI persists after closing and reopening a tab. There is an alternative fix which is to dismiss Download Manager UI in DownloadManagerTabHelper::WebStateWasDestroyed, but calling WebState::WasHidden for closed WebState sounds like the right approach in general. TBR=eugenebut@chromium.org (cherry picked from commit 6ebb32779d7f6109b46c5298a606d442b617d7a4) Bug: 919974 Change-Id: I204514995d616297b0745763dcd5acc21afef678 Reviewed-on: https://chromium-review.googlesource.com/c/1433497 Auto-Submit: Eugene But Reviewed-by: edchin Commit-Queue: Eugene But Cr-Original-Commit-Position: refs/heads/master@{#626608} Reviewed-on: https://chromium-review.googlesource.com/c/1444140 Reviewed-by: Eugene But Cr-Commit-Position: refs/branch-heads/3683@{#56} Cr-Branched-From: e51029943e0a38dd794b73caaf6373d5496ae783-refs/heads/master@{#625896} --- ios/chrome/browser/ui/browser_view_controller.mm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ios/chrome/browser/ui/browser_view_controller.mm b/ios/chrome/browser/ui/browser_view_controller.mm index 59933f33fe37..df91974b0f98 100644 --- a/ios/chrome/browser/ui/browser_view_controller.mm +++ b/ios/chrome/browser/ui/browser_view_controller.mm @@ -4529,6 +4529,8 @@ - (void)tabModel:(TabModel*)model - (void)tabModel:(TabModel*)model didRemoveTab:(Tab*)tab atIndex:(NSUInteger)index { + tab.webState->WasHidden(); + [self uninstallDelegatesForTab:tab]; // Cancel dialogs for |tab|'s WebState.