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

Side by Side Diff: content/renderer/history_controller.cc

Issue 2136873002: Clear child FrameNavigationEntries if a history navigation redirects. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Clean up and disable test in --site-per-process. Created 4 years, 5 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 /* 5 /*
6 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 6 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
9 * (http://www.torchmobile.com/) 9 * (http://www.torchmobile.com/)
10 * 10 *
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 } 170 }
171 171
172 void HistoryController::UpdateForInitialLoadInChildFrame( 172 void HistoryController::UpdateForInitialLoadInChildFrame(
173 RenderFrameImpl* frame, 173 RenderFrameImpl* frame,
174 const WebHistoryItem& item) { 174 const WebHistoryItem& item) {
175 DCHECK_NE(frame->GetWebFrame()->top(), frame->GetWebFrame()); 175 DCHECK_NE(frame->GetWebFrame()->top(), frame->GetWebFrame());
176 if (!current_entry_) 176 if (!current_entry_)
177 return; 177 return;
178 if (HistoryEntry::HistoryNode* existing_node = 178 if (HistoryEntry::HistoryNode* existing_node =
179 current_entry_->GetHistoryNodeForFrame(frame)) { 179 current_entry_->GetHistoryNodeForFrame(frame)) {
180 // Clear the children and any NavigationParams if this commit isn't for
181 // the same item. Otherwise we might have stale data after a redirect.
182 if (existing_node->item().itemSequenceNumber() !=
183 item.itemSequenceNumber()) {
184 existing_node->RemoveChildren();
185 navigation_params_.reset();
186 }
Charlie Reis 2016/07/15 22:42:59 This is actually the same fix I made to UpdateForC
180 existing_node->set_item(item); 187 existing_node->set_item(item);
181 return; 188 return;
182 } 189 }
183 RenderFrameImpl* parent = 190 RenderFrameImpl* parent =
184 RenderFrameImpl::FromWebFrame(frame->GetWebFrame()->parent()); 191 RenderFrameImpl::FromWebFrame(frame->GetWebFrame()->parent());
185 if (!parent) 192 if (!parent)
186 return; 193 return;
187 if (HistoryEntry::HistoryNode* parent_history_node = 194 if (HistoryEntry::HistoryNode* parent_history_node =
188 current_entry_->GetHistoryNodeForFrame(parent)) { 195 current_entry_->GetHistoryNodeForFrame(parent)) {
189 parent_history_node->AddChild(item); 196 parent_history_node->AddChild(item);
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 bool clone_children_of_target) { 326 bool clone_children_of_target) {
320 if (!current_entry_) { 327 if (!current_entry_) {
321 current_entry_.reset(new HistoryEntry(new_item)); 328 current_entry_.reset(new HistoryEntry(new_item));
322 } else { 329 } else {
323 current_entry_.reset(current_entry_->CloneAndReplace( 330 current_entry_.reset(current_entry_->CloneAndReplace(
324 new_item, clone_children_of_target, target_frame, render_view_)); 331 new_item, clone_children_of_target, target_frame, render_view_));
325 } 332 }
326 } 333 }
327 334
328 } // namespace content 335 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698