Commit ce5b7e41 authored by clamy's avatar clamy Committed by Commit Bot

Android WebView: use base URL for cookies in the browser process

This CL ensures that the base URL is properly used as the
first_party_for_cookies URL in Android WebView if it is non-null. This fixes an
issue with cookies being unproperly set for iframes if their parent was loaded
through LoadDataWithBaseURL.

BUG=793648

Change-Id: I0f7da293f1e102f7b414ae799f701d48667eefc1
Reviewed-on: https://chromium-review.googlesource.com/822572
Commit-Queue: Camille Lamy <clamy@chromium.org>
Reviewed-by: default avatarJohn Abd-El-Malek <jam@chromium.org>
Cr-Commit-Position: refs/heads/master@{#523559}
parent 85ffc0ea
......@@ -1037,14 +1037,25 @@ void NavigationRequest::OnStartChecksComplete(
// Mark the fetch_start (Navigation Timing API).
request_params_.navigation_timing.fetch_start = base::TimeTicks::Now();
GURL base_url;
#if defined(OS_ANDROID)
// On Android, a base URL can be set for the frame. If this the case, it is
// the URL to use for cookies.
NavigationEntry* last_committed_entry =
frame_tree_node_->navigator()->GetController()->GetLastCommittedEntry();
if (last_committed_entry)
base_url = last_committed_entry->GetBaseURLForDataURL();
#endif
const GURL& top_document_url =
!base_url.is_empty()
? base_url
: frame_tree_node_->frame_tree()->root()->current_url();
// TODO(mkwst): This is incorrect. It ought to use the definition from
// 'Document::firstPartyForCookies()' in Blink, which walks the ancestor tree
// and verifies that all origins are PSL-matches (and special-cases extension
// URLs).
const GURL& site_for_cookies =
frame_tree_node_->IsMainFrame()
? common_params_.url
: frame_tree_node_->frame_tree()->root()->current_url();
frame_tree_node_->IsMainFrame() ? common_params_.url : top_document_url;
bool parent_is_main_frame = !frame_tree_node_->parent()
? false
: frame_tree_node_->parent()->IsMainFrame();
......
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