Chromium Code Reviews| Index: ios/chrome/browser/tabs/tab_model.mm |
| diff --git a/ios/chrome/browser/tabs/tab_model.mm b/ios/chrome/browser/tabs/tab_model.mm |
| index 193dd1f2225c928b458b6e721b8a817aa3b2a4f4..6256932e24718f4af85a42743779b796c75330b9 100644 |
| --- a/ios/chrome/browser/tabs/tab_model.mm |
| +++ b/ios/chrome/browser/tabs/tab_model.mm |
| @@ -593,8 +593,14 @@ - (NSSet*)currentlyReferencedExternalFiles { |
| return referencedFiles; |
| // Check the currently open tabs for external files. |
| for (Tab* tab in self) { |
| - if (UrlIsExternalFileReference(tab.url)) { |
| - NSString* fileName = base::SysUTF8ToNSString(tab.url.ExtractFileName()); |
| + const GURL& lastCommittedURL = tab.lastCommittedURL; |
| + web::NavigationItem* pendingItem = |
| + tab.webState->GetNavigationManager()->GetPendingItem(); |
| + const GURL& pendingURL = |
| + pendingItem ? pendingItem->GetURL() : GURL::EmptyGURL(); |
| + if (UrlIsExternalFileReference(lastCommittedURL) || |
| + UrlIsExternalFileReference(pendingURL)) { |
| + NSString* fileName = base::SysUTF8ToNSString(URL.ExtractFileName()); |
|
Eugene But (OOO till 7-30)
2017/05/31 22:43:11
Does it compile? I can't fine |URL| variable.
kkhorimoto
2017/06/01 17:55:33
Whoop, I think I accidentally reverted or somethin
|
| [referencedFiles addObject:fileName]; |
| } |
| } |
| @@ -748,7 +754,9 @@ - (BOOL)restoreSessionWindow:(SessionWindowIOS*)window |
| BOOL closedNTPTab = NO; |
| if (oldCount == 1) { |
| Tab* tab = [self tabAtIndex:0]; |
| - if (tab.url == GURL(kChromeUINewTabURL)) { |
| + BOOL hasPendingLoad = |
| + tab.webState->GetNavigationManager()->GetPendingItem() != nullptr; |
| + if (!hasPendingLoad && tab.lastCommittedURL == GURL(kChromeUINewTabURL)) { |
| [self closeTab:tab]; |
| closedNTPTab = YES; |
| oldCount = 0; |