| Index: components/subresource_filter/content/browser/content_subresource_filter_driver_factory.cc
|
| diff --git a/components/subresource_filter/content/browser/content_subresource_filter_driver_factory.cc b/components/subresource_filter/content/browser/content_subresource_filter_driver_factory.cc
|
| index c9125d23fbb319664c335f175564453f230a8144..27dae15e3738da8e4fd4fea45a585dca3b8182ff 100644
|
| --- a/components/subresource_filter/content/browser/content_subresource_filter_driver_factory.cc
|
| +++ b/components/subresource_filter/content/browser/content_subresource_filter_driver_factory.cc
|
| @@ -17,6 +17,7 @@
|
| #include "content/public/browser/render_frame_host.h"
|
| #include "content/public/browser/web_contents.h"
|
| #include "ipc/ipc_message_macros.h"
|
| +#include "net/base/net_errors.h"
|
| #include "url/gurl.h"
|
|
|
| namespace subresource_filter {
|
| @@ -162,12 +163,18 @@ bool ContentSubresourceFilterDriverFactory::ShouldActivateForMainFrameURL(
|
|
|
| void ContentSubresourceFilterDriverFactory::ActivateForFrameHostIfNeeded(
|
| content::RenderFrameHost* render_frame_host,
|
| - const GURL& url) {
|
| - if (activation_level_ != ActivationLevel::DISABLED) {
|
| + const GURL& url,
|
| + bool failed_navigation) {
|
| + // PlzNavigate: For failed navigations, ReadyToCommitNavigation is still
|
| + // called, so we end up here; but there is no longer a failed provisional load
|
| + // on the renderer side, so an activation message sent from here would turn on
|
| + // filtering for the subsequent error page load. This is probably harmless,
|
| + // but not sending an activation message is even cleaner.
|
| + if (activation_level_ != ActivationLevel::DISABLED && !failed_navigation) {
|
| auto* driver = DriverFromFrameHost(render_frame_host);
|
| DCHECK(driver);
|
| - driver->ActivateForProvisionalLoad(GetMaximumActivationLevel(), url,
|
| - measure_performance_);
|
| + driver->ActivateForNextCommittedLoad(GetMaximumActivationLevel(),
|
| + measure_performance_);
|
| }
|
| }
|
|
|
| @@ -227,10 +234,9 @@ void ContentSubresourceFilterDriverFactory::RenderFrameDeleted(
|
| void ContentSubresourceFilterDriverFactory::ReadyToCommitNavigation(
|
| content::NavigationHandle* navigation_handle) {
|
| DCHECK(!navigation_handle->IsSamePage());
|
| - content::RenderFrameHost* render_frame_host =
|
| - navigation_handle->GetRenderFrameHost();
|
| - GURL url = navigation_handle->GetURL();
|
| - ReadyToCommitNavigationInternal(render_frame_host, url);
|
| + ReadyToCommitNavigationInternal(
|
| + navigation_handle->GetRenderFrameHost(), navigation_handle->GetURL(),
|
| + navigation_handle->GetNetErrorCode() != net::OK);
|
| }
|
|
|
| void ContentSubresourceFilterDriverFactory::DidFinishLoad(
|
| @@ -290,21 +296,22 @@ bool ContentSubresourceFilterDriverFactory::OnMessageReceived(
|
|
|
| void ContentSubresourceFilterDriverFactory::ReadyToCommitNavigationInternal(
|
| content::RenderFrameHost* render_frame_host,
|
| - const GURL& url) {
|
| + const GURL& url,
|
| + bool failed_navigation) {
|
| if (!render_frame_host->GetParent()) {
|
| RecordRedirectChainMatchPattern();
|
| if (ShouldActivateForMainFrameURL(url)) {
|
| activation_level_ = GetMaximumActivationLevel();
|
| measure_performance_ = activation_level_ != ActivationLevel::DISABLED &&
|
| ShouldMeasurePerformanceForPageLoad();
|
| - ActivateForFrameHostIfNeeded(render_frame_host, url);
|
| + ActivateForFrameHostIfNeeded(render_frame_host, url, failed_navigation);
|
| } else {
|
| activation_level_ = ActivationLevel::DISABLED;
|
| measure_performance_ = false;
|
| aggregated_document_statistics_ = DocumentLoadStatistics();
|
| }
|
| } else {
|
| - ActivateForFrameHostIfNeeded(render_frame_host, url);
|
| + ActivateForFrameHostIfNeeded(render_frame_host, url, failed_navigation);
|
| }
|
| }
|
|
|
|
|