Skip to content

Commit

Permalink
[Partitioned Popins] Move request header handling to throttle
Browse files Browse the repository at this point in the history
I think it's a better idea to consolidate all the header and navigation
stuff for popins here? The code ownership is cleaner and one doesn't
have to hunt in a bunch of other spots.

Test is that
external/wpt/partitioned-popins/partitioned-popins.request-header.tentative.https.window.js
continues to work.

Explainer: https://explainers-by-googlers.github.io/partitioned-popins/
I2P: https://groups.google.com/a/chromium.org/g/blink-dev/c/ApU_zUmpQ2g/

Bug: 340606651
Change-Id: I1401123e7646c8602cd01e560517a9448b475068
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5851352
Reviewed-by: Rakina Zata Amni <[email protected]>
Auto-Submit: Ari Chivukula <[email protected]>
Commit-Queue: Ari Chivukula <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1354285}
  • Loading branch information
arichiv authored and Chromium LUCI CQ committed Sep 12, 2024
1 parent 1d24313 commit e6cce7b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
12 changes: 0 additions & 12 deletions content/browser/renderer_host/navigation_request.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2007,18 +2007,6 @@ NavigationRequest::NavigationRequest(
ad_auction_headers_eligible_ = true;
headers.SetHeader(kAdAuctionRequestHeaderKey, "?1");
}

// Partitioned popins are special modal popups that are partitioned as
// though they were an iframe embedded in the opener. All main-frame
// navigations and redirects must set a request header to notify the loaded
// site they are in a partitioned popin and not a standard popup.
// See https://explainers-by-googlers.github.io/partitioned-popins/
if (frame_tree_node->IsOutermostMainFrame() &&
frame_tree_node->current_frame_host()
->delegate()
->IsPartitionedPopin()) {
headers.SetHeader("Sec-Popin-Context", "partitioned");
}
}

begin_params_->headers = headers.ToString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ PartitionedPopinsNavigationThrottle::WillStartRequest() {
if (!navigation_handle()->GetURL().SchemeIs(url::kHttpsScheme)) {
return BLOCK_REQUEST;
}
// Partitioned popins are special modal popups that are partitioned as
// though they were an iframe embedded in the opener. All main-frame
// navigations and redirects must set a request header to notify the loaded
// site they are in a partitioned popin and not a standard popup.
// See https://explainers-by-googlers.github.io/partitioned-popins/
navigation_handle()->SetRequestHeader("Sec-Popin-Context", "partitioned");
return PROCEED;
}

Expand Down

0 comments on commit e6cce7b

Please sign in to comment.