Commit 0358e021 authored by Kevin McNee's avatar Kevin McNee Committed by Commit Bot

Devtools: Don't auto attach guest views when auto attaching portals

TargetAutoAttacher::UpdatePortals currently adds all inner WebContents
including guest views. When devtools closes, SetAutoAttach clears
|auto_attached_hosts_| of any portals, but leaves any guest views which
leads to the failed DCHECK that all auto attached hosts have been
removed.

Now in UpdatePortals, we check that the inner contents is a portal
before adding it.

Bug: 961113
Change-Id: I758b3818c3f390f47c4020d88094387ee85d07e4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1777022Reviewed-by: default avatarLucas Gadani <lfg@chromium.org>
Reviewed-by: default avatarDmitry Gozman <dgozman@chromium.org>
Commit-Queue: Kevin McNee <mcnee@chromium.org>
Cr-Commit-Position: refs/heads/master@{#692179}
parent 1c2406f8
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include "chrome/browser/apps/platform_apps/app_browsertest_util.h" #include "chrome/browser/apps/platform_apps/app_browsertest_util.h"
#include "chrome/browser/chrome_content_browser_client.h" #include "chrome/browser/chrome_content_browser_client.h"
#include "chrome/browser/content_settings/host_content_settings_map_factory.h" #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
#include "chrome/browser/devtools/devtools_window_testing.h"
#include "chrome/browser/download/download_core_service.h" #include "chrome/browser/download/download_core_service.h"
#include "chrome/browser/download/download_core_service_factory.h" #include "chrome/browser/download/download_core_service_factory.h"
#include "chrome/browser/download/download_history.h" #include "chrome/browser/download/download_history.h"
...@@ -4424,3 +4425,13 @@ IN_PROC_BROWSER_TEST_F(WebViewTest, TouchpadPinchSyntheticWheelEvents) { ...@@ -4424,3 +4425,13 @@ IN_PROC_BROWSER_TEST_F(WebViewTest, TouchpadPinchSyntheticWheelEvents) {
ASSERT_TRUE(synthetic_wheel_listener.WaitUntilSatisfied()); ASSERT_TRUE(synthetic_wheel_listener.WaitUntilSatisfied());
} }
// Tests that we can open and close a devtools window that inspects a contents
// containing a guest view without crashing.
IN_PROC_BROWSER_TEST_F(WebViewTest, OpenAndCloseDevTools) {
LoadAppWithGuest("web_view/simple");
content::WebContents* embedder = GetEmbedderWebContents();
DevToolsWindow* devtools = DevToolsWindowTesting::OpenDevToolsWindowSync(
embedder, false /* is_docked */);
DevToolsWindowTesting::CloseDevToolsWindowSync(devtools);
}
...@@ -153,6 +153,9 @@ void TargetAutoAttacher::UpdatePortals() { ...@@ -153,6 +153,9 @@ void TargetAutoAttacher::UpdatePortals() {
outer_web_contents->GetInnerWebContents()) { outer_web_contents->GetInnerWebContents()) {
WebContentsImpl* web_contents_impl = WebContentsImpl* web_contents_impl =
static_cast<WebContentsImpl*>(web_contents); static_cast<WebContentsImpl*>(web_contents);
if (!web_contents_impl->IsPortal())
continue;
scoped_refptr<DevToolsAgentHost> new_host = scoped_refptr<DevToolsAgentHost> new_host =
RenderFrameDevToolsAgentHost::GetOrCreateFor( RenderFrameDevToolsAgentHost::GetOrCreateFor(
web_contents_impl->GetFrameTree()->root()); web_contents_impl->GetFrameTree()->root());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment