Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(237)

Unified Diff: content/browser/loader/resource_dispatcher_host_impl.cc

Issue 2405483002: Make the request initiator Optional (Closed)
Patch Set: Addressed comments + rebase Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/loader/resource_dispatcher_host_impl.cc
diff --git a/content/browser/loader/resource_dispatcher_host_impl.cc b/content/browser/loader/resource_dispatcher_host_impl.cc
index fa07d19c0ed51ca9f01f6ded221ffedecb6bb65c..c406946ef7c0266519c7aef068376964d5cf17a4 100644
--- a/content/browser/loader/resource_dispatcher_host_impl.cc
+++ b/content/browser/loader/resource_dispatcher_host_impl.cc
@@ -1407,6 +1407,12 @@ void ResourceDispatcherHostImpl::ContinuePendingBeginRequest(
new_request->set_first_party_for_cookies(
request_data.first_party_for_cookies);
+
+ // The initiator should normally be present, unless this is a navigation in a
+ // top-level frame. It may be null for some top-level navigations (eg:
+ // browser-initiated ones).
+ DCHECK(request_data.request_initiator.has_value() ||
+ request_data.resource_type == RESOURCE_TYPE_MAIN_FRAME);
new_request->set_initiator(request_data.request_initiator);
if (request_data.originated_from_service_worker) {

Powered by Google App Engine
This is Rietveld 408576698