Fix re-entrancy caused by RenderFrameHostImpl::DispatchBeforeUnload.
The method, on certain conditions, would simulate receiving a
OnBeforeUnloadACK() IPC. This would immediately call back into the unload
handler, which had just called RenderFrameHostImpl::DispatchBeforeUnload.
The problematic series of events is as follows:
1) TabStripModel::CloseWebContentses tries to close many tabs.
2) This calls RunUnloadListenerBeforeClosing() on each tab.
3) UnloadListener will call RenderFrameHostImpl::DispatchBeforeUnload, which
on certain conditions will synchronously call OnBeforeUnloadACK().
4) This calls back into TabStripModel, mutating internal state.
5) The implementation of TabStripModel::CloseWebContentses relies on the
assumption that there is no re-entrancy. This manifests itself as a buffer
overrun when (1) calls SendDetachWebContentsNotifications, which then
passes inconsistent data to the observers.
Bug: 851400
Change-Id: I2080875f5d8d118c93addbe66503cb02b8b2966f
Reviewed-on: https://chromium-review.googlesource.com/1101846
Commit-Queue: Erik Chen <erikchen@chromium.org>
Reviewed-by:
Charlie Reis <creis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#568534}
Showing
Please register or sign in to comment