AssociateWindows is currently assuming that there are only two cases native data can be in. Either we have a tabbed window and we can trust native data, or there is no tabbed window and we cannot trust native data. However, sometimes we can have a tabbed window with the correct nubmer of tabs, but they're all null. We're currently skipping those right here:
https://cs.chromium.org/chromium/src/components/sync_sessions/sessions_sync_manager.cc?l=353&rcl=73765eea7390f0cd038191396c9df4535ad48581
The problem with that is that they're not added to the header, ophaning/deleting them all. This is a problem because sometimes this can happen to all main-chrome-window tabs on Android. To repro:
1. Sync between Android device and another device
2. Open several tabs in main Chrome window on Android.
3. Open a custom tab.
4. Make sure you see custom tab and main windows on other device.
5. Close Chrome on Andorid.
6. Browse in custom tab, wait for it to that sync.
7. Open and close real Chrome on Android very quickly.
8. Browse in custom tab, wait for it to sync.
9. Other device should only show the custom tab, even though they're still present in the Android's Chrome.
Should be able to just check that we have at least 1 non-null tab when looking for a tabbed window.
Comment 1 by s...@chromium.org
, Jan 3 2018