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

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

Issue 2423243002: Fix regression where navigating to debug URLs didn't update the omnibox. (Closed)
Patch Set: Created 4 years, 2 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 | « chrome/browser/crash_recovery_browsertest.cc ('k') | 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 #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/logging.h" 9 #include "base/logging.h"
10 #include "base/metrics/histogram_macros.h" 10 #include "base/metrics/histogram_macros.h"
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 dest_render_frame_host->GetProcess()->ResumeDeferredNavigation( 412 dest_render_frame_host->GetProcess()->ResumeDeferredNavigation(
413 entry.transferred_global_request_id()); 413 entry.transferred_global_request_id());
414 } 414 }
415 } 415 }
416 416
417 // Make sure no code called via RFH::Navigate clears the pending entry. 417 // Make sure no code called via RFH::Navigate clears the pending entry.
418 if (is_pending_entry) 418 if (is_pending_entry)
419 CHECK_EQ(controller_->GetPendingEntry(), &entry); 419 CHECK_EQ(controller_->GetPendingEntry(), &entry);
420 420
421 if (controller_->GetPendingEntryIndex() == -1 && 421 if (controller_->GetPendingEntryIndex() == -1 &&
422 IsRendererDebugURL(dest_url)) { 422 dest_url.SchemeIs(url::kJavaScriptScheme)) {
423 // If the pending entry index is -1 (which means a new navigation rather 423 // If the pending entry index is -1 (which means a new navigation rather
424 // than a history one), and the user typed in a debug URL, don't add it to 424 // than a history one), and the user typed in a javascript: URL, don't add
425 // the session history. 425 // it to the session history.
426 // 426 //
427 // This is a hack. What we really want is to avoid adding to the history any 427 // This is a hack. What we really want is to avoid adding to the history any
428 // URL that doesn't generate content, and what would be great would be if we 428 // URL that doesn't generate content, and what would be great would be if we
429 // had a message from the renderer telling us that a new page was not 429 // had a message from the renderer telling us that a new page was not
430 // created. The same message could be used for mailto: URLs and the like. 430 // created. The same message could be used for mailto: URLs and the like.
431 return false; 431 return false;
432 } 432 }
433 433
434 // Notify observers about navigation. 434 // Notify observers about navigation.
435 if (delegate_ && is_pending_entry) 435 if (delegate_ && is_pending_entry)
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
973 973
974 // PlzNavigate 974 // PlzNavigate
975 void NavigatorImpl::FailedNavigation(FrameTreeNode* frame_tree_node, 975 void NavigatorImpl::FailedNavigation(FrameTreeNode* frame_tree_node,
976 bool has_stale_copy_in_cache, 976 bool has_stale_copy_in_cache,
977 int error_code) { 977 int error_code) {
978 CHECK(IsBrowserSideNavigationEnabled()); 978 CHECK(IsBrowserSideNavigationEnabled());
979 979
980 NavigationRequest* navigation_request = frame_tree_node->navigation_request(); 980 NavigationRequest* navigation_request = frame_tree_node->navigation_request();
981 DCHECK(navigation_request); 981 DCHECK(navigation_request);
982 982
983 DiscardPendingEntryIfNeeded(navigation_request->navigation_handle()); 983 // With PlzNavigate, debug URLs will give a failed navigation because the
984 // WebUI backend won't find a handler for them. They will be processed in the
985 // renderer, however do not discard the pending entry so that the URL bar
986 // shows them correctly.
987 if (!IsRendererDebugURL(navigation_request->navigation_handle()->GetURL()))
988 DiscardPendingEntryIfNeeded(navigation_request->navigation_handle());
984 989
985 // If the request was canceled by the user do not show an error page. 990 // If the request was canceled by the user do not show an error page.
986 if (error_code == net::ERR_ABORTED) { 991 if (error_code == net::ERR_ABORTED) {
987 frame_tree_node->ResetNavigationRequest(false); 992 frame_tree_node->ResetNavigationRequest(false);
988 return; 993 return;
989 } 994 }
990 995
991 // Select an appropriate renderer to show the error page. 996 // Select an appropriate renderer to show the error page.
992 RenderFrameHostImpl* render_frame_host = 997 RenderFrameHostImpl* render_frame_host =
993 frame_tree_node->render_manager()->GetFrameHostForNavigation( 998 frame_tree_node->render_manager()->GetFrameHostForNavigation(
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
1229 if (navigation_handle) 1234 if (navigation_handle)
1230 navigation_handle->update_entry_id_for_transfer(entry->GetUniqueID()); 1235 navigation_handle->update_entry_id_for_transfer(entry->GetUniqueID());
1231 1236
1232 controller_->SetPendingEntry(std::move(entry)); 1237 controller_->SetPendingEntry(std::move(entry));
1233 if (delegate_) 1238 if (delegate_)
1234 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); 1239 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL);
1235 } 1240 }
1236 } 1241 }
1237 1242
1238 } // namespace content 1243 } // namespace content
OLDNEW
« no previous file with comments | « chrome/browser/crash_recovery_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698