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

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

Issue 2023013002: Prevent renderer kills for in-page navigations on subframes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update tests and fix, clean up. Created 4 years, 6 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 HistoryEntry::HistoryNode* HistoryEntry::HistoryNode::CloneAndReplace( 57 HistoryEntry::HistoryNode* HistoryEntry::HistoryNode::CloneAndReplace(
58 const base::WeakPtr<HistoryEntry>& new_entry, 58 const base::WeakPtr<HistoryEntry>& new_entry,
59 const WebHistoryItem& new_item, 59 const WebHistoryItem& new_item,
60 bool clone_children_of_target, 60 bool clone_children_of_target,
61 RenderFrameImpl* target_frame, 61 RenderFrameImpl* target_frame,
62 RenderFrameImpl* current_frame) { 62 RenderFrameImpl* current_frame) {
63 bool is_target_frame = target_frame == current_frame; 63 bool is_target_frame = target_frame == current_frame;
64 const WebHistoryItem& item_for_create = is_target_frame ? new_item : item_; 64 const WebHistoryItem& item_for_create = is_target_frame ? new_item : item_;
65 HistoryNode* new_history_node = new HistoryNode(new_entry, item_for_create); 65 HistoryNode* new_history_node = new HistoryNode(new_entry, item_for_create);
66 66
67 if (is_target_frame && clone_children_of_target && !item_.isNull()) { 67 if (is_target_frame && clone_children_of_target &&
68 !current_frame->current_history_item().isNull()) {
68 new_history_node->item().setDocumentSequenceNumber( 69 new_history_node->item().setDocumentSequenceNumber(
69 item_.documentSequenceNumber()); 70 current_frame->current_history_item().documentSequenceNumber());
Charlie Reis 2016/06/03 19:20:36 This fixes BackToAboutBlankIframe and BackToIframe
Avi (use Gerrit) 2016/06/03 20:26:57 Pull out |current_frame->current_history_item()| w
Charlie Reis 2016/06/03 20:53:28 Done.
70 } 71 }
71 72
72 // TODO(creis): This needs to be updated to handle HistoryEntry in 73 // TODO(creis): This needs to be updated to handle HistoryEntry in
73 // subframe processes, where the main frame isn't guaranteed to be in the 74 // subframe processes, where the main frame isn't guaranteed to be in the
74 // same process. 75 // same process.
75 if (current_frame && (clone_children_of_target || !is_target_frame)) { 76 if (current_frame && (clone_children_of_target || !is_target_frame)) {
76 for (WebFrame* child = current_frame->GetWebFrame()->firstChild(); child; 77 for (WebFrame* child = current_frame->GetWebFrame()->firstChild(); child;
77 child = child->nextSibling()) { 78 child = child->nextSibling()) {
78 RenderFrameImpl* child_render_frame = 79 RenderFrameImpl* child_render_frame =
79 RenderFrameImpl::FromWebFrame(child); 80 RenderFrameImpl::FromWebFrame(child);
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 return unique_names_to_items_[frame->GetWebFrame()->uniqueName().utf8()]; 160 return unique_names_to_items_[frame->GetWebFrame()->uniqueName().utf8()];
160 } 161 }
161 162
162 WebHistoryItem HistoryEntry::GetItemForFrame(RenderFrameImpl* frame) { 163 WebHistoryItem HistoryEntry::GetItemForFrame(RenderFrameImpl* frame) {
163 if (HistoryNode* history_node = GetHistoryNodeForFrame(frame)) 164 if (HistoryNode* history_node = GetHistoryNodeForFrame(frame))
164 return history_node->item(); 165 return history_node->item();
165 return WebHistoryItem(); 166 return WebHistoryItem();
166 } 167 }
167 168
168 } // namespace content 169 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698