Skip to content

Commit

Permalink
[iOS] Close JS dialogs when a new navigation starts
Browse files Browse the repository at this point in the history
This CL closes any JS dialogs left behind by the previous
page when a new navigation starts, since these are no
longer relevant to the user.

Bug: 1373025
Change-Id: I8bec157bf2cd83a9a15f9b83ecad2e89820e7b6a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3954143
Commit-Queue: Ali Juma <[email protected]>
Reviewed-by: Gauthier Ambard <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1059942}
  • Loading branch information
alijuma authored and Chromium LUCI CQ committed Oct 17, 2022
1 parent 12d50ce commit 2d0d1fc
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ios/web/web_state/web_state_impl_realized_web_state.mm
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,10 @@

void WebStateImpl::RealizedWebState::OnNavigationStarted(
NavigationContextImpl* context) {
// When a navigation starts, immediately close any visible dialogs to avoid
// confusion about the origin of a dialog.
ClearDialogs();

// Navigation manager loads internal URLs to restore session history and
// create back-forward entries for WebUI. Do not trigger external callbacks.
if ([CRWErrorPageHelper isErrorPageFileURL:context->GetUrl()] ||
Expand Down

0 comments on commit 2d0d1fc

Please sign in to comment.