0

[ios] Don't rely on nil webState in LocationBarCoordinator.

Bug: 934294
Change-Id: I3737b1560f138250206f9f1b8648d32ada9f0392
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1520702
Reviewed-by: Rohit Rao <rohitrao@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#641002}
This commit is contained in:
Justin Cohen
2019-03-15 00:05:25 +00:00
committed by Commit Bot
parent 532802dbc6
commit 012cf25029

@ -270,10 +270,12 @@ const int kLocationAuthorizationStatusCount = 4;
- (void)focusOmniboxFromSearchButton {
// TODO(crbug.com/931284): Temporary workaround for intermediate broken state
// in the NTP. Remove this once crbug.com/899827 is fixed.
NewTabPageTabHelper* NTPHelper =
NewTabPageTabHelper::FromWebState(self.webState);
if (NTPHelper && NTPHelper->IsActive() && NTPHelper->IgnoreLoadRequests()) {
return;
if (self.webState) {
NewTabPageTabHelper* NTPHelper =
NewTabPageTabHelper::FromWebState(self.webState);
if (NTPHelper && NTPHelper->IsActive() && NTPHelper->IgnoreLoadRequests()) {
return;
}
}
[self.omniboxCoordinator setNextFocusSourceAsSearchButton];
[self focusOmnibox];
@ -286,10 +288,12 @@ const int kLocationAuthorizationStatusCount = 4;
- (void)focusOmnibox {
// TODO(crbug.com/931284): Temporary workaround for intermediate broken state
// in the NTP. Remove this once crbug.com/899827 is fixed.
NewTabPageTabHelper* NTPHelper =
NewTabPageTabHelper::FromWebState(self.webState);
if (NTPHelper && NTPHelper->IsActive() && NTPHelper->IgnoreLoadRequests()) {
return;
if (self.webState) {
NewTabPageTabHelper* NTPHelper =
NewTabPageTabHelper::FromWebState(self.webState);
if (NTPHelper && NTPHelper->IsActive() && NTPHelper->IgnoreLoadRequests()) {
return;
}
}
// Dismiss the edit menu.
[[UIMenuController sharedMenuController] setMenuVisible:NO animated:NO];