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

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: Rebase filter file 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
« no previous file with comments | « content/renderer/history_controller.cc ('k') | content/renderer/render_frame_impl.h » ('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 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 // Use the last committed history item for the frame rather than item_, since
68 // the latter may not accurately reflect which URL is currently committed in
69 // the frame. See https://crbug.com/612713#c12.
70 const WebHistoryItem& current_item = current_frame->current_history_item();
71 if (is_target_frame && clone_children_of_target && !current_item.isNull()) {
68 new_history_node->item().setDocumentSequenceNumber( 72 new_history_node->item().setDocumentSequenceNumber(
69 item_.documentSequenceNumber()); 73 current_item.documentSequenceNumber());
70 } 74 }
71 75
72 // TODO(creis): This needs to be updated to handle HistoryEntry in 76 // 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 77 // subframe processes, where the main frame isn't guaranteed to be in the
74 // same process. 78 // same process.
75 if (current_frame && (clone_children_of_target || !is_target_frame)) { 79 if (current_frame && (clone_children_of_target || !is_target_frame)) {
76 for (WebFrame* child = current_frame->GetWebFrame()->firstChild(); child; 80 for (WebFrame* child = current_frame->GetWebFrame()->firstChild(); child;
77 child = child->nextSibling()) { 81 child = child->nextSibling()) {
78 RenderFrameImpl* child_render_frame = 82 RenderFrameImpl* child_render_frame =
79 RenderFrameImpl::FromWebFrame(child); 83 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()]; 163 return unique_names_to_items_[frame->GetWebFrame()->uniqueName().utf8()];
160 } 164 }
161 165
162 WebHistoryItem HistoryEntry::GetItemForFrame(RenderFrameImpl* frame) { 166 WebHistoryItem HistoryEntry::GetItemForFrame(RenderFrameImpl* frame) {
163 if (HistoryNode* history_node = GetHistoryNodeForFrame(frame)) 167 if (HistoryNode* history_node = GetHistoryNodeForFrame(frame))
164 return history_node->item(); 168 return history_node->item();
165 return WebHistoryItem(); 169 return WebHistoryItem();
166 } 170 }
167 171
168 } // namespace content 172 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/history_controller.cc ('k') | content/renderer/render_frame_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698