Commit 87f07aa5 authored by arthursonzogni's avatar arthursonzogni Committed by Commit Bot

COOP: rename is_initiator_aboutblank

In the function:
ShouldSwapBrowsingInstanceForCrossOriginOpenerPolicy(...)

Rename the parameter:
  is_initiator_aboutblank
into:
  is_initial_navigation

The previous name was misleading. What we want to represent is whether
this navigation is from the initial empty document or not. It doesn't
really depend on the URL of the initiator.

Note: There are some issues with callers of this function as well,
is_initial_navigation is currently set to:
!current_rfh->has_committed_any_navigation().
This gives the expected boolean most of time, except when:
1) The |current_rfh| is not the empty document and is crashed.
2) The |current_rfh| is the new RenderFrameHost, that committed before
   the navigation, due to an optimization after crash.
Those 2 issues will be handled in followups.

Bug: chromium:1076879
Change-Id: I1512aa91a3b46bdde25b36587ab9ae4f4941fa46
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2273139
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: default avatarArthur Hemery <ahemery@chromium.org>
Reviewed-by: default avatarPâris Meuleman <pmeuleman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#783906}
parent c919c958
......@@ -726,7 +726,7 @@ bool ShouldSwapBrowsingInstanceForCrossOriginOpenerPolicy(
network::mojom::CrossOriginOpenerPolicyValue initiator_coop,
network::mojom::CrossOriginEmbedderPolicyValue initiator_coep,
const url::Origin& initiator_origin,
bool is_initiator_aboutblank,
bool is_initial_navigation,
network::mojom::CrossOriginOpenerPolicyValue destination_coop,
network::mojom::CrossOriginEmbedderPolicyValue destination_coep,
const url::Origin& destination_origin) {
......@@ -756,7 +756,7 @@ bool ShouldSwapBrowsingInstanceForCrossOriginOpenerPolicy(
// ```
// [1]
// https://gist.github.com/annevk/6f2dd8c79c77123f39797f6bdac43f3e#changes-to-navigation
if (is_initiator_aboutblank &&
if (is_initial_navigation &&
initiator_coop == CrossOriginOpenerPolicyValue::kSameOriginAllowPopups &&
destination_coop == CrossOriginOpenerPolicyValue::kUnsafeNone) {
return false;
......
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