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.

(cherry picked from commit 2d0d1fc)

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-Original-Commit-Position: refs/heads/main@{#1059942}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3963294
Commit-Queue: Rubber Stamper <[email protected]>
Bot-Commit: Rubber Stamper <[email protected]>
Auto-Submit: Ali Juma <[email protected]>
Cr-Commit-Position: refs/branch-heads/5359@{#57}
Cr-Branched-From: 27d3765-refs/heads/main@{#1058933}
  • Loading branch information
alijuma authored and Chromium LUCI CQ committed Oct 18, 2022
1 parent da9b478 commit 1327191
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 1327191

Please sign in to comment.