Commit ec6037bd authored by arthursonzogni's avatar arthursonzogni Committed by Commit Bot

Revert "Make renderer-initiated navigation to about:blank to use the default path."

This reverts commit ef860d19. Not everything is
reverted, all the previously updated tests stays the same.

Reason for revert: https://crbug.com/965410
Successive navigations to about:blank triggered from the same script execution
used to be collapsed into one. By using the default code path without
PerNavigationMojoInterface, all of them commit successfully. I am reverting this
patch to preserve the old behavior and will be able to reland it later.

Original message description:
=============================
https://chromium-review.googlesource.com/c/chromium/src/+/1543258

Make renderer-initiated navigation to about:blank to use the default path.

We used to believe renderer initiated navigation from a document to
about:blank needed to happen sometimes "synchronously". This isn't the
case, a PostTask is currently used. The only real requirement is when
committing the initial empty document.

This CL makes those navigation to use the default path instead.

This requires a few tests to be updated:

1) The initiator and a few other properties needs to be properly set. There
   are DCHECK in BeginNavigationInternal to enforce renderer initiated
   navigation always have a defined initiator.

2) runtime-console-log-handle-navigate.js: In console-log-navigate, console.log
   can use the 'getter' of the object several times (up to 2) to print the
   object. It triggers several about:blank navigations. Since they are now going
   to the browser process, they are committed later compared to the script
   execution. The test became less reliable. The test was using
   dp.Runtime.onceExecutionContextCreated to wait for new documents to commit,
   but waiting was started potentially after the event occured. The new test is
   now creating the Promise before triggering the action that will later resolve
   it. The action is either creating the iframe or making use of the logXXX()
   function. This is now fully reliable.

Bug: 936696, 965410
Change-Id: Ib4e514f9e1c8f70b8329f961b23f381302840e84
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1626417Reviewed-by: default avatarCamille Lamy <clamy@chromium.org>
Reviewed-by: default avatarArthur Sonzogni <arthursonzogni@chromium.org>
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#662655}
parent e2719eae
......@@ -32,9 +32,8 @@ Referrer Referrer::SanitizeForRequest(const GURL& request,
sanitized_referrer.policy = network::mojom::ReferrerPolicy::kNever;
}
bool is_web_scheme = request.SchemeIsHTTPOrHTTPS() || request.IsAboutBlank();
if (!is_web_scheme || !sanitized_referrer.url.SchemeIsValidForReferrer()) {
if (!request.SchemeIsHTTPOrHTTPS() ||
!sanitized_referrer.url.SchemeIsValidForReferrer()) {
sanitized_referrer.url = GURL();
return sanitized_referrer;
}
......
......@@ -6479,12 +6479,13 @@ void RenderFrameImpl::BeginNavigation(
return;
}
// Navigation to about:srcdoc or to an MHTML archive don't need to consult
// the browser. The document content is already available in the renderer
// process.
// Navigation to about:blank, about:srcdoc or to an MHTML archive don't need
// to consult the browser. The document content is already available in the
// renderer process.
// TODO(arthursonzogni): Remove this. Everything should use the default code
// path and be driven by the browser process.
if (use_archive || url == content::kAboutSrcDocURL) {
if (use_archive || url == content::kAboutSrcDocURL ||
WebDocumentLoader::WillLoadUrlAsEmpty(url)) {
if (!frame_->WillStartNavigation(*info))
return;
// Only the first navigation in a frame to an empty document must be
......
......@@ -1238,7 +1238,7 @@ class CONTENT_EXPORT RenderFrameImpl
void BeginNavigationInternal(std::unique_ptr<blink::WebNavigationInfo> info);
// Commit a navigation that isn't handled by the browser (e.g., an empty
// document or an MHTML archive).
// document, about:srcdoc or an MHTML archive).
void CommitSyncNavigation(std::unique_ptr<blink::WebNavigationInfo> info);
// Commit navigation with |navigation_params| prepared.
......@@ -1753,6 +1753,7 @@ class CONTENT_EXPORT RenderFrameImpl
RenderFrameMediaPlaybackOptions renderer_media_playback_options_;
// Used by renderer initiated navigations not driven by the browser process:
// - navigation to about:blank.
// - navigation to about:srcdoc.
// - navigation using an MHTML archive.
// TODO(arthursonzogni): Remove this. Everything should use the default code
......
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