• Sylvain Defresne's avatar
    [ios] Fix loss of incognito tabs on app startup · 44093fc8
    Sylvain Defresne authored
    A single boolean was used to save whether the UI was showing incognito
    or regular UI, however with multi-window enabled, each window can be
    displaying a different UI.
    
    This global was read on launch to decide whether incognito UI should
    be displayed or not. If the window in the foreground when the app was
    terminated was showing incognito UI, but user start the app by opening
    a window with no incognito tab, the startup code would consider this
    an inconsistency, delete all incognito state and switch to regular UI.
    
    This behaviour is incorrect when multi-window is enabled and can lead
    to losing the incognito tabs on app startup. To fix this, convert the
    bool indicating whether the UI was showing incognito or regular tabs
    to be per-session (i.e. per window).
    
    Also in case of inconsistency (which can still happen if user quit
    the app while showing the incognito tab switcher after having closed
    the last incognito tab of the current window), do *not* clear the
    incognito data (it will only be cleared when the app restart after a
    crash).
    
    Bug: 1163505
    Change-Id: I8410acf6f8feadb747d01889a2812e91d5391709
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2611101
    Commit-Queue: Sylvain Defresne <sdefresne@chromium.org>
    Reviewed-by: default avatarStepan Khapugin <stkhapugin@chromium.org>
    Reviewed-by: default avatarMohammad Refaat <mrefaat@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#842098}
    44093fc8
scene_state.mm 10.1 KB