[go: up one dir, main page]

[m76] webauth: fix a AuthenticatorRequestDialogView regression

CL:1562215 allowed the WebAuthn UI to be hidden mid request while e.g.
the native Touch ID or Windows WebAuthn UIs are shown.
AuthenticatorRequestDialogModel determines whether for the current step,
the UI should be visible or hidden. AuthenticatorRequestDialogView in
turn would read that information for every step change and call
Widget::Show() or Widget::Hide() accordingly.

This caused a bug with the dialogs modal-ness. The dialog is supposed to
be modal to its tab, which is ensured by calling
constrained_window::ShowWebModalDialogViews() with the tab's top-level
WebContents. However, calling Show() on the dialog's widget while the
parent tab is in background will make it appear as a child to the
then-current tab.

It appears that the visibility of a web-modal dialog is controlled by
WebContentsModalDialogManager, which is a WebContentsObserver to the
WebContents that the dialog is modal to. It observes the WebContents
becoming shown/hidden and in turn shows/hides its managed dialogs
accordingly. AuthenticatorRequestDialogView calling Show() on its widget
seems to interfere with that.

As a workaround, make AuthenticatorRequestDialogView also observe its
WebContents' visibility and have it not call Widget::Show() while the
WebContents is hidden; then catch up once the WebContents becomes
visible again.

(cherry picked from commit f85e659b61f9551b65cf5b2f2c20aa2c53b307ce)

Bug: 969153
Change-Id: I15655b60604c5dfe7f536ae6f7cb3ffafead514d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1654235
Commit-Queue: Martin Kreichgauer <martinkr@google.com>
Reviewed-by: Adam Langley <agl@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#668921}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1663348
Reviewed-by: Martin Kreichgauer <martinkr@google.com>
Cr-Commit-Position: refs/branch-heads/3809@{#384}
Cr-Branched-From: d82dec1a818f378c464ba307ddd9c92133eac355-refs/heads/master@{#665002}
2 files changed