| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_wk_web_view_web_controller.h" | 5 #import "ios/web/web_state/ui/crw_wk_web_view_web_controller.h" |
| 6 | 6 |
| 7 #import <WebKit/WebKit.h> | 7 #import <WebKit/WebKit.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 1787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1798 // lastRegisteredRequestURL may be the same as the webViewURL on a new tab | 1798 // lastRegisteredRequestURL may be the same as the webViewURL on a new tab |
| 1799 // created by window.open (default is about::blank). | 1799 // created by window.open (default is about::blank). |
| 1800 if (self.lastRegisteredRequestURL != webViewURL || | 1800 if (self.lastRegisteredRequestURL != webViewURL || |
| 1801 self.loadPhase != web::LOAD_REQUESTED) { | 1801 self.loadPhase != web::LOAD_REQUESTED) { |
| 1802 // Reset current WebUI if one exists. | 1802 // Reset current WebUI if one exists. |
| 1803 [self clearWebUI]; | 1803 [self clearWebUI]; |
| 1804 // Restart app specific URL loads to properly capture state. | 1804 // Restart app specific URL loads to properly capture state. |
| 1805 // TODO(crbug.com/546347): Extract necessary tasks for app specific URL | 1805 // TODO(crbug.com/546347): Extract necessary tasks for app specific URL |
| 1806 // navigation rather than restarting the load. | 1806 // navigation rather than restarting the load. |
| 1807 if (web::GetWebClient()->IsAppSpecificURL(webViewURL)) { | 1807 if (web::GetWebClient()->IsAppSpecificURL(webViewURL)) { |
| 1808 [self abortWebLoad]; | 1808 // Renderer-initiated loads of WebUI can be done only from other WebUI |
| 1809 web::WebLoadParams params(webViewURL); | 1809 // pages. WebUI pages may have increased power and using the same web |
| 1810 [self loadWithParams:params]; | 1810 // process (which may potentially be controller by an attacker) is |
| 1811 // dangerous. |
| 1812 if (web::GetWebClient()->IsAppSpecificURL(_documentURL)) { |
| 1813 [self abortWebLoad]; |
| 1814 web::WebLoadParams params(webViewURL); |
| 1815 [self loadWithParams:params]; |
| 1816 } |
| 1811 return; | 1817 return; |
| 1812 } else { | 1818 } else { |
| 1813 [self registerLoadRequest:webViewURL]; | 1819 [self registerLoadRequest:webViewURL]; |
| 1814 } | 1820 } |
| 1815 } | 1821 } |
| 1816 // Ensure the URL is registered and loadPhase is as expected. | 1822 // Ensure the URL is registered and loadPhase is as expected. |
| 1817 DCHECK(self.lastRegisteredRequestURL == webViewURL); | 1823 DCHECK(self.lastRegisteredRequestURL == webViewURL); |
| 1818 DCHECK(self.loadPhase == web::LOAD_REQUESTED); | 1824 DCHECK(self.loadPhase == web::LOAD_REQUESTED); |
| 1819 _latestWKNavigation.reset([navigation retain]); | 1825 _latestWKNavigation.reset([navigation retain]); |
| 1820 } | 1826 } |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2069 runJavaScriptTextInputPanelWithPrompt:prompt | 2075 runJavaScriptTextInputPanelWithPrompt:prompt |
| 2070 defaultText:defaultText | 2076 defaultText:defaultText |
| 2071 requestURL:requestURL | 2077 requestURL:requestURL |
| 2072 completionHandler:completionHandler]; | 2078 completionHandler:completionHandler]; |
| 2073 } else if (completionHandler) { | 2079 } else if (completionHandler) { |
| 2074 completionHandler(nil); | 2080 completionHandler(nil); |
| 2075 } | 2081 } |
| 2076 } | 2082 } |
| 2077 | 2083 |
| 2078 @end | 2084 @end |
| OLD | NEW |