Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(168)

Side by Side Diff: content/browser/frame_host/navigation_handle_impl.cc

Issue 2712123002: Fix bug when a NavigationThrottle blocks a request during a redirect. (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/navigation_handle_impl.h" 5 #include "content/browser/frame_host/navigation_handle_impl.h"
6 6
7 #include <iterator> 7 #include <iterator>
8 8
9 #include "base/debug/dump_without_crashing.h" 9 #include "base/debug/dump_without_crashing.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 } 629 }
630 630
631 void NavigationHandleImpl::DidCommitNavigation( 631 void NavigationHandleImpl::DidCommitNavigation(
632 const FrameHostMsg_DidCommitProvisionalLoad_Params& params, 632 const FrameHostMsg_DidCommitProvisionalLoad_Params& params,
633 bool did_replace_entry, 633 bool did_replace_entry,
634 const GURL& previous_url, 634 const GURL& previous_url,
635 NavigationType navigation_type, 635 NavigationType navigation_type,
636 RenderFrameHostImpl* render_frame_host) { 636 RenderFrameHostImpl* render_frame_host) {
637 DCHECK(!render_frame_host_ || render_frame_host_ == render_frame_host); 637 DCHECK(!render_frame_host_ || render_frame_host_ == render_frame_host);
638 DCHECK_EQ(frame_tree_node_, render_frame_host->frame_tree_node()); 638 DCHECK_EQ(frame_tree_node_, render_frame_host->frame_tree_node());
639 CHECK_EQ(url_, params.url);
640 639
641 did_replace_entry_ = did_replace_entry; 640 did_replace_entry_ = did_replace_entry;
642 method_ = params.method; 641 method_ = params.method;
643 has_user_gesture_ = (params.gesture == NavigationGestureUser); 642 has_user_gesture_ = (params.gesture == NavigationGestureUser);
644 transition_ = params.transition; 643 transition_ = params.transition;
645 should_update_history_ = params.should_update_history; 644 should_update_history_ = params.should_update_history;
646 render_frame_host_ = render_frame_host; 645 render_frame_host_ = render_frame_host;
647 previous_url_ = previous_url; 646 previous_url_ = previous_url;
648 base_url_ = params.base_url; 647 base_url_ = params.base_url;
649 socket_address_ = params.socket_address; 648 socket_address_ = params.socket_address;
650 navigation_type_ = navigation_type; 649 navigation_type_ = navigation_type;
651 650
652 // If an error page reloads, net_error_code might be 200 but we still want to 651 // If an error page reloads, net_error_code might be 200 but we still want to
653 // count it as an error page. 652 // count it as an error page.
654 if (params.base_url.spec() == kUnreachableWebDataURL || 653 if (params.base_url.spec() == kUnreachableWebDataURL ||
655 net_error_code_ != net::OK) { 654 net_error_code_ != net::OK) {
656 state_ = DID_COMMIT_ERROR_PAGE; 655 state_ = DID_COMMIT_ERROR_PAGE;
656 DCHECK(url_ == params.url ||
Charlie Reis 2017/02/24 22:19:10 nit: We probably shouldn't downgrade these from CH
657 std::find(redirect_chain_.begin(), redirect_chain_.end(),
658 params.url) != redirect_chain_.end());
Charlie Reis 2017/02/24 22:19:10 I don't think this is safe. According to the bug,
657 } else { 659 } else {
658 state_ = DID_COMMIT; 660 state_ = DID_COMMIT;
661 DCHECK_EQ(url_, params.url);
659 } 662 }
660 } 663 }
661 664
662 void NavigationHandleImpl::Transfer() { 665 void NavigationHandleImpl::Transfer() {
663 DCHECK(!IsBrowserSideNavigationEnabled()); 666 DCHECK(!IsBrowserSideNavigationEnabled());
664 // This is an actual transfer. Inform the NavigationResourceThrottle. This 667 // This is an actual transfer. Inform the NavigationResourceThrottle. This
665 // will allow to mark the URLRequest as transferring. When it is marked as 668 // will allow to mark the URLRequest as transferring. When it is marked as
666 // transferring, the URLRequest can no longer be cancelled by its original 669 // transferring, the URLRequest can no longer be cancelled by its original
667 // RenderFrame. Instead it will persist until being picked up by the transfer 670 // RenderFrame. Instead it will persist until being picked up by the transfer
668 // RenderFrame, even if the original RenderFrame is destroyed. 671 // RenderFrame, even if the original RenderFrame is destroyed.
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
936 if (node->current_url().EqualsIgnoringRef(url_)) { 939 if (node->current_url().EqualsIgnoringRef(url_)) {
937 if (found_self_reference) 940 if (found_self_reference)
938 return true; 941 return true;
939 found_self_reference = true; 942 found_self_reference = true;
940 } 943 }
941 } 944 }
942 return false; 945 return false;
943 } 946 }
944 947
945 } // namespace content 948 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698