[WebLayer Shell] Fix call into nullptr when tab is removed
WebLayer Shell listens for notifications that the active tab was changed and updates the favicon of the active tab in response. However, when the active tab is removed WebLayer sets the active tab to null, which also causes an onActiveTabChanged(null) notification to be sent (cf. [1]). WebLayerShellActivity does not currently guard against this case (cf. [2]), resulting in a crash. One way to trigger this crash is to open a tab via a navigation that results in an intent launch, which will then cause the tab to be closed. Concrete example: On a device/emulator with the Play Store installed, go to booking.com and click on the Install icon. This will open a new tab for a navigation that results in an intent out to the play store, upon which WebLayer closes the newly-opened tab and the onActiveTabChanged(null) callback is sent. [1] https://source.chromium.org/chromium/chromium/src/+/master:weblayer/browser/browser_impl.cc;l=403?q=browser_impl.cc&ss=chromium [2] https://source.chromium.org/chromium/chromium/src/+/master:weblayer/shell/android/shell_apk/src/org/chromium/weblayer/shell/WebLayerShellActivity.java;l=697?q=WebLayerShellActivity.java&ss=chromium Bug: 1128607 Change-Id: I787824deeb4a3fea49f52f430c6523bed5258f1d Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2414399 Commit-Queue: Scott Violet <sky@chromium.org> Reviewed-by:Scott Violet <sky@chromium.org> Cr-Commit-Position: refs/heads/master@{#808526}
Showing
Please register or sign in to comment