Commit 4632b61b authored by Maks Orlovich's avatar Maks Orlovich Committed by Commit Bot

Remove DCHECK in WebRequestProxyingURLLoaderFactory vs. RFH's UKM ID

Verifying vs. RenderFrameHostImpl's UKM ID doesn't work due to the frame ID's potentially changing interpretation when the fetch races against a navigation.

(I am really looking forward towards RenderDocumentHost...)

Bug: 1131134
Change-Id: I66e1e0ed160994dbe3473f5a21495d38566b9cee
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2429235Reviewed-by: default avatarKaran Bhatia <karandeepb@chromium.org>
Commit-Queue: Maksim Orlovich <morlovich@chromium.org>
Cr-Commit-Position: refs/heads/master@{#811065}
parent 926c6453
......@@ -746,9 +746,8 @@ bool WebRequestAPI::MaybeProxyURLLoaderFactory(
(browser_context->IsOffTheRecord() &&
ExtensionsBrowserClient::Get()->GetOriginalContext(browser_context) ==
browser_context_));
const int frame_id = frame ? frame->GetRoutingID() : MSG_ROUTING_NONE;
WebRequestProxyingURLLoaderFactory::StartProxying(
browser_context, is_navigation ? -1 : render_process_id, frame_id,
browser_context, is_navigation ? -1 : render_process_id,
&request_id_generator_, std::move(navigation_ui_data),
std::move(navigation_id), ukm_source_id, std::move(proxied_receiver),
std::move(target_factory_remote), std::move(header_client_receiver),
......
......@@ -1080,7 +1080,6 @@ bool WebRequestProxyingURLLoaderFactory::InProgressRequest::IsRedirectSafe(
WebRequestProxyingURLLoaderFactory::WebRequestProxyingURLLoaderFactory(
content::BrowserContext* browser_context,
int render_process_id,
int frame_id,
WebRequestAPI::RequestIDGenerator* request_id_generator,
std::unique_ptr<ExtensionNavigationUIData> navigation_ui_data,
base::Optional<int64_t> navigation_id,
......@@ -1093,7 +1092,6 @@ WebRequestProxyingURLLoaderFactory::WebRequestProxyingURLLoaderFactory(
content::ContentBrowserClient::URLLoaderFactoryType loader_factory_type)
: browser_context_(browser_context),
render_process_id_(render_process_id),
frame_id_(frame_id),
request_id_generator_(request_id_generator),
navigation_ui_data_(std::move(navigation_ui_data)),
navigation_id_(std::move(navigation_id)),
......@@ -1126,7 +1124,6 @@ WebRequestProxyingURLLoaderFactory::WebRequestProxyingURLLoaderFactory(
void WebRequestProxyingURLLoaderFactory::StartProxying(
content::BrowserContext* browser_context,
int render_process_id,
int frame_id,
WebRequestAPI::RequestIDGenerator* request_id_generator,
std::unique_ptr<ExtensionNavigationUIData> navigation_ui_data,
base::Optional<int64_t> navigation_id,
......@@ -1140,7 +1137,7 @@ void WebRequestProxyingURLLoaderFactory::StartProxying(
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
auto proxy = std::make_unique<WebRequestProxyingURLLoaderFactory>(
browser_context, render_process_id, frame_id, request_id_generator,
browser_context, render_process_id, request_id_generator,
std::move(navigation_ui_data), std::move(navigation_id), ukm_source_id,
std::move(loader_receiver), std::move(target_factory_remote),
std::move(header_client_receiver), proxies, loader_factory_type);
......@@ -1158,20 +1155,6 @@ void WebRequestProxyingURLLoaderFactory::CreateLoaderAndStart(
const net::MutableNetworkTrafficAnnotationTag& traffic_annotation) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
// Sanity check the plumbed |ukm_source_id_|.
#if DCHECK_IS_ON()
auto* frame = content::RenderFrameHost::FromID(render_process_id_, frame_id_);
using FactoryType = content::ContentBrowserClient::URLLoaderFactoryType;
if ((ukm_source_id_ != base::kInvalidUkmSourceId) && frame &&
(frame->GetPageUkmSourceId() != ukm::kInvalidSourceId) &&
(loader_factory_type_ == FactoryType::kDocumentSubResource ||
loader_factory_type_ == FactoryType::kWorkerSubResource)) {
DCHECK_EQ(ukm_source_id_.ToInt64(), frame->GetPageUkmSourceId());
}
#else
(void)frame_id_; // avoid compile trouble due to unused.
#endif
// Make sure we are not proxying a browser initiated non-navigation
// request except for loading service worker scripts.
DCHECK(render_process_id_ != -1 || navigation_ui_data_ ||
......
......@@ -238,7 +238,6 @@ class WebRequestProxyingURLLoaderFactory
WebRequestProxyingURLLoaderFactory(
content::BrowserContext* browser_context,
int render_process_id,
int frame_id,
WebRequestAPI::RequestIDGenerator* request_id_generator,
std::unique_ptr<ExtensionNavigationUIData> navigation_ui_data,
base::Optional<int64_t> navigation_id,
......@@ -256,7 +255,6 @@ class WebRequestProxyingURLLoaderFactory
static void StartProxying(
content::BrowserContext* browser_context,
int render_process_id,
int frame_id,
WebRequestAPI::RequestIDGenerator* request_id_generator,
std::unique_ptr<ExtensionNavigationUIData> navigation_ui_data,
base::Optional<int64_t> navigation_id,
......@@ -315,7 +313,6 @@ class WebRequestProxyingURLLoaderFactory
content::BrowserContext* const browser_context_;
const int render_process_id_;
const int frame_id_;
WebRequestAPI::RequestIDGenerator* const request_id_generator_;
std::unique_ptr<ExtensionNavigationUIData> navigation_ui_data_;
base::Optional<int64_t> navigation_id_;
......
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