Ensure the renderer can reply to ClosePage with an ACK while closing.
When a renderer has an unload handler (which can be caused by opening devtools apparently), the browser sends a ClosePage IPC to the renderer when it requests to be closed, and waits for ClosePage_ACK before sending the WidgetMsg_Close IPC and closing the tab. When sending the ClosePage_ACK was moved to RenderViewImpl, the Send() method was changed when to stop sending IPCs. In RenderWidget it checked RenderWidget::closing_. But in RenderViewImpl it checks RenderWidget::is_closing(). These look the same but they were different, causing the ClosePage_ACK to never be sent. This CL rectifies the situation by making is_closing() simply return closing_, which restores the previous behaviour and allows browser-renderer interactions between the close request and the actual close action. The is_closing() included the host_will_close_this_ variable, which exists for a rather convoluted reason. When WebPagePopupImpl requests to be closed through the RenderWidget, it immediately destroys its Page object, and its main frame. That means the RenderWidget's WebWidget (which is the WebPagePopupImpl) becomes crashy and invalid after requesting to close. All the methods in the WebWidget API early out when page_ is null to handle this scenario. Except one, the GetURLForDebugTrace() method, which is called when making a LayerTreeFrameSink. To solve this problem in the past, rather than making this method early out (or whatever other method it was at that time), we made RenderWidget avoid making a LayerTreeFrameSink once a close has been requested, to indirectly avoid using the WebWidget. Now that we understand this area of code more fully, we can solve this at the site of the problem in WebPagePopupImpl, and early out in GetURLForDebugTrace() like we do in other WebWidget methods. That means we don't need host_will_close_this_. The mistake here was leaking the host_will_close_this_ state out of RenderWidget and using it for more than it was intended. But since we don't need the variable at all in its more narrow scope we remove it. R=avi@chromium.org Bug: 995123 Change-Id: Iaad83c7e3892908150672d9860a6db4307ffe432 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1814689Reviewed-by:Avi Drissman <avi@chromium.org> Reviewed-by:
enne <enne@chromium.org> Commit-Queue: danakj <danakj@chromium.org> Cr-Commit-Position: refs/heads/master@{#698531}
Showing
Please register or sign in to comment