Commit b344652b authored by Dominic Farolino's avatar Dominic Farolino Committed by Commit Bot

[Prefetch]: DCHECK if recursive prefetch token is set incorrectly

This reverts commit e89e7092.

Reason for revert: http://crbug.com/1122182#c19 adds the debugging info
we need on Android, so we can perform minidump analysis

Original change's description:
> [Prefetch]: Don't DCHECK if recursive prefetch token is set.
>
> This reverts commit a55089af.
> crbug.com/1122182 is blocking minidump analysis for now.
>
> Bug: 1132770, 1123715
> Change-Id: I15910a86667d242d3da419e4ed9a274e2a82fea8
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2474854
> Reviewed-by: Dominic Farolino <dom@chromium.org>
> Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
> Commit-Queue: Dominic Farolino <dom@chromium.org>
> Auto-Submit: Mugdha Lakhani <nator@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#817771}

TBR=kinuko@chromium.org,dom@chromium.org,nator@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 1132770
Bug: 1123715
Bug: 1122182
Change-Id: Ic24cdc3b5a8a5bb453e4ddf525ac85d52ddbaef5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2485552Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Reviewed-by: default avatarDominic Farolino <dom@chromium.org>
Commit-Queue: Dominic Farolino <dom@chromium.org>
Cr-Commit-Position: refs/heads/master@{#819277}
parent c4ac5b31
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include "content/browser/loader/prefetch_url_loader_service.h" #include "content/browser/loader/prefetch_url_loader_service.h"
#include "base/bind.h" #include "base/bind.h"
#include "base/debug/dump_without_crashing.h"
#include "base/feature_list.h" #include "base/feature_list.h"
#include "base/time/default_tick_clock.h" #include "base/time/default_tick_clock.h"
#include "content/browser/loader/prefetch_url_loader.h" #include "content/browser/loader/prefetch_url_loader.h"
...@@ -27,6 +28,14 @@ ...@@ -27,6 +28,14 @@
#include "third_party/blink/public/mojom/loader/resource_load_info.mojom-shared.h" #include "third_party/blink/public/mojom/loader/resource_load_info.mojom-shared.h"
#include "third_party/blink/public/mojom/renderer_preferences.mojom.h" #include "third_party/blink/public/mojom/renderer_preferences.mojom.h"
namespace {
void DumpWithoutCrashing(const network::ResourceRequest& request) {
DEBUG_ALIAS_FOR_GURL(prefetch_buf, request.url);
DEBUG_ALIAS_FOR_GURL(initiator_buf, request.request_initiator->GetURL());
base::debug::DumpWithoutCrashing();
}
} // namespace
namespace content { namespace content {
struct PrefetchURLLoaderService::BindContext { struct PrefetchURLLoaderService::BindContext {
...@@ -161,9 +170,18 @@ void PrefetchURLLoaderService::CreateLoaderAndStart( ...@@ -161,9 +170,18 @@ void PrefetchURLLoaderService::CreateLoaderAndStart(
// Recursive prefetch from a cross-origin main resource prefetch. // Recursive prefetch from a cross-origin main resource prefetch.
if (resource_request.recursive_prefetch_token) { if (resource_request.recursive_prefetch_token) {
// TODO(crbug.com/1123715): Figure out why we're seeing this condition hold // A request's |recursive_prefetch_token| is only provided if the request is
// true in the field. // a recursive prefetch. This means it is expected that the current
// context's |cross_origin_factory| was already created.
if (!current_context.cross_origin_factory) { if (!current_context.cross_origin_factory) {
// This could happen due to a compromised renderer passing in a recursive
// prefetch token for a request that's not a recursive prefetch. Cancel
// the request.
DVLOG(1) << "Recursive prefetch token unexpectedly set.";
DumpWithoutCrashing(resource_request);
mojo::Remote<network::mojom::URLLoaderClient>(std::move(client))
->OnComplete(
network::URLLoaderCompletionStatus(net::ERR_INVALID_ARGUMENT));
return; return;
} }
...@@ -177,6 +195,8 @@ void PrefetchURLLoaderService::CreateLoaderAndStart( ...@@ -177,6 +195,8 @@ void PrefetchURLLoaderService::CreateLoaderAndStart(
// a request in a special way. We'll cancel the request. // a request in a special way. We'll cancel the request.
if (isolation_info_iterator == if (isolation_info_iterator ==
current_context.prefetch_isolation_infos.end()) { current_context.prefetch_isolation_infos.end()) {
DVLOG(1) << "Recursive prefetch request is missing prefetch isolation";
DumpWithoutCrashing(resource_request);
mojo::Remote<network::mojom::URLLoaderClient>(std::move(client)) mojo::Remote<network::mojom::URLLoaderClient>(std::move(client))
->OnComplete( ->OnComplete(
network::URLLoaderCompletionStatus(net::ERR_INVALID_ARGUMENT)); network::URLLoaderCompletionStatus(net::ERR_INVALID_ARGUMENT));
......
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