Index: ios/web/web_state/ui/crw_web_controller.mm |
diff --git a/ios/web/web_state/ui/crw_web_controller.mm b/ios/web/web_state/ui/crw_web_controller.mm |
index 199b341d988e8f1f163d987ac72d22312fe1f674..7cbab69e411e6653a2b2182887695a8558b53dab 100644 |
--- a/ios/web/web_state/ui/crw_web_controller.mm |
+++ b/ios/web/web_state/ui/crw_web_controller.mm |
@@ -1929,7 +1929,7 @@ - (void)loadCurrentURL { |
![_nativeProvider hasControllerForURL:currentURL]) { |
if (!(item->GetTransitionType() & ui::PAGE_TRANSITION_TYPED || |
item->GetTransitionType() & ui::PAGE_TRANSITION_AUTO_BOOKMARK) && |
- self.sessionController.openedByDOM) { |
+ self.webState && self.webState->IsOpenedByDOM()) { |
// WebUI URLs can not be opened by DOM to prevent cross-site scripting as |
// they have increased power. WebUI URLs may only be opened when the user |
// types in the URL or use bookmarks. |
@@ -2304,8 +2304,9 @@ - (BOOL)shouldClosePageOnNativeApplicationLoad { |
// no user interaction with the page since the web view was created, or if |
// the page has no navigation items, as occurs when an App Store link is |
// opened from another application. |
- BOOL rendererInitiatedWithoutInteraction = |
- self.sessionController.openedByDOM && !_userInteractedWithWebController; |
+ BOOL rendererInitiatedWithoutInteraction = self.webState && |
+ self.webState->IsOpenedByDOM() && |
+ !_userInteractedWithWebController; |
BOOL noNavigationItems = !(self.navigationManagerImpl->GetItemCount()); |
return rendererInitiatedWithoutInteraction || noNavigationItems; |
} |
@@ -4335,8 +4336,8 @@ - (WKWebView*)webView:(WKWebView*)webView |
CRWWebController* childWebController = |
static_cast<WebStateImpl*>(childWebState)->GetWebController(); |
- DCHECK(!childWebController || |
- childWebController.sessionController.openedByDOM); |
+ DCHECK(!childWebController || (childWebController.webState && |
+ childWebController.webState->IsOpenedByDOM())); |
// WKWebView requires WKUIDelegate to return a child view created with |
// exactly the same |configuration| object (exception is raised if config is |
@@ -4349,9 +4350,8 @@ - (WKWebView*)webView:(WKWebView*)webView |
} |
- (void)webViewDidClose:(WKWebView*)webView { |
- if (self.sessionController.openedByDOM) { |
+ if (self.webState && self.webState->IsOpenedByDOM()) |
_webStateImpl->CloseWebState(); |
- } |
} |
- (void)webView:(WKWebView*)webView |