Close the Zoom Bubble when its WebContents is destroyed or hidden.
ZoomBubbleView has a raw, weak pointer to WebContents which can result in lifetime problems. On Mac, a UAF can result. Elsewhere, the result is typically a deleted pointer being passed to FindBrowserWithWebContents (which is less likely to cause badness). Also on Mac currently, the zoom bubble isn't immediately hidden on tab switch. This is because Cocoa bubbles are managed by base_bubble_controller.mm in a general way: it observes the tab strip via a bridge and dismisses a bubble of whatever type is currently showing. However, views bubbles can not opt into this framework. On other platforms, BrowserView explicitly closes the zoom bubble on tab switch. Most other views bubbles observe WebContentsObserver::WasHidden(), so do the same for the zoom bubble. And test. Bug: 791907, 404979 Change-Id: I36d174530423dbcdb7f93d5e3a575ce07f74d8e7 Reviewed-on: https://chromium-review.googlesource.com/848113 Commit-Queue: Trent Apted <tapted@chromium.org> Reviewed-by:Peter Kasting <pkasting@chromium.org> Cr-Commit-Position: refs/heads/master@{#526878}
Showing
Please register or sign in to comment