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

Side by Side Diff: ios/web/navigation/crw_session_controller.mm

Issue 2775023002: add DCHECK that a server redirect pending item should never be added. (Closed)
Patch Set: Created 3 years, 8 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 #import "ios/web/navigation/crw_session_controller.h" 5 #import "ios/web/navigation/crw_session_controller.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <utility> 10 #include <utility>
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 - (void)setBrowserState:(web::BrowserState*)browserState { 278 - (void)setBrowserState:(web::BrowserState*)browserState {
279 _browserState = browserState; 279 _browserState = browserState;
280 DCHECK(!_navigationManager || 280 DCHECK(!_navigationManager ||
281 _navigationManager->GetBrowserState() == _browserState); 281 _navigationManager->GetBrowserState() == _browserState);
282 } 282 }
283 283
284 - (void)addPendingItem:(const GURL&)url 284 - (void)addPendingItem:(const GURL&)url
285 referrer:(const web::Referrer&)ref 285 referrer:(const web::Referrer&)ref
286 transition:(ui::PageTransition)trans 286 transition:(ui::PageTransition)trans
287 initiationType:(web::NavigationInitiationType)initiationType { 287 initiationType:(web::NavigationInitiationType)initiationType {
288 // Server side redirects are handled by updating existing pending item instead
289 // of adding a new item.
290 DCHECK((trans & ui::PAGE_TRANSITION_SERVER_REDIRECT) == 0);
291
288 [self discardTransientItem]; 292 [self discardTransientItem];
289 self.pendingItemIndex = -1; 293 self.pendingItemIndex = -1;
290 294
291 // Don't create a new item if it's already the same as the current item, 295 // Don't create a new item if it's already the same as the current item,
292 // allowing this routine to be called multiple times in a row without issue. 296 // allowing this routine to be called multiple times in a row without issue.
293 // Note: CRWSessionController currently has the responsibility to distinguish 297 // Note: CRWSessionController currently has the responsibility to distinguish
294 // between new navigations and history stack navigation, hence the inclusion 298 // between new navigations and history stack navigation, hence the inclusion
295 // of specific transiton type logic here, in order to make it reliable with 299 // of specific transiton type logic here, in order to make it reliable with
296 // real-world observed behavior. 300 // real-world observed behavior.
297 // TODO(crbug.com/676129): Fix the way changes are detected/reported elsewhere 301 // TODO(crbug.com/676129): Fix the way changes are detected/reported elsewhere
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 return item; 625 return item;
622 } 626 }
623 627
624 - (BOOL)isRedirectTransitionForItemAtIndex:(size_t)index { 628 - (BOOL)isRedirectTransitionForItemAtIndex:(size_t)index {
625 DCHECK_LT(index, self.items.size()); 629 DCHECK_LT(index, self.items.size());
626 ui::PageTransition transition = self.items[index]->GetTransitionType(); 630 ui::PageTransition transition = self.items[index]->GetTransitionType();
627 return (transition & ui::PAGE_TRANSITION_IS_REDIRECT_MASK) ? YES : NO; 631 return (transition & ui::PAGE_TRANSITION_IS_REDIRECT_MASK) ? YES : NO;
628 } 632 }
629 633
630 @end 634 @end
OLDNEW
« no previous file with comments | « ios/chrome/browser/web/navigation_manager_util_unittest.mm ('k') | ios/web/navigation/crw_session_controller_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698