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

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

Issue 1811783002: Disallow was_within_same_page = true for a cross-process navigation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2623
Patch Set: Created 4 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
« no previous file with comments | « no previous file | content/browser/frame_host/navigator_impl_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/navigator_impl.h" 5 #include "content/browser/frame_host/navigator_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 } 431 }
432 432
433 void NavigatorImpl::DidNavigate( 433 void NavigatorImpl::DidNavigate(
434 RenderFrameHostImpl* render_frame_host, 434 RenderFrameHostImpl* render_frame_host,
435 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) { 435 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) {
436 FrameTree* frame_tree = render_frame_host->frame_tree_node()->frame_tree(); 436 FrameTree* frame_tree = render_frame_host->frame_tree_node()->frame_tree();
437 bool oopifs_possible = SiteIsolationPolicy::AreCrossProcessFramesPossible(); 437 bool oopifs_possible = SiteIsolationPolicy::AreCrossProcessFramesPossible();
438 438
439 bool is_navigation_within_page = controller_->IsURLInPageNavigation( 439 bool is_navigation_within_page = controller_->IsURLInPageNavigation(
440 params.url, params.was_within_same_page, render_frame_host); 440 params.url, params.was_within_same_page, render_frame_host);
441
442 // If a frame claims it navigated within page, it must be the current frame,
443 // not a pending one.
444 if (is_navigation_within_page &&
445 render_frame_host !=
446 render_frame_host->frame_tree_node()
447 ->render_manager()
448 ->current_frame_host()) {
449 bad_message::ReceivedBadMessage(render_frame_host->GetProcess(),
450 bad_message::NC_IN_PAGE_NAVIGATION);
451 is_navigation_within_page = false;
452 }
453
441 if (ui::PageTransitionIsMainFrame(params.transition)) { 454 if (ui::PageTransitionIsMainFrame(params.transition)) {
442 if (delegate_) { 455 if (delegate_) {
443 // When overscroll navigation gesture is enabled, a screenshot of the page 456 // When overscroll navigation gesture is enabled, a screenshot of the page
444 // in its current state is taken so that it can be used during the 457 // in its current state is taken so that it can be used during the
445 // nav-gesture. It is necessary to take the screenshot here, before 458 // nav-gesture. It is necessary to take the screenshot here, before
446 // calling RenderFrameHostManager::DidNavigateMainFrame, because that can 459 // calling RenderFrameHostManager::DidNavigateMainFrame, because that can
447 // change WebContents::GetRenderViewHost to return the new host, instead 460 // change WebContents::GetRenderViewHost to return the new host, instead
448 // of the one that may have just been swapped out. 461 // of the one that may have just been swapped out.
449 if (delegate_->CanOverscrollContent()) { 462 if (delegate_->CanOverscrollContent()) {
450 // Don't take screenshots if we are staying on the same page. We want 463 // Don't take screenshots if we are staying on the same page. We want
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after
1038 entry->set_should_replace_entry(pending_entry->should_replace_entry()); 1051 entry->set_should_replace_entry(pending_entry->should_replace_entry());
1039 entry->SetRedirectChain(pending_entry->GetRedirectChain()); 1052 entry->SetRedirectChain(pending_entry->GetRedirectChain());
1040 } 1053 }
1041 controller_->SetPendingEntry(std::move(entry)); 1054 controller_->SetPendingEntry(std::move(entry));
1042 if (delegate_) 1055 if (delegate_)
1043 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); 1056 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL);
1044 } 1057 }
1045 } 1058 }
1046 1059
1047 } // namespace content 1060 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/frame_host/navigator_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698