Chromium Code Reviews| 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 e23141e1fb0ba7a4916fff43a41a8033ca04ef90..1180e8a9d848840158bb86087c2079e54566182b 100644 |
| --- a/ios/web/web_state/ui/crw_web_controller.mm |
| +++ b/ios/web/web_state/ui/crw_web_controller.mm |
| @@ -1864,7 +1864,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->HasOpener()) { |
| // 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. |
| @@ -2195,8 +2195,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->HasOpener() && |
| + !_userInteractedWithWebController; |
| BOOL noNavigationItems = !(self.navigationManagerImpl->GetItemCount()); |
| return rendererInitiatedWithoutInteraction || noNavigationItems; |
| } |
| @@ -4216,8 +4217,8 @@ - (WKWebView*)webView:(WKWebView*)webView |
| CRWWebController* childWebController = |
| static_cast<WebStateImpl*>(childWebState)->GetWebController(); |
| - DCHECK(!childWebController || |
| - childWebController.sessionController.openedByDOM); |
| + DCHECK(!childWebController || (childWebController.webState && |
| + childWebController.webState->HasOpener())); |
| // WKWebView requires WKUIDelegate to return a child view created with |
| // exactly the same |configuration| object (exception is raised if config is |
| @@ -4230,9 +4231,8 @@ - (WKWebView*)webView:(WKWebView*)webView |
| } |
| - (void)webViewDidClose:(WKWebView*)webView { |
| - if (self.sessionController.openedByDOM) { |
| + if (self.webState && self.webState->HasOpener()) |
|
Eugene But (OOO till 7-30)
2017/03/18 00:33:30
|self.webState && self.webState->HasOpener()| is q
kkhorimoto
2017/03/20 22:39:20
Done.
|
| _webStateImpl->CloseWebState(); |
| - } |
| } |
| - (void)webView:(WKWebView*)webView |