Commit 6b2453e8 authored by Carlos Caballero's avatar Carlos Caballero Committed by Commit Bot

[bfcache] Do not cache if running insecure content is allowed

We will not restore the is_running_insecure_content_allowed_ to true if
we navigate back and the page is in the BackForwardCache, so do not
store it if we were to loose that state.

Some background on why we sometimes need to disable bfcache:
https://docs.google.com/document/d/1NjZeusdS1kyEkZyfLggndU1A6qVt0Y1sa-LRUxnMoK8

Bug: 1001087
Change-Id: Ib482f42c1c945ae9f3a1c163f24d885910a25334
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1821786
Commit-Queue: Carlos Caballero <carlscab@google.com>
Reviewed-by: default avatarMartin Šrámek <msramek@chromium.org>
Reviewed-by: default avatarKouhei Ueno <kouhei@chromium.org>
Reviewed-by: default avatarAlexander Timin <altimin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#710302}
parent 137bcf85
......@@ -5,6 +5,7 @@
#include "chrome/browser/content_settings/mixed_content_settings_tab_helper.h"
#include "chrome/common/content_settings_agent.mojom.h"
#include "content/public/browser/back_forward_cache.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/render_frame_host.h"
......@@ -59,6 +60,15 @@ void MixedContentSettingsTabHelper::DidFinishNavigation(
if (!navigation_handle->IsInMainFrame() || !navigation_handle->HasCommitted())
return;
// We will not be able to restore the state of these variables if we navigate
// back and the page is in the BackForwardCache, so do not store it if we were
// to lose that state.
if (is_running_insecure_content_allowed_ || insecure_content_site_instance_) {
content::BackForwardCache::DisableForRenderFrameHost(
navigation_handle->GetPreviousRenderFrameHostId(),
"MixedContentSettingsTabHelper");
}
// Resets mixed content settings on a successful navigation of the main frame
// to a different SiteInstance. This follows the renderer side behavior which
// is reset whenever a cross-site navigation takes place: a new main
......
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