OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/frame_host/render_frame_host_impl.h" | 5 #include "content/browser/frame_host/render_frame_host_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 3388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3399 params.url, params.redirects, frame_tree_node_, is_renderer_initiated, | 3399 params.url, params.redirects, frame_tree_node_, is_renderer_initiated, |
3400 params.was_within_same_page, base::TimeTicks::Now(), | 3400 params.was_within_same_page, base::TimeTicks::Now(), |
3401 pending_nav_entry_id, false); // started_from_context_menu | 3401 pending_nav_entry_id, false); // started_from_context_menu |
3402 } | 3402 } |
3403 | 3403 |
3404 // Determine if the current NavigationHandle can be used. | 3404 // Determine if the current NavigationHandle can be used. |
3405 if (navigation_handle_ && navigation_handle_->GetURL() == params.url) { | 3405 if (navigation_handle_ && navigation_handle_->GetURL() == params.url) { |
3406 return std::move(navigation_handle_); | 3406 return std::move(navigation_handle_); |
3407 } | 3407 } |
3408 | 3408 |
3409 // When PlzNavigate is disabled and the navigation fails during a redirect, | |
3410 // blink doesn't know about the redirect and tries to commit an error page | |
3411 // with the post-redirect url. | |
Charlie Reis
2017/02/24 22:19:10
This doesn't match what's written on the bug:
"He
| |
3412 // TODO(arthursonzogni, clamy) Remove this code once PlzNavigate is launched | |
3413 // or when this problem is solved. | |
3414 bool is_error_page = | |
3415 params.url_is_unreachable || params.http_status_code != net::OK; | |
3416 if (!IsBrowserSideNavigationEnabled() && is_error_page && | |
3417 navigation_handle_) { | |
3418 for (const GURL& url : navigation_handle_->GetRedirectChain()) { | |
3419 if (url == params.url) | |
3420 return std::move(navigation_handle_); | |
3421 } | |
3422 } | |
3423 | |
3409 // If the URL does not match what the NavigationHandle expects, treat the | 3424 // If the URL does not match what the NavigationHandle expects, treat the |
3410 // commit as a new navigation. This can happen when loading a Data | 3425 // commit as a new navigation. This can happen when loading a Data |
3411 // navigation with LoadDataWithBaseURL. | 3426 // navigation with LoadDataWithBaseURL. |
3412 // | 3427 // |
3413 // TODO(csharrison): Data navigations loaded with LoadDataWithBaseURL get | 3428 // TODO(csharrison): Data navigations loaded with LoadDataWithBaseURL get |
3414 // reset here, because the NavigationHandle tracks the URL but the params.url | 3429 // reset here, because the NavigationHandle tracks the URL but the params.url |
3415 // tracks the data. The trick of saving the old entry ids for these | 3430 // tracks the data. The trick of saving the old entry ids for these |
3416 // navigations should go away when this is properly handled. | 3431 // navigations should go away when this is properly handled. |
3417 // See crbug.com/588317. | 3432 // See crbug.com/588317. |
3418 int entry_id_for_data_nav = 0; | 3433 int entry_id_for_data_nav = 0; |
(...skipping 28 matching lines...) Expand all Loading... | |
3447 // There is no pending NavigationEntry in these cases, so pass 0 as the | 3462 // There is no pending NavigationEntry in these cases, so pass 0 as the |
3448 // pending_nav_entry_id. If the previous handle was a prematurely aborted | 3463 // pending_nav_entry_id. If the previous handle was a prematurely aborted |
3449 // navigation loaded via LoadDataWithBaseURL, propagate the entry id. | 3464 // navigation loaded via LoadDataWithBaseURL, propagate the entry id. |
3450 return NavigationHandleImpl::Create( | 3465 return NavigationHandleImpl::Create( |
3451 params.url, params.redirects, frame_tree_node_, is_renderer_initiated, | 3466 params.url, params.redirects, frame_tree_node_, is_renderer_initiated, |
3452 params.was_within_same_page, base::TimeTicks::Now(), | 3467 params.was_within_same_page, base::TimeTicks::Now(), |
3453 entry_id_for_data_nav, false); // started_from_context_menu | 3468 entry_id_for_data_nav, false); // started_from_context_menu |
3454 } | 3469 } |
3455 | 3470 |
3456 } // namespace content | 3471 } // namespace content |
OLD | NEW |