Commit 3791cab0 authored by arthursonzogni's avatar arthursonzogni Committed by Chromium LUCI CQ

Make NavigationSimulator to simulate sandbox/origin.

This patch makes two attributes of DidCommitNavigationParams:
- sandbox_flags
- origin
to be simulated more correctly.

Both arguments are meant to disapear soon and be replaced by the ones
computed from the browser process. In the meantime, we only check what
the browser and the renderer computed match, as close as possible.

This patch is required for:
https://chromium-review.googlesource.com/c/chromium/src/+/2579743/
Otherwise, the NavigationSimulator won't simulate them correctly and
there will be a mismatch.

Bug: 1041376
Change-Id: I87ee6ac583b1e8212a2e566934bf94f4e3b72a84
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2584873Reviewed-by: default avatarAntonio Sartori <antoniosartori@chromium.org>
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#836096}
parent f863138d
......@@ -1310,14 +1310,23 @@ NavigationSimulatorImpl::BuildDidCommitProvisionalLoadParams(
request_ ? request_->commit_params().intended_as_new_entry : false;
params->method = request_ ? request_->common_params().method : "GET";
RenderFrameHostImpl* current_rfh = frame_tree_node_->current_frame_host();
if (failed_navigation) {
// Note: Error pages must commit in a unique origin. So it is left unset.
params->url_is_unreachable = true;
} else {
params->origin = origin_.value_or(url::Origin::Create(navigation_url_));
params->redirects.push_back(navigation_url_);
params->http_status_code = 200;
params->should_update_history = true;
if (same_document) {
params->sandbox_flags = current_rfh->active_sandbox_flags();
params->origin = current_rfh->GetLastCommittedOrigin();
} else {
params->sandbox_flags = request_->SandboxFlagsToCommit();
params->origin =
origin_.value_or(request_->GetOriginForURLLoaderFactory());
}
}
CHECK(same_document || request_);
......
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