[iOS Shortcuts] Fix opening multiple URLs when tab switcher is empty
When opening multiple URLs via Siri Shortcuts while the tab switcher was opened and empty, only the first 3 URLs were successfully opened. The cause is as follows: - URL 1 opens and causes the tab switcher to dismiss asynchronously, but callback 1 is still run immediately - Callback 1 causes URL 2 to start opening, but it must wait for the dismiss animation to finish, so callback 2 is stored in the BVC properties - Callback 2 eventually runs, and does two things: 1) open URL 3 2) append callback 3 to the BVC tab opening callbacks - Immediately after callback 2 finishes running, the BVC clears its callback property, erasing callback 3 that was just set by callback 2 - URL 3 is opened by callback 2, but callback 3 is never run because by the time the BVC tries to invoke the tab opening callback, it was already set to nil after running callback 2 The simplest fix I found is to simply clear the callback property before running the callback (the callback is stored to a local var before clearing the property). That way, callbacks can append new tab opening callbacks without fear of them being erased. Bug: 1124291 Change-Id: Ib3684f4ce93136c28bb55711b4a5742510082302 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2405897Reviewed-by:Olivier Robin <olivierrobin@chromium.org> Reviewed-by:
Mark Cogan <marq@chromium.org> Reviewed-by:
Justin Cohen <justincohen@chromium.org> Commit-Queue: Guillaume Jenkins <gujen@google.com> Cr-Commit-Position: refs/heads/master@{#807487}
Showing
Please register or sign in to comment