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

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

Issue 2415173002: Fix regression where navigating to debug URLs didn't update the omnibox. (Closed)
Patch Set: remove redundant check 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 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 controller_->GetLastCommittedEntryIndex(), 416 controller_->GetLastCommittedEntryIndex(),
417 controller_->GetEntryCount())); 417 controller_->GetEntryCount()));
418 } 418 }
419 } 419 }
420 420
421 // Make sure no code called via RFH::Navigate clears the pending entry. 421 // Make sure no code called via RFH::Navigate clears the pending entry.
422 if (is_pending_entry) 422 if (is_pending_entry)
423 CHECK_EQ(controller_->GetPendingEntry(), &entry); 423 CHECK_EQ(controller_->GetPendingEntry(), &entry);
424 424
425 if (controller_->GetPendingEntryIndex() == -1 && 425 if (controller_->GetPendingEntryIndex() == -1 &&
426 IsRendererDebugURL(dest_url)) { 426 dest_url.SchemeIs(url::kJavaScriptScheme)) {
427 // If the pending entry index is -1 (which means a new navigation rather 427 // If the pending entry index is -1 (which means a new navigation rather
428 // than a history one), and the user typed in a debug URL, don't add it to 428 // than a history one), and the user typed in a javascript: URL, don't add
429 // the session history. 429 // it to the session history.
430 // 430 //
431 // This is a hack. What we really want is to avoid adding to the history any 431 // This is a hack. What we really want is to avoid adding to the history any
432 // URL that doesn't generate content, and what would be great would be if we 432 // URL that doesn't generate content, and what would be great would be if we
433 // had a message from the renderer telling us that a new page was not 433 // had a message from the renderer telling us that a new page was not
434 // created. The same message could be used for mailto: URLs and the like. 434 // created. The same message could be used for mailto: URLs and the like.
435 return false; 435 return false;
436 } 436 }
437 437
438 // Notify observers about navigation. 438 // Notify observers about navigation.
439 if (delegate_ && is_pending_entry) 439 if (delegate_ && is_pending_entry)
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
981 981
982 // PlzNavigate 982 // PlzNavigate
983 void NavigatorImpl::FailedNavigation(FrameTreeNode* frame_tree_node, 983 void NavigatorImpl::FailedNavigation(FrameTreeNode* frame_tree_node,
984 bool has_stale_copy_in_cache, 984 bool has_stale_copy_in_cache,
985 int error_code) { 985 int error_code) {
986 CHECK(IsBrowserSideNavigationEnabled()); 986 CHECK(IsBrowserSideNavigationEnabled());
987 987
988 NavigationRequest* navigation_request = frame_tree_node->navigation_request(); 988 NavigationRequest* navigation_request = frame_tree_node->navigation_request();
989 DCHECK(navigation_request); 989 DCHECK(navigation_request);
990 990
991 DiscardPendingEntryIfNeeded(navigation_request->navigation_handle()); 991 // With PlzNavigate, debug URLs will give a failed navigation because the
992 // WebUI backend won't find a handler for them. They will be processed in the
993 // renderer, however do not discard the pending entry so that the URL bar
994 // shows them correctly.
995 if (!IsRendererDebugURL(navigation_request->navigation_handle()->GetURL()))
996 DiscardPendingEntryIfNeeded(navigation_request->navigation_handle());
992 997
993 // If the request was canceled by the user do not show an error page. 998 // If the request was canceled by the user do not show an error page.
994 if (error_code == net::ERR_ABORTED) { 999 if (error_code == net::ERR_ABORTED) {
995 frame_tree_node->ResetNavigationRequest(false); 1000 frame_tree_node->ResetNavigationRequest(false);
996 return; 1001 return;
997 } 1002 }
998 1003
999 // Select an appropriate renderer to show the error page. 1004 // Select an appropriate renderer to show the error page.
1000 RenderFrameHostImpl* render_frame_host = 1005 RenderFrameHostImpl* render_frame_host =
1001 frame_tree_node->render_manager()->GetFrameHostForNavigation( 1006 frame_tree_node->render_manager()->GetFrameHostForNavigation(
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
1237 if (navigation_handle) 1242 if (navigation_handle)
1238 navigation_handle->update_entry_id_for_transfer(entry->GetUniqueID()); 1243 navigation_handle->update_entry_id_for_transfer(entry->GetUniqueID());
1239 1244
1240 controller_->SetPendingEntry(std::move(entry)); 1245 controller_->SetPendingEntry(std::move(entry));
1241 if (delegate_) 1246 if (delegate_)
1242 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); 1247 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL);
1243 } 1248 }
1244 } 1249 }
1245 1250
1246 } // namespace content 1251 } // 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