• David Bokan's avatar
    [Portals] Disallow activation during unload · 5852bae1
    David Bokan authored
    This CL makes it so that portal activation is blocked when the document
    enters a beforeunload handler. If the unload proceeds, portal activation
    will continue to be blocked
    
    This must be implemented inside the renderer as the renderer can
    initiate navigations which the browser won't hear about until after
    beforeunload is confirmed. We do this by looking at the Document's
    LoadEventProgress state.
    
    Unfortunately, the current behavior is that, following a beforeunload,
    this state would progress unconditionally to
    kBeforeUnloadEventCompleted. This prevents us from distinguishing the
    case where the navigation is canceled, which should once again allow
    portal activation. This CL updates this state to only progress to the
    (renamed for consistency and clarity) kBeforeUnloadEventCompleted state
    only after we confirm the unload will proceed.
    
    Bug: 1043764
    Change-Id: I80363ccf2228e3dc5434486c95c62c17e00743aa
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2251104
    Commit-Queue: David Bokan <bokan@chromium.org>
    Reviewed-by: default avatarJeremy Roman <jbroman@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#780470}
    5852bae1
portal_browsertest.cc 92.1 KB