Commit 30b23f86 authored by Alex Turner's avatar Alex Turner Committed by Commit Bot

Use RFH::AddMessageToConsole in ContentSubresourceFilterThrottleManager

Currently, in ContentSubresourceFilterThrottleManager::
DidFinishNavigation, there is a call to NavigationConsoleLogger::
LogMessageOnCommit. This always results in a message being immediately
added to console, as it is only called for committed navigations.

For simplicity, and as the other functionality of
NavigationConsoleLogger is unnecessary for this purpose, we change this
call to a direct call to RenderFrameHost::AddMessageToConsole. This will
also aid in minor refactoring planned for crbug.com/1055558, which will
factor out this code path into a function and pass it as a callback for
a posted task in certain cases. This change avoids the need to pass a
pointer to a navigation_handle, which may be in the process of being
deleted, to any posted task.

Bug: 1067010
Change-Id: I7a3f3a8fed2bfbac23955afe5f45f5a43c22c46f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2132779
Commit-Queue: Alex Turner <alexmt@chromium.org>
Reviewed-by: default avatarCharlie Harrison <csharrison@chromium.org>
Cr-Commit-Position: refs/heads/master@{#756480}
parent bbd04e05
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
#include "base/trace_event/traced_value.h" #include "base/trace_event/traced_value.h"
#include "components/subresource_filter/content/browser/activation_state_computing_navigation_throttle.h" #include "components/subresource_filter/content/browser/activation_state_computing_navigation_throttle.h"
#include "components/subresource_filter/content/browser/async_document_subresource_filter.h" #include "components/subresource_filter/content/browser/async_document_subresource_filter.h"
#include "components/subresource_filter/content/browser/navigation_console_logger.h"
#include "components/subresource_filter/content/browser/page_load_statistics.h" #include "components/subresource_filter/content/browser/page_load_statistics.h"
#include "components/subresource_filter/content/browser/subresource_filter_client.h" #include "components/subresource_filter/content/browser/subresource_filter_client.h"
#include "components/subresource_filter/content/common/subresource_filter_messages.h" #include "components/subresource_filter/content/common/subresource_filter_messages.h"
...@@ -210,8 +209,8 @@ void ContentSubresourceFilterThrottleManager::DidFinishNavigation( ...@@ -210,8 +209,8 @@ void ContentSubresourceFilterThrottleManager::DidFinishNavigation(
if (filter->activation_state().enable_logging) { if (filter->activation_state().enable_logging) {
DCHECK(filter->activation_state().activation_level != DCHECK(filter->activation_state().activation_level !=
mojom::ActivationLevel::kDisabled); mojom::ActivationLevel::kDisabled);
NavigationConsoleLogger::LogMessageOnCommit( frame_host->AddMessageToConsole(
navigation_handle, blink::mojom::ConsoleMessageLevel::kWarning, blink::mojom::ConsoleMessageLevel::kWarning,
kActivationConsoleMessage); kActivationConsoleMessage);
} }
} }
......
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