Commit 33bd754c authored by Alexander Timin's avatar Alexander Timin Committed by Commit Bot

[content] Add DumpWithoutCrashing to WebContents::FromRenderFrameHost.

We are considering returning nullptr for
WebContents::FromRenderFrameHost is the RenderFrameHost is not the
current one.

This patch adds a behind-the-flag option to start generating crash dumps
to allow us to find the places which need to be fixed before that.

R=alexmos@chromium.org
BUG=1059903

Change-Id: Iaca4f30dfef1d6b6e03194a990bebf3e1649b39c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2093228Reviewed-by: default avatarAlex Moshchuk <alexmos@chromium.org>
Commit-Queue: Alexander Timin <altimin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#748950}
parent 4f175b76
......@@ -193,6 +193,11 @@ namespace {
const int kMinimumDelayBetweenLoadingUpdatesMS = 100;
const char kDotGoogleDotCom[] = ".google.com";
// TODO(crbug.com/1059903): Clean up after the initial investigation.
constexpr base::Feature kCheckWebContentsAccessFromNonCurrentFrame{
"CheckWebContentsAccessFromNonCurrentFrame",
base::FEATURE_DISABLED_BY_DEFAULT};
base::LazyInstance<std::vector<
WebContentsImpl::FriendWrapper::CreatedCallback>>::DestructorAtExit
g_created_callbacks = LAZY_INSTANCE_INITIALIZER;
......@@ -368,6 +373,11 @@ WebContents* WebContents::FromRenderViewHost(RenderViewHost* rvh) {
WebContents* WebContents::FromRenderFrameHost(RenderFrameHost* rfh) {
if (!rfh)
return nullptr;
if (!rfh->IsCurrent() && base::FeatureList::IsEnabled(
kCheckWebContentsAccessFromNonCurrentFrame)) {
// TODO(crbug.com/1059903): return nullptr here eventually.
base::debug::DumpWithoutCrashing();
}
return static_cast<RenderFrameHostImpl*>(rfh)->delegate()->GetAsWebContents();
}
......
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