Commit 6573f1ea authored by tsepez's avatar tsepez Committed by Commit bot

Simplify RenderFrameImpl::decidePolicyForNavigation and avoid DCHECK.

DCHECK can be tripped when there is a chain of openers or when the
opener has been cleared. The subsequent comparison against file:
fails, and we may make a browser navigation where one could have
been avoided, but it is still correct.

Since it is still correct, we can simplify the check, perhaps
forking in more cases that we used to, but that doesn't matter.

BUG=622509
R=creis@chromium.org

Review-Url: https://codereview.chromium.org/2153573002
Cr-Commit-Position: refs/heads/master@{#405609}
parent fa759873
......@@ -4985,13 +4985,10 @@ WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation(
info.navigationType != blink::WebNavigationTypeReload);
if (!should_fork && url.SchemeIs(url::kFileScheme)) {
// Fork non-file to file opens. Check the opener URL if this is the
// initial navigation in a newly opened window.
GURL source_url(old_url);
if (is_initial_navigation && source_url.is_empty() && frame_->opener())
source_url = frame_->opener()->top()->document().url();
DCHECK(!source_url.is_empty());
should_fork = !source_url.SchemeIs(url::kFileScheme);
// Fork non-file to file opens. Note that this may fork unnecessarily if
// another tab (hosting a file or not) targeted this one before its
// initial navigation, but that shouldn't cause a problem.
should_fork = !old_url.SchemeIs(url::kFileScheme);
}
if (!should_fork) {
......
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