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

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

Issue 2701523004: Add DumpWithoutCrashing in RendererDidNavigateToExistingPage (Closed)
Patch Set: jam comments Created 3 years, 10 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 | no next file » | 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 /* 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 21 matching lines...) Expand all
32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
33 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 */ 34 */
35 35
36 #include "content/browser/frame_host/navigation_controller_impl.h" 36 #include "content/browser/frame_host/navigation_controller_impl.h"
37 37
38 #include <utility> 38 #include <utility>
39 39
40 #include "base/bind.h" 40 #include "base/bind.h"
41 #include "base/command_line.h" 41 #include "base/command_line.h"
42 #include "base/debug/alias.h"
42 #include "base/debug/dump_without_crashing.h" 43 #include "base/debug/dump_without_crashing.h"
43 #include "base/logging.h" 44 #include "base/logging.h"
44 #include "base/memory/ptr_util.h" 45 #include "base/memory/ptr_util.h"
45 #include "base/metrics/histogram_macros.h" 46 #include "base/metrics/histogram_macros.h"
46 #include "base/strings/string_number_conversions.h" // Temporary 47 #include "base/strings/string_number_conversions.h" // Temporary
47 #include "base/strings/string_util.h" 48 #include "base/strings/string_util.h"
48 #include "base/strings/utf_string_conversions.h" 49 #include "base/strings/utf_string_conversions.h"
49 #include "base/time/time.h" 50 #include "base/time/time.h"
50 #include "base/trace_event/trace_event.h" 51 #include "base/trace_event/trace_event.h"
51 #include "build/build_config.h" 52 #include "build/build_config.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 return true; 158 return true;
158 } 159 }
159 160
160 if (ui::PageTransitionCoreTypeIs(entry->GetTransitionType(), 161 if (ui::PageTransitionCoreTypeIs(entry->GetTransitionType(),
161 ui::PAGE_TRANSITION_LINK)) { 162 ui::PAGE_TRANSITION_LINK)) {
162 return true; 163 return true;
163 } 164 }
164 return false; 165 return false;
165 } 166 }
166 167
168 // TODO(estark): remove this DumpWithoutCrashing after investigating
169 // https://crbug.com/688425.
170 void MaybeDumpCopiedNonSameOriginEntry(
171 const std::string& navigation_description,
172 const FrameHostMsg_DidCommitProvisionalLoad_Params& params,
173 bool is_in_page,
174 NavigationEntry* entry) {
175 if (!entry)
176 return;
177 if (url::Origin(entry->GetURL()).IsSameOriginWith(url::Origin(params.url)))
178 return;
179
180 std::string debug_info =
181 navigation_description + ": " +
182 std::string(is_in_page ? "Is in page, " : "Is not in page, ") +
183 std::string(params.nav_entry_id ? "has nav entry id, "
184 : "does not have nav entry id, ") +
185 std::string(params.did_create_new_entry ? "did create new entry, "
186 : "did not create new entry, ") +
187 std::string(params.should_replace_current_entry
188 ? "should replace current entry, "
189 : "should not replace current entry, ") +
190 entry->GetURL().spec() + " -> " + params.url.spec();
191 char debug_buf[2000];
192 base::strlcpy(debug_buf, debug_info.c_str(), arraysize(debug_buf));
193 base::debug::Alias(&debug_buf);
194 base::debug::DumpWithoutCrashing();
195 }
196
167 } // namespace 197 } // namespace
168 198
169 // NavigationControllerImpl ---------------------------------------------------- 199 // NavigationControllerImpl ----------------------------------------------------
170 200
171 const size_t kMaxEntryCountForTestingNotSet = static_cast<size_t>(-1); 201 const size_t kMaxEntryCountForTestingNotSet = static_cast<size_t>(-1);
172 202
173 // static 203 // static
174 size_t NavigationControllerImpl::max_entry_count_for_testing_ = 204 size_t NavigationControllerImpl::max_entry_count_for_testing_ =
175 kMaxEntryCountForTestingNotSet; 205 kMaxEntryCountForTestingNotSet;
176 206
(...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after
1098 params.url, params.referrer, params.method, params.post_id); 1128 params.url, params.referrer, params.method, params.post_id);
1099 new_entry = GetLastCommittedEntry()->CloneAndReplace( 1129 new_entry = GetLastCommittedEntry()->CloneAndReplace(
1100 frame_entry, true, rfh->frame_tree_node(), 1130 frame_entry, true, rfh->frame_tree_node(),
1101 delegate_->GetFrameTree()->root()); 1131 delegate_->GetFrameTree()->root());
1102 1132
1103 // We expect |frame_entry| to be owned by |new_entry|. This should never 1133 // We expect |frame_entry| to be owned by |new_entry|. This should never
1104 // fail, because it's the main frame. 1134 // fail, because it's the main frame.
1105 CHECK(frame_entry->HasOneRef()); 1135 CHECK(frame_entry->HasOneRef());
1106 1136
1107 update_virtual_url = new_entry->update_virtual_url_with_url(); 1137 update_virtual_url = new_entry->update_virtual_url_with_url();
1138
1139 MaybeDumpCopiedNonSameOriginEntry("New page navigation", params, is_in_page,
1140 GetLastCommittedEntry());
1108 } 1141 }
1109 1142
1110 // Only make a copy of the pending entry if it is appropriate for the new page 1143 // Only make a copy of the pending entry if it is appropriate for the new page
1111 // that was just loaded. Verify this by checking if the entry corresponds 1144 // that was just loaded. Verify this by checking if the entry corresponds
1112 // to the given navigation handle. Additionally, coarsely check that: 1145 // to the given navigation handle. Additionally, coarsely check that:
1113 // 1. The SiteInstance hasn't been assigned to something else. 1146 // 1. The SiteInstance hasn't been assigned to something else.
1114 // 2. The pending entry was intended as a new entry, rather than being a 1147 // 2. The pending entry was intended as a new entry, rather than being a
1115 // history navigation that was interrupted by an unrelated, 1148 // history navigation that was interrupted by an unrelated,
1116 // renderer-initiated navigation. 1149 // renderer-initiated navigation.
1117 // TODO(csharrison): Investigate whether we can remove some of the coarser 1150 // TODO(csharrison): Investigate whether we can remove some of the coarser
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
1202 1235
1203 // TODO(creis): Classify location.replace as NEW_PAGE instead of EXISTING_PAGE 1236 // TODO(creis): Classify location.replace as NEW_PAGE instead of EXISTING_PAGE
1204 // in https://crbug.com/596707. 1237 // in https://crbug.com/596707.
1205 1238
1206 NavigationEntryImpl* entry; 1239 NavigationEntryImpl* entry;
1207 if (params.intended_as_new_entry) { 1240 if (params.intended_as_new_entry) {
1208 // This was intended as a new entry but the pending entry was lost in the 1241 // This was intended as a new entry but the pending entry was lost in the
1209 // meanwhile and no new page was created. We are stuck at the last committed 1242 // meanwhile and no new page was created. We are stuck at the last committed
1210 // entry. 1243 // entry.
1211 entry = GetLastCommittedEntry(); 1244 entry = GetLastCommittedEntry();
1245 MaybeDumpCopiedNonSameOriginEntry("Existing page navigation", params,
1246 is_in_page, entry);
1212 } else if (params.nav_entry_id) { 1247 } else if (params.nav_entry_id) {
1213 // This is a browser-initiated navigation (back/forward/reload). 1248 // This is a browser-initiated navigation (back/forward/reload).
1214 entry = GetEntryWithUniqueID(params.nav_entry_id); 1249 entry = GetEntryWithUniqueID(params.nav_entry_id);
1215 1250
1216 // Needed for the restore case, where the serialized NavigationEntry doesn't 1251 // Needed for the restore case, where the serialized NavigationEntry doesn't
1217 // have the SSL state. Note that for in-page navigation, there's no 1252 // have the SSL state. Note that for in-page navigation, there's no
1218 // SSLStatus in the NavigationHandle so don't overwrite the existing entry's 1253 // SSLStatus in the NavigationHandle so don't overwrite the existing entry's
1219 // SSLStatus. 1254 // SSLStatus.
1220 if (!is_in_page) 1255 if (!is_in_page)
1221 entry->GetSSL() = handle->ssl_status(); 1256 entry->GetSSL() = handle->ssl_status();
(...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after
2134 } 2169 }
2135 } 2170 }
2136 } 2171 }
2137 2172
2138 void NavigationControllerImpl::SetGetTimestampCallbackForTest( 2173 void NavigationControllerImpl::SetGetTimestampCallbackForTest(
2139 const base::Callback<base::Time()>& get_timestamp_callback) { 2174 const base::Callback<base::Time()>& get_timestamp_callback) {
2140 get_timestamp_callback_ = get_timestamp_callback; 2175 get_timestamp_callback_ = get_timestamp_callback;
2141 } 2176 }
2142 2177
2143 } // namespace content 2178 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698