New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 674318 link

Starred by 1 user

Issue metadata

Status: Untriaged
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Bug



Sign in to add a comment

WebContentsImpl might leak pending a WebContents* in some error cases

Project Member Reported by nick@chromium.org, Dec 14 2016

Issue description

WebContentsImpl::GetCreatedWindow has a "return nullptr" case that appears to leak the pending WebContents created by window.open(), if the process crashes at just the right moment.

This would occur if either of the following conditions caused the branch to be taken:

  if (!new_contents->GetMainFrame()->GetProcess()->HasConnection() ||
      !new_contents->GetMainFrame()->GetView()) {

GetProcess->HasConnection() seems unlikely, since we are in the middle of processing a message from exactly that process. I am not sure about the GetView() clause.

A leak may also be possible if the WebContents is closed while pending_contents_ is nonempty. This, also, should be exceptionally rare: the ShowCreatedWindow IPC is sent immediately after the CreateNewWindow IPC, but an intervening user action is possible here. This case ought to be reproducable in a browsertest modeled after SitePerProcessBrowserTest.TwoSubframesCreatePopupsSimultaneously

I believe that these cases can be solved by having pending_contents_ hold unique_ptrs<> to its WebContents instances.
 

Comment 1 by nick@chromium.org, Dec 14 2016

Summary: WebContentsImpl might leak pending a WebContents* in some error cases (was: WebContentsImpl might leak pending a WebContentses in some error cases)

Comment 2 by nick@chromium.org, Dec 14 2016

Description: Show this description
Project Member

Comment 3 by sheriffbot@chromium.org, Feb 16 2018

Labels: Hotlist-Recharge-Cold
Status: Untriaged (was: Available)
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue.

Sorry for the inconvenience if the bug really should have been left as Available. If you change it back, also remove the "Hotlist-Recharge-Cold" label.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot

Comment 4 by nasko@chromium.org, Feb 21 2018

Labels: -Hotlist-Recharge-Cold
Project Member

Comment 5 by bugdroid1@chromium.org, Apr 27 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/bee5c962dce0265e3f5b78652961b56879d5045d

commit bee5c962dce0265e3f5b78652961b56879d5045d
Author: erikchen <erikchen@chromium.org>
Date: Fri Apr 27 19:30:25 2018

Update ownership semantics for WebContentsDelegate::AddWebContents.

This CL is a refactor and has no intended behavior change.

This CL updates AddWebContents to use explicit ownership semantics. This CL
fixes some of the subclasses to have proper ownership semantics, and leaves
behind some TODOs for other subclasses.

Bug: 832879, 674318
Change-Id: I6294e591e9166dfb0c029eb78648c17216075dab
TBR: skyostil@chromium.org, carlosk@chromium.org, torne@chromium.org
Reviewed-on: https://chromium-review.googlesource.com/1028631
Reviewed-by: Richard Coles <torne@chromium.org>
Reviewed-by: Antoine Labour <piman@chromium.org>
Reviewed-by: Nico Weber <thakis@chromium.org>
Reviewed-by: Ken Rockot <rockot@chromium.org>
Commit-Queue: Erik Chen <erikchen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#554450}
[modify] https://crrev.com/bee5c962dce0265e3f5b78652961b56879d5045d/android_webview/browser/aw_web_contents_delegate.cc
[modify] https://crrev.com/bee5c962dce0265e3f5b78652961b56879d5045d/android_webview/browser/aw_web_contents_delegate.h
[modify] https://crrev.com/bee5c962dce0265e3f5b78652961b56879d5045d/chrome/browser/android/document/document_web_contents_delegate.cc
[modify] https://crrev.com/bee5c962dce0265e3f5b78652961b56879d5045d/chrome/browser/android/document/document_web_contents_delegate.h
[modify] https://crrev.com/bee5c962dce0265e3f5b78652961b56879d5045d/chrome/browser/android/tab_web_contents_delegate_android.cc
[modify] https://crrev.com/bee5c962dce0265e3f5b78652961b56879d5045d/chrome/browser/android/tab_web_contents_delegate_android.h
[modify] https://crrev.com/bee5c962dce0265e3f5b78652961b56879d5045d/chrome/browser/background/background_contents.cc
[modify] https://crrev.com/bee5c962dce0265e3f5b78652961b56879d5045d/chrome/browser/background/background_contents.h
[modify] https://crrev.com/bee5c962dce0265e3f5b78652961b56879d5045d/chrome/browser/background/background_contents_service.cc
[modify] https://crrev.com/bee5c962dce0265e3f5b78652961b56879d5045d/chrome/browser/background/background_contents_service.h
[modify] https://crrev.com/bee5c962dce0265e3f5b78652961b56879d5045d/chrome/browser/devtools/devtools_window.cc
[modify] https://crrev.com/bee5c962dce0265e3f5b78652961b56879d5045d/chrome/browser/devtools/devtools_window.h
[modify] https://crrev.com/bee5c962dce0265e3f5b78652961b56879d5045d/chrome/browser/ssl/ssl_browsertest.cc
[modify] https://crrev.com/bee5c962dce0265e3f5b78652961b56879d5045d/chrome/browser/ui/apps/chrome_app_delegate.cc
[modify] https://crrev.com/bee5c962dce0265e3f5b78652961b56879d5045d/chrome/browser/ui/apps/chrome_app_delegate.h
[modify] https://crrev.com/bee5c962dce0265e3f5b78652961b56879d5045d/chrome/browser/ui/browser.cc
[modify] https://crrev.com/bee5c962dce0265e3f5b78652961b56879d5045d/chrome/browser/ui/browser.h
[modify] https://crrev.com/bee5c962dce0265e3f5b78652961b56879d5045d/chrome/browser/ui/browser_tabstrip.cc
[modify] https://crrev.com/bee5c962dce0265e3f5b78652961b56879d5045d/chrome/browser/ui/browser_tabstrip.h
[modify] https://crrev.com/bee5c962dce0265e3f5b78652961b56879d5045d/chrome/browser/ui/cocoa/constrained_window/constrained_window_mac_browsertest.mm
[modify] https://crrev.com/bee5c962dce0265e3f5b78652961b56879d5045d/chrome/browser/ui/webui/web_dialog_web_contents_delegate_unittest.cc
[modify] https://crrev.com/bee5c962dce0265e3f5b78652961b56879d5045d/components/offline_pages/content/background_loader/background_loader_contents.cc
[modify] https://crrev.com/bee5c962dce0265e3f5b78652961b56879d5045d/components/offline_pages/content/background_loader/background_loader_contents.h
[modify] https://crrev.com/bee5c962dce0265e3f5b78652961b56879d5045d/components/offline_pages/content/background_loader/background_loader_contents_unittest.cc
[modify] https://crrev.com/bee5c962dce0265e3f5b78652961b56879d5045d/content/browser/web_contents/web_contents_impl.cc
[modify] https://crrev.com/bee5c962dce0265e3f5b78652961b56879d5045d/content/browser/web_contents/web_contents_impl.h
[modify] https://crrev.com/bee5c962dce0265e3f5b78652961b56879d5045d/content/browser/web_contents/web_contents_impl_browsertest.cc
[modify] https://crrev.com/bee5c962dce0265e3f5b78652961b56879d5045d/content/browser/web_contents/web_contents_impl_unittest.cc
[modify] https://crrev.com/bee5c962dce0265e3f5b78652961b56879d5045d/content/public/browser/web_contents_delegate.h
[modify] https://crrev.com/bee5c962dce0265e3f5b78652961b56879d5045d/content/shell/browser/shell.cc
[modify] https://crrev.com/bee5c962dce0265e3f5b78652961b56879d5045d/content/shell/browser/shell.h
[modify] https://crrev.com/bee5c962dce0265e3f5b78652961b56879d5045d/content/test/test_web_contents.cc
[modify] https://crrev.com/bee5c962dce0265e3f5b78652961b56879d5045d/content/test/test_web_contents.h
[modify] https://crrev.com/bee5c962dce0265e3f5b78652961b56879d5045d/extensions/browser/app_window/app_delegate.h
[modify] https://crrev.com/bee5c962dce0265e3f5b78652961b56879d5045d/extensions/browser/app_window/app_window.cc
[modify] https://crrev.com/bee5c962dce0265e3f5b78652961b56879d5045d/extensions/browser/app_window/app_window.h
[modify] https://crrev.com/bee5c962dce0265e3f5b78652961b56879d5045d/extensions/browser/extension_host.cc
[modify] https://crrev.com/bee5c962dce0265e3f5b78652961b56879d5045d/extensions/browser/extension_host.h
[modify] https://crrev.com/bee5c962dce0265e3f5b78652961b56879d5045d/extensions/browser/guest_view/extension_options/extension_options_guest.cc
[modify] https://crrev.com/bee5c962dce0265e3f5b78652961b56879d5045d/extensions/browser/guest_view/extension_options/extension_options_guest.h
[modify] https://crrev.com/bee5c962dce0265e3f5b78652961b56879d5045d/extensions/browser/guest_view/web_view/web_view_guest.cc
[modify] https://crrev.com/bee5c962dce0265e3f5b78652961b56879d5045d/extensions/browser/guest_view/web_view/web_view_guest.h
[modify] https://crrev.com/bee5c962dce0265e3f5b78652961b56879d5045d/extensions/shell/browser/shell_app_delegate.cc
[modify] https://crrev.com/bee5c962dce0265e3f5b78652961b56879d5045d/extensions/shell/browser/shell_app_delegate.h
[modify] https://crrev.com/bee5c962dce0265e3f5b78652961b56879d5045d/headless/lib/browser/headless_web_contents_impl.cc
[modify] https://crrev.com/bee5c962dce0265e3f5b78652961b56879d5045d/ui/views/controls/webview/web_dialog_view.cc
[modify] https://crrev.com/bee5c962dce0265e3f5b78652961b56879d5045d/ui/views/controls/webview/web_dialog_view.h
[modify] https://crrev.com/bee5c962dce0265e3f5b78652961b56879d5045d/ui/web_dialogs/web_dialog_delegate.cc
[modify] https://crrev.com/bee5c962dce0265e3f5b78652961b56879d5045d/ui/web_dialogs/web_dialog_delegate.h
[modify] https://crrev.com/bee5c962dce0265e3f5b78652961b56879d5045d/ui/web_dialogs/web_dialog_web_contents_delegate.cc
[modify] https://crrev.com/bee5c962dce0265e3f5b78652961b56879d5045d/ui/web_dialogs/web_dialog_web_contents_delegate.h

Sign in to add a comment