Add initiator origin information to all renderer-initiated navigations.
To support propagating precursor origin information throughout navigation
it is required to know the initiator origin for navigations. This is
a part of of bigger CL to implement support for precursor origin in
all navigation paths. This CL adds initiator origin to the following
cases that didn't have it before:
* RenderFrame(Host)Impl::OpenURL
* Navigating a remote frame (through RenderFrameProxy)
* window.open() with noopener attribute
Bug: 882053
Change-Id: Id5d5d0620f4381eb5965cef2168e6e65e098559a
Reviewed-on: https://chromium-review.googlesource.com/c/1379217
Commit-Queue: Nasko Oskov <[email protected]>
Reviewed-by: Avi Drissman <[email protected]>
Reviewed-by: Alex Moshchuk <[email protected]>
Cr-Commit-Position: refs/heads/master@{#617708}
diff --git a/content/browser/frame_host/navigation_controller_impl.cc b/content/browser/frame_host/navigation_controller_impl.cc
index f3512e10..424158e 100644
--- a/content/browser/frame_host/navigation_controller_impl.cc
+++ b/content/browser/frame_host/navigation_controller_impl.cc
@@ -2062,6 +2062,7 @@
void NavigationControllerImpl::NavigateFromFrameProxy(
RenderFrameHostImpl* render_frame_host,
const GURL& url,
+ const url::Origin& initiator_origin,
bool is_renderer_initiated,
SiteInstance* source_site_instance,
const Referrer& referrer,
@@ -2146,6 +2147,7 @@
}
LoadURLParams params(url);
+ params.initiator_origin = initiator_origin;
params.source_site_instance = source_site_instance;
params.load_type = method == "POST" ? LOAD_TYPE_HTTP_POST : LOAD_TYPE_DEFAULT;
params.transition_type = page_transition;
@@ -2803,6 +2805,10 @@
FrameNavigationEntry* frame_entry) {
DCHECK_EQ(-1, GetIndexOfEntry(&entry));
DCHECK(frame_entry);
+ // TODO(nasko): Enforce this check once all code is updated to supply
+ // initiator_origin for renderer initiated navigations.
+ // DCHECK(!params.is_renderer_initiated ||
+ // params.initiator_origin.has_value());
GURL url_to_load;
GURL virtual_url;
@@ -2884,10 +2890,10 @@
const GURL& history_url_for_data_url =
params.base_url_for_data_url.is_empty() ? GURL() : virtual_url;
CommonNavigationParams common_params(
- url_to_load, params.referrer, params.transition_type, navigation_type,
- download_policy, should_replace_current_entry,
- params.base_url_for_data_url, history_url_for_data_url, previews_state,
- navigation_start,
+ url_to_load, params.initiator_origin, params.referrer,
+ params.transition_type, navigation_type, download_policy,
+ should_replace_current_entry, params.base_url_for_data_url,
+ history_url_for_data_url, previews_state, navigation_start,
params.load_type == LOAD_TYPE_HTTP_POST ? "POST" : "GET",
params.post_data, base::Optional<SourceLocation>(),
params.started_from_context_menu, has_user_gesture, InitiatorCSPInfo(),
diff --git a/content/browser/frame_host/navigation_controller_impl.h b/content/browser/frame_host/navigation_controller_impl.h
index 130f2b9..e7e2d32 100644
--- a/content/browser/frame_host/navigation_controller_impl.h
+++ b/content/browser/frame_host/navigation_controller_impl.h
@@ -108,6 +108,7 @@
void NavigateFromFrameProxy(
RenderFrameHostImpl* render_frame_host,
const GURL& url,
+ const url::Origin& initiator_origin,
bool is_renderer_initiated,
SiteInstance* source_site_instance,
const Referrer& referrer,
diff --git a/content/browser/frame_host/navigation_controller_impl_unittest.cc b/content/browser/frame_host/navigation_controller_impl_unittest.cc
index 70a2b5f..788962c 100644
--- a/content/browser/frame_host/navigation_controller_impl_unittest.cc
+++ b/content/browser/frame_host/navigation_controller_impl_unittest.cc
@@ -665,6 +665,7 @@
NavigationControllerImpl& controller = controller_impl();
NavigationController::LoadURLParams load_params(GURL("http://foo/2"));
+ load_params.initiator_origin = url::Origin::Create(url1);
load_params.referrer = Referrer(GURL("http://referrer"),
network::mojom::ReferrerPolicy::kDefault);
load_params.transition_type = ui::PAGE_TRANSITION_GENERATED;
@@ -3439,6 +3440,7 @@
// For link clicks (renderer-initiated navigations), the pending entry should
// update before commit but the visible should not.
NavigationController::LoadURLParams load_url_params(url1);
+ load_url_params.initiator_origin = url::Origin::Create(url0);
load_url_params.is_renderer_initiated = true;
controller.LoadURLWithParams(load_url_params);
entry_id = controller.GetPendingEntry()->GetUniqueID();
@@ -3468,6 +3470,7 @@
// we show the pending entry's URL as long as the about:blank page is not
// modified.
NavigationController::LoadURLParams load_url_params(url);
+ load_url_params.initiator_origin = url::Origin();
load_url_params.transition_type = ui::PAGE_TRANSITION_LINK;
load_url_params.is_renderer_initiated = true;
controller.LoadURLWithParams(load_url_params);
@@ -3541,6 +3544,7 @@
// we show the pending entry's URL as long as the about:blank page is not
// modified.
NavigationController::LoadURLParams load_url_params(url);
+ load_url_params.initiator_origin = url::Origin();
load_url_params.transition_type = ui::PAGE_TRANSITION_LINK;
load_url_params.is_renderer_initiated = true;
controller.LoadURLWithParams(load_url_params);
@@ -3582,6 +3586,7 @@
// we show the pending entry's URL as long as the about:blank page is not
// modified.
NavigationController::LoadURLParams load_url_params(url1);
+ load_url_params.initiator_origin = url::Origin();
load_url_params.transition_type = ui::PAGE_TRANSITION_LINK;
load_url_params.is_renderer_initiated = true;
controller.LoadURLWithParams(load_url_params);
@@ -3595,6 +3600,7 @@
main_test_rfh()->PrepareForCommit();
main_test_rfh()->SendNavigate(entry_id, true, url1);
NavigationController::LoadURLParams load_url2_params(url2);
+ load_url2_params.initiator_origin = url::Origin::Create(url1);
load_url2_params.transition_type = ui::PAGE_TRANSITION_LINK;
load_url2_params.is_renderer_initiated = true;
controller.LoadURLWithParams(load_url2_params);
@@ -5339,7 +5345,7 @@
FrameTreeNode* subframe_node =
main_test_rfh()->frame_tree_node()->child_at(0);
controller_impl().NavigateFromFrameProxy(
- subframe_node->current_frame_host(), kSrcDoc,
+ subframe_node->current_frame_host(), kSrcDoc, url::Origin::Create(kUrl2),
true /* is_renderer_initiated */, main_test_rfh()->GetSiteInstance(),
Referrer(), ui::PAGE_TRANSITION_LINK,
false /* should_replace_current_entry */, "GET", nullptr, "", nullptr);
diff --git a/content/browser/frame_host/navigation_entry_impl.cc b/content/browser/frame_host/navigation_entry_impl.cc
index f799af2..6a8cdf37 100644
--- a/content/browser/frame_host/navigation_entry_impl.cc
+++ b/content/browser/frame_host/navigation_entry_impl.cc
@@ -697,7 +697,10 @@
IsViewSourceMode() ? NavigationDownloadPolicy::kDisallowViewSource
: NavigationDownloadPolicy::kAllow;
return CommonNavigationParams(
- dest_url, dest_referrer, GetTransitionType(), navigation_type,
+ dest_url,
+ // This is constructing parameters for browser-initiated navigation,
+ // therefore there is no initiator origin.
+ base::nullopt, dest_referrer, GetTransitionType(), navigation_type,
download_policy, should_replace_entry(), GetBaseURLForDataURL(),
GetHistoryURLForDataURL(), previews_state, navigation_start,
frame_entry.method(), post_body ? post_body : post_data_,
diff --git a/content/browser/frame_host/navigation_request.cc b/content/browser/frame_host/navigation_request.cc
index 5129a1e..115f298 100644
--- a/content/browser/frame_host/navigation_request.cc
+++ b/content/browser/frame_host/navigation_request.cc
@@ -299,18 +299,12 @@
// This is not currently handled here.
bool is_form_submission = !!post_body;
- base::Optional<url::Origin> initiator =
- frame_tree_node->IsMainFrame()
- ? base::Optional<url::Origin>()
- : base::Optional<url::Origin>(
- frame_tree_node->frame_tree()->root()->current_origin());
-
auto navigation_params = mojom::BeginNavigationParams::New(
extra_headers, net::LOAD_NORMAL, false /* skip_service_worker */,
blink::mojom::RequestContextType::LOCATION,
blink::WebMixedContentContextType::kBlockable, is_form_submission,
GURL() /* searchable_form_url */,
- std::string() /* searchable_form_encoding */, initiator,
+ std::string() /* searchable_form_encoding */,
GURL() /* client_side_redirect_url */,
base::nullopt /* devtools_initiator_info */);
@@ -365,9 +359,9 @@
0, // nav_entry_id
false, // is_history_navigation_in_new_child
std::map<std::string, bool>(), // subframe_unique_names
- false, // intended_as_new_entry
- -1, // |pending_history_list_offset| is set to -1 because
- // history-navigations do not use this path. See comments above.
+ false, // intended_as_new_entry
+ -1, // |pending_history_list_offset| is set to -1 because
+ // history-navigations do not use this path. See comments above.
current_history_list_offset, current_history_list_length,
false, // is_view_source
false /*should_clear_history_list*/);
@@ -394,7 +388,9 @@
// TODO(clamy): Improve the *NavigationParams and *CommitParams to avoid
// copying so many parameters here.
CommonNavigationParams common_params(
- params.url, params.referrer, params.transition,
+ params.url,
+ // TODO(nasko): Investigate better value to pass for |initiator_origin|.
+ params.origin, params.referrer, params.transition,
is_same_document ? FrameMsg_Navigate_Type::SAME_DOCUMENT
: FrameMsg_Navigate_Type::DIFFERENT_DOCUMENT,
NavigationDownloadPolicy::kAllow, params.should_replace_current_entry,
@@ -538,7 +534,7 @@
common_params_.navigation_type,
frame_tree_node_->navigator()->GetController()->GetBrowserContext(),
common_params.method, user_agent_override,
- common_params_.has_user_gesture, begin_params_->initiator_origin,
+ common_params_.has_user_gesture, common_params.initiator_origin,
frame_tree_node);
if (begin_params_->is_form_submission) {
@@ -1627,7 +1623,7 @@
auto resource_request = std::make_unique<network::ResourceRequest>();
resource_request->url = common_params_.url;
resource_request->method = common_params_.method;
- resource_request->request_initiator = begin_params_->initiator_origin;
+ resource_request->request_initiator = common_params_.initiator_origin;
resource_request->referrer = common_params_.referrer.url;
resource_request->has_user_gesture = common_params_.has_user_gesture;
diff --git a/content/browser/frame_host/navigator.h b/content/browser/frame_host/navigator.h
index 0673b9c..4d2d481 100644
--- a/content/browser/frame_host/navigator.h
+++ b/content/browser/frame_host/navigator.h
@@ -104,6 +104,7 @@
virtual void RequestOpenURL(
RenderFrameHostImpl* render_frame_host,
const GURL& url,
+ const base::Optional<url::Origin>& initiator_origin,
bool uses_post,
const scoped_refptr<network::ResourceRequestBody>& body,
const std::string& extra_headers,
@@ -121,6 +122,7 @@
virtual void NavigateFromFrameProxy(
RenderFrameHostImpl* render_frame_host,
const GURL& url,
+ const url::Origin& initiator_origin,
SiteInstance* source_site_instance,
const Referrer& referrer,
ui::PageTransition page_transition,
diff --git a/content/browser/frame_host/navigator_impl.cc b/content/browser/frame_host/navigator_impl.cc
index ae68881..69dacd0f 100644
--- a/content/browser/frame_host/navigator_impl.cc
+++ b/content/browser/frame_host/navigator_impl.cc
@@ -389,6 +389,7 @@
void NavigatorImpl::RequestOpenURL(
RenderFrameHostImpl* render_frame_host,
const GURL& url,
+ const base::Optional<url::Origin>& initiator_origin,
bool uses_post,
const scoped_refptr<network::ResourceRequestBody>& body,
const std::string& extra_headers,
@@ -447,6 +448,7 @@
params.should_replace_current_entry = should_replace_current_entry;
params.user_gesture = user_gesture;
params.triggering_event_info = triggering_event_info;
+ params.initiator_origin = initiator_origin;
// RequestOpenURL is used only for local frames, so we can get here only if
// the navigation is initiated by a frame in the same SiteInstance as this
@@ -482,6 +484,7 @@
void NavigatorImpl::NavigateFromFrameProxy(
RenderFrameHostImpl* render_frame_host,
const GURL& url,
+ const url::Origin& initiator_origin,
SiteInstance* source_site_instance,
const Referrer& referrer,
ui::PageTransition page_transition,
@@ -535,9 +538,10 @@
&referrer_to_use);
controller_->NavigateFromFrameProxy(
- render_frame_host, url, is_renderer_initiated, source_site_instance,
- referrer_to_use, page_transition, should_replace_current_entry, method,
- post_body, extra_headers, std::move(blob_url_loader_factory));
+ render_frame_host, url, initiator_origin, is_renderer_initiated,
+ source_site_instance, referrer_to_use, page_transition,
+ should_replace_current_entry, method, post_body, extra_headers,
+ std::move(blob_url_loader_factory));
}
void NavigatorImpl::OnBeforeUnloadACK(FrameTreeNode* frame_tree_node,
diff --git a/content/browser/frame_host/navigator_impl.h b/content/browser/frame_host/navigator_impl.h
index 533d097..3b729d1 100644
--- a/content/browser/frame_host/navigator_impl.h
+++ b/content/browser/frame_host/navigator_impl.h
@@ -60,6 +60,7 @@
RestoreType restore_type) override;
void RequestOpenURL(RenderFrameHostImpl* render_frame_host,
const GURL& url,
+ const base::Optional<url::Origin>& initiator_origin,
bool uses_post,
const scoped_refptr<network::ResourceRequestBody>& body,
const std::string& extra_headers,
@@ -74,6 +75,7 @@
void NavigateFromFrameProxy(
RenderFrameHostImpl* render_frame_host,
const GURL& url,
+ const url::Origin& initiator_origin,
SiteInstance* source_site_instance,
const Referrer& referrer,
ui::PageTransition page_transition,
diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc
index 82e0edc..1fa0a79ed0 100644
--- a/content/browser/frame_host/render_frame_host_impl.cc
+++ b/content/browser/frame_host/render_frame_host_impl.cc
@@ -2071,10 +2071,10 @@
validated_url.possibly_invalid_spec());
frame_tree_node_->navigator()->RequestOpenURL(
- this, validated_url, params.uses_post, params.resource_request_body,
- params.extra_headers, params.referrer, params.disposition,
- params.should_replace_current_entry, params.user_gesture,
- params.triggering_event_info, params.href_translate,
+ this, validated_url, params.initiator_origin, params.uses_post,
+ params.resource_request_body, params.extra_headers, params.referrer,
+ params.disposition, params.should_replace_current_entry,
+ params.user_gesture, params.triggering_event_info, params.href_translate,
std::move(blob_url_loader_factory));
}
@@ -4154,7 +4154,7 @@
"frame_tree_node", frame_tree_node_->frame_tree_node_id());
DCHECK(data_url.SchemeIs(url::kDataScheme));
CommonNavigationParams common_params(
- data_url, Referrer(), ui::PAGE_TRANSITION_LINK,
+ data_url, base::nullopt, Referrer(), ui::PAGE_TRANSITION_LINK,
FrameMsg_Navigate_Type::DIFFERENT_DOCUMENT,
NavigationDownloadPolicy::kDisallowInterstitial, false, GURL(), GURL(),
PREVIEWS_OFF, base::TimeTicks::Now(), "GET", nullptr,
diff --git a/content/browser/frame_host/render_frame_proxy_host.cc b/content/browser/frame_host/render_frame_proxy_host.cc
index cfa3fd1..46c6f8f 100644
--- a/content/browser/frame_host/render_frame_proxy_host.cc
+++ b/content/browser/frame_host/render_frame_proxy_host.cc
@@ -327,10 +327,11 @@
// TODO(clamy): The transition should probably be changed for POST navigations
// to PAGE_TRANSITION_FORM_SUBMIT. See https://crbug.com/829827.
frame_tree_node_->navigator()->NavigateFromFrameProxy(
- current_rfh, validated_url, site_instance_.get(), params.referrer,
- ui::PAGE_TRANSITION_LINK, params.should_replace_current_entry,
- params.uses_post ? "POST" : "GET", params.resource_request_body,
- params.extra_headers, std::move(blob_url_loader_factory));
+ current_rfh, validated_url, params.initiator_origin, site_instance_.get(),
+ params.referrer, ui::PAGE_TRANSITION_LINK,
+ params.should_replace_current_entry, params.uses_post ? "POST" : "GET",
+ params.resource_request_body, params.extra_headers,
+ std::move(blob_url_loader_factory));
}
void RenderFrameProxyHost::OnCheckCompleted() {
diff --git a/content/browser/loader/navigation_url_loader_impl.cc b/content/browser/loader/navigation_url_loader_impl.cc
index da0f0227..f396081c 100644
--- a/content/browser/loader/navigation_url_loader_impl.cc
+++ b/content/browser/loader/navigation_url_loader_impl.cc
@@ -223,7 +223,7 @@
// been copied from ResourceDispatcherHostImpl. We did not refactor the
// common code into a function, because RDHI uses accessor functions on the
// URLRequest class to set these fields. whereas we use ResourceRequest here.
- new_request->request_initiator = request_info->begin_params->initiator_origin;
+ new_request->request_initiator = request_info->common_params.initiator_origin;
new_request->referrer = request_info->common_params.referrer.url;
new_request->referrer_policy = Referrer::ReferrerPolicyForUrlRequest(
request_info->common_params.referrer.policy);
diff --git a/content/browser/loader/navigation_url_loader_impl_unittest.cc b/content/browser/loader/navigation_url_loader_impl_unittest.cc
index 3dd219a..75b7d1a 100644
--- a/content/browser/loader/navigation_url_loader_impl_unittest.cc
+++ b/content/browser/loader/navigation_url_loader_impl_unittest.cc
@@ -171,11 +171,12 @@
blink::WebMixedContentContextType::kBlockable,
false /* is_form_submission */, GURL() /* searchable_form_url */,
std::string() /* searchable_form_encoding */,
- url::Origin::Create(url), GURL() /* client_side_redirect_url */,
+ GURL() /* client_side_redirect_url */,
base::nullopt /* devtools_initiator_info */);
CommonNavigationParams common_params;
common_params.url = url;
+ common_params.initiator_origin = url::Origin::Create(url);
common_params.method = method;
common_params.download_policy = download_policy;
diff --git a/content/browser/loader/navigation_url_loader_unittest.cc b/content/browser/loader/navigation_url_loader_unittest.cc
index a90bfba..9b8e9c0 100644
--- a/content/browser/loader/navigation_url_loader_unittest.cc
+++ b/content/browser/loader/navigation_url_loader_unittest.cc
@@ -87,10 +87,11 @@
blink::WebMixedContentContextType::kBlockable,
false /* is_form_submission */, GURL() /* searchable_form_url */,
std::string() /* searchable_form_encoding */,
- url::Origin::Create(url), GURL() /* client_side_redirect_url */,
+ GURL() /* client_side_redirect_url */,
base::nullopt /* devtools_initiator_info */);
CommonNavigationParams common_params;
common_params.url = url;
+ common_params.initiator_origin = url::Origin::Create(url);
std::unique_ptr<NavigationRequestInfo> request_info(
new NavigationRequestInfo(common_params, std::move(begin_params), url,
diff --git a/content/browser/loader/resource_dispatcher_host_impl.cc b/content/browser/loader/resource_dispatcher_host_impl.cc
index 2831e90..9f62b45 100644
--- a/content/browser/loader/resource_dispatcher_host_impl.cc
+++ b/content/browser/loader/resource_dispatcher_host_impl.cc
@@ -1476,7 +1476,7 @@
new_request->set_method(info.common_params.method);
new_request->set_site_for_cookies(info.site_for_cookies);
new_request->set_top_frame_origin(info.top_frame_origin);
- new_request->set_initiator(info.begin_params->initiator_origin);
+ new_request->set_initiator(info.common_params.initiator_origin);
new_request->set_upgrade_if_insecure(info.upgrade_if_insecure);
if (info.is_main_frame) {
new_request->set_first_party_url_policy(
diff --git a/content/browser/loader/resource_dispatcher_host_unittest.cc b/content/browser/loader/resource_dispatcher_host_unittest.cc
index 43919fe..bb23f50 100644
--- a/content/browser/loader/resource_dispatcher_host_unittest.cc
+++ b/content/browser/loader/resource_dispatcher_host_unittest.cc
@@ -837,10 +837,12 @@
blink::WebMixedContentContextType::kBlockable,
false /* is_form_submission */, GURL() /* searchable_form_url */,
std::string() /* searchable_form_encoding */,
- url::Origin::Create(url), GURL() /* client_side_redirect_url */,
+ GURL() /* client_side_redirect_url */,
base::nullopt /* devtools_initiator_info */);
CommonNavigationParams common_params;
common_params.url = url;
+ common_params.initiator_origin = url::Origin::Create(url);
+
std::unique_ptr<NavigationRequestInfo> request_info(
new NavigationRequestInfo(common_params, std::move(begin_params), url,
url::Origin::Create(url), true, false, false,
diff --git a/content/browser/navigation_browsertest.cc b/content/browser/navigation_browsertest.cc
index 2523522..511b0d8 100644
--- a/content/browser/navigation_browsertest.cc
+++ b/content/browser/navigation_browsertest.cc
@@ -237,6 +237,7 @@
NavigateToURL(shell(), url);
EXPECT_EQ(url, observer.last_navigation_url());
EXPECT_TRUE(observer.last_navigation_succeeded());
+ EXPECT_FALSE(observer.last_initiator_origin().has_value());
}
RenderFrameHost* initial_rfh =
@@ -252,6 +253,7 @@
NavigateToURL(shell(), url);
EXPECT_EQ(url, observer.last_navigation_url());
EXPECT_TRUE(observer.last_navigation_succeeded());
+ EXPECT_FALSE(observer.last_initiator_origin().has_value());
}
// The RenderFrameHost should not have changed.
@@ -267,6 +269,7 @@
NavigateToURL(shell(), url);
EXPECT_EQ(url, observer.last_navigation_url());
EXPECT_TRUE(observer.last_navigation_succeeded());
+ EXPECT_FALSE(observer.last_initiator_origin().has_value());
}
// The RenderFrameHost should have changed.
@@ -286,6 +289,7 @@
NavigateToURL(shell(), url);
EXPECT_EQ(url, observer.last_navigation_url());
EXPECT_TRUE(observer.last_navigation_succeeded());
+ EXPECT_FALSE(observer.last_initiator_origin().has_value());
}
RenderFrameHost* initial_rfh =
@@ -306,6 +310,8 @@
EXPECT_TRUE(WaitForLoadStop(shell()->web_contents()));
EXPECT_EQ(url, observer.last_navigation_url());
EXPECT_TRUE(observer.last_navigation_succeeded());
+ EXPECT_EQ(shell()->web_contents()->GetMainFrame()->GetLastCommittedOrigin(),
+ observer.last_initiator_origin());
}
// The RenderFrameHost should not have changed.
@@ -332,6 +338,7 @@
->GetFrameTree()
->root()
->current_frame_host();
+ url::Origin initial_origin = initial_rfh->GetLastCommittedOrigin();
// Simulate clicking on a cross-site link.
{
@@ -352,6 +359,7 @@
EXPECT_TRUE(WaitForLoadStop(shell()->web_contents()));
EXPECT_EQ(url, observer.last_navigation_url());
EXPECT_TRUE(observer.last_navigation_succeeded());
+ EXPECT_EQ(initial_origin, observer.last_initiator_origin().value());
}
// The RenderFrameHost should not have changed unless site-per-process is
@@ -617,8 +625,8 @@
features::kAllowContentInitiatedDataUrlNavigations);
// Setup a BeginNavigate IPC with non-empty base_url_for_data_url.
CommonNavigationParams common_params(
- data_url, Referrer(), ui::PAGE_TRANSITION_LINK,
- FrameMsg_Navigate_Type::DIFFERENT_DOCUMENT,
+ data_url, url::Origin::Create(data_url), Referrer(),
+ ui::PAGE_TRANSITION_LINK, FrameMsg_Navigate_Type::DIFFERENT_DOCUMENT,
NavigationDownloadPolicy::kAllow,
false /* should_replace_current_entry */,
file_url, /* base_url_for_data_url */
@@ -635,7 +643,7 @@
blink::WebMixedContentContextType::kBlockable,
false /* is_form_submission */, GURL() /* searchable_form_url */,
std::string() /* searchable_form_encoding */,
- url::Origin::Create(data_url), GURL() /* client_side_redirect_url */,
+ GURL() /* client_side_redirect_url */,
base::nullopt /* devtools_initiator_info */);
// Receiving the invalid IPC message should lead to renderer process
diff --git a/content/browser/security_exploit_browsertest.cc b/content/browser/security_exploit_browsertest.cc
index b72385bc..4c68676f 100644
--- a/content/browser/security_exploit_browsertest.cc
+++ b/content/browser/security_exploit_browsertest.cc
@@ -110,10 +110,11 @@
GURL extension_url("https://bar.com/simple_page.html");
WebContentsImpl* wc = static_cast<WebContentsImpl*>(shell->web_contents());
wc->GetFrameTree()->root()->navigator()->RequestOpenURL(
- wc->GetFrameTree()->root()->current_frame_host(), extension_url, false,
- nullptr, std::string(), Referrer(), WindowOpenDisposition::CURRENT_TAB,
- false, true, blink::WebTriggeringEventInfo::kFromTrustedEvent,
- std::string(), nullptr /* blob_url_loader_factory */);
+ wc->GetFrameTree()->root()->current_frame_host(), extension_url,
+ url::Origin::Create(foo), false, nullptr, std::string(), Referrer(),
+ WindowOpenDisposition::CURRENT_TAB, false, true,
+ blink::WebTriggeringEventInfo::kFromTrustedEvent, std::string(),
+ nullptr /* blob_url_loader_factory */);
// Since the navigation above requires a cross-process swap, there will be a
// speculative/pending RenderFrameHost. Ensure it exists and is in a different
diff --git a/content/browser/service_worker/service_worker_client_utils.cc b/content/browser/service_worker/service_worker_client_utils.cc
index 407d0bd..41b25b8 100644
--- a/content/browser/service_worker/service_worker_client_utils.cc
+++ b/content/browser/service_worker/service_worker_client_utils.cc
@@ -288,8 +288,8 @@
Navigator* navigator = rfhi->frame_tree_node()->navigator();
navigator->RequestOpenURL(
- rfhi, url, false /* uses_post */, nullptr /* body */,
- std::string() /* extra_headers */,
+ rfhi, url, url::Origin::Create(script_url), false /* uses_post */,
+ nullptr /* body */, std::string() /* extra_headers */,
Referrer::SanitizeForRequest(
url, Referrer(script_url, network::mojom::ReferrerPolicy::kDefault)),
WindowOpenDisposition::CURRENT_TAB,
diff --git a/content/browser/site_per_process_browsertest.cc b/content/browser/site_per_process_browsertest.cc
index 41a867ba..c25b2648 100644
--- a/content/browser/site_per_process_browsertest.cc
+++ b/content/browser/site_per_process_browsertest.cc
@@ -469,6 +469,7 @@
network::mojom::ReferrerPolicy::kAlways),
WindowOpenDisposition::CURRENT_TAB, ui::PAGE_TRANSITION_LINK,
true /* is_renderer_initiated */);
+ params.initiator_origin = url::Origin::Create(url);
shell->OpenURLFromTab(shell->web_contents(), params);
same_tab_observer.Wait();
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 21d71f8..03dd2009 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -2776,6 +2776,7 @@
std::unique_ptr<NavigationController::LoadURLParams> load_params =
std::make_unique<NavigationController::LoadURLParams>(
params.target_url);
+ load_params->initiator_origin = opener->GetLastCommittedOrigin();
load_params->referrer = params.referrer.To<Referrer>();
load_params->transition_type = ui::PAGE_TRANSITION_LINK;
load_params->is_renderer_initiated = true;
diff --git a/content/browser/web_contents/web_contents_impl_browsertest.cc b/content/browser/web_contents/web_contents_impl_browsertest.cc
index 2000249..4f0ae7b 100644
--- a/content/browser/web_contents/web_contents_impl_browsertest.cc
+++ b/content/browser/web_contents/web_contents_impl_browsertest.cc
@@ -535,6 +535,7 @@
OpenURLParams params(url, Referrer(), frame_tree_node_id,
WindowOpenDisposition::CURRENT_TAB,
ui::PAGE_TRANSITION_LINK, true);
+ params.initiator_origin = wc->GetMainFrame()->GetLastCommittedOrigin();
shell()->web_contents()->OpenURL(params);
// Make sure the NavigationEntry ends up with the FrameTreeNode ID.