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

Side by Side Diff: ios/web/web_state/ui/crw_web_controller.mm

Issue 2690033002: Set fromEntry to nil after discardNonCommittedItems. (Closed)
Patch Set: 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 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/web_state/ui/crw_web_controller.h" 5 #import "ios/web/web_state/ui/crw_web_controller.h"
6 6
7 #import <WebKit/WebKit.h> 7 #import <WebKit/WebKit.h>
8 8
9 #import <objc/runtime.h> 9 #import <objc/runtime.h>
10 #include <stddef.h> 10 #include <stddef.h>
(...skipping 2146 matching lines...) Expand 10 before | Expand all | Expand 10 after
2157 BOOL sameDocumentNavigation = [sessionController 2157 BOOL sameDocumentNavigation = [sessionController
2158 isSameDocumentNavigationBetweenItem:fromEntry.navigationItem 2158 isSameDocumentNavigationBetweenItem:fromEntry.navigationItem
2159 andItem:toEntry.navigationItem]; 2159 andItem:toEntry.navigationItem];
2160 if (sameDocumentNavigation) { 2160 if (sameDocumentNavigation) {
2161 [self.sessionController goToItemAtIndex:index]; 2161 [self.sessionController goToItemAtIndex:index];
2162 // TODO(crbug.com/684098): move this call out this block to avoid code 2162 // TODO(crbug.com/684098): move this call out this block to avoid code
2163 // duplication. 2163 // duplication.
2164 [self webWillFinishHistoryNavigationFromEntry:fromEntry]; 2164 [self webWillFinishHistoryNavigationFromEntry:fromEntry];
2165 [self updateHTML5HistoryState]; 2165 [self updateHTML5HistoryState];
2166 } else { 2166 } else {
2167 [sessionController discardNonCommittedItems]; 2167 [sessionController discardNonCommittedItems];
sdefresne 2017/02/13 10:47:36 I think we should instead retain the fromEntry, by
Olivier 2017/02/13 12:21:05 Thanks I cannot retain the fromEntry as CRWSessio
Olivier 2017/02/13 13:21:24 Done. PTAL.
2168 // TODO(crbug.com/691492): After discardNonCommittedItems, fromEntry may
2169 // not be valid anymore. Refetch it from the sessionController.
2170 // Remove when the fix is not needed anymore.
2171 fromEntry = sessionController.currentEntry;
2168 [sessionController setPendingItemIndex:index]; 2172 [sessionController setPendingItemIndex:index];
2169 2173
2170 // TODO(crbug.com/684098): move this call out this block to avoid code 2174 // TODO(crbug.com/684098): move this call out this block to avoid code
2171 // duplication. 2175 // duplication.
2172 [self webWillFinishHistoryNavigationFromEntry:fromEntry]; 2176 [self webWillFinishHistoryNavigationFromEntry:fromEntry];
2173 2177
2174 web::NavigationItemImpl* pendingItem = 2178 web::NavigationItemImpl* pendingItem =
2175 sessionController.pendingEntry.navigationItemImpl; 2179 sessionController.pendingEntry.navigationItemImpl;
2176 pendingItem->SetTransitionType(ui::PageTransitionFromInt( 2180 pendingItem->SetTransitionType(ui::PageTransitionFromInt(
2177 pendingItem->GetTransitionType() | ui::PAGE_TRANSITION_FORWARD_BACK)); 2181 pendingItem->GetTransitionType() | ui::PAGE_TRANSITION_FORWARD_BACK));
(...skipping 3136 matching lines...) Expand 10 before | Expand all | Expand 10 after
5314 - (void)simulateLoadRequestWithURL:(const GURL&)URL { 5318 - (void)simulateLoadRequestWithURL:(const GURL&)URL {
5315 _lastRegisteredRequestURL = URL; 5319 _lastRegisteredRequestURL = URL;
5316 _loadPhase = web::LOAD_REQUESTED; 5320 _loadPhase = web::LOAD_REQUESTED;
5317 } 5321 }
5318 5322
5319 - (NSString*)refererFromNavigationAction:(WKNavigationAction*)action { 5323 - (NSString*)refererFromNavigationAction:(WKNavigationAction*)action {
5320 return [action.request valueForHTTPHeaderField:@"Referer"]; 5324 return [action.request valueForHTTPHeaderField:@"Referer"];
5321 } 5325 }
5322 5326
5323 @end 5327 @end
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