Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1487)

Side by Side Diff: ios/web/web_state/ui/crw_wk_web_view_web_controller.mm

Issue 1926563002: [ios] Do not allow loading chrome:// URLs from regular http/https pages. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 1415 matching lines...) Expand 10 before | Expand all | Expand 10 after
1426 // lastRegisteredRequestURL may be the same as the webViewURL on a new tab 1426 // lastRegisteredRequestURL may be the same as the webViewURL on a new tab
1427 // created by window.open (default is about::blank). 1427 // created by window.open (default is about::blank).
1428 if (self.lastRegisteredRequestURL != webViewURL || 1428 if (self.lastRegisteredRequestURL != webViewURL ||
1429 self.loadPhase != web::LOAD_REQUESTED) { 1429 self.loadPhase != web::LOAD_REQUESTED) {
1430 // Reset current WebUI if one exists. 1430 // Reset current WebUI if one exists.
1431 [self clearWebUI]; 1431 [self clearWebUI];
1432 // Restart app specific URL loads to properly capture state. 1432 // Restart app specific URL loads to properly capture state.
1433 // TODO(crbug.com/546347): Extract necessary tasks for app specific URL 1433 // TODO(crbug.com/546347): Extract necessary tasks for app specific URL
1434 // navigation rather than restarting the load. 1434 // navigation rather than restarting the load.
1435 if (web::GetWebClient()->IsAppSpecificURL(webViewURL)) { 1435 if (web::GetWebClient()->IsAppSpecificURL(webViewURL)) {
1436 [self abortWebLoad]; 1436 // Renderer-initiated loads of WebUI can be done only from other WebUI
1437 NavigationManager::WebLoadParams params(webViewURL); 1437 // pages. WebUI pages may have increased power and using the same web
1438 [self loadWithParams:params]; 1438 // process (which may potentially be controller by an attacker) is
1439 // dangerous.
1440 if (web::GetWebClient()->IsAppSpecificURL(_documentURL)) {
1441 [self abortWebLoad];
1442 NavigationManager::WebLoadParams params(webViewURL);
1443 [self loadWithParams:params];
1444 }
1439 return; 1445 return;
1440 } else { 1446 } else {
1441 [self registerLoadRequest:webViewURL]; 1447 [self registerLoadRequest:webViewURL];
1442 } 1448 }
1443 } 1449 }
1444 // Ensure the URL is registered and loadPhase is as expected. 1450 // Ensure the URL is registered and loadPhase is as expected.
1445 DCHECK(self.lastRegisteredRequestURL == webViewURL); 1451 DCHECK(self.lastRegisteredRequestURL == webViewURL);
1446 DCHECK(self.loadPhase == web::LOAD_REQUESTED); 1452 DCHECK(self.loadPhase == web::LOAD_REQUESTED);
1447 _latestWKNavigation.reset([navigation retain]); 1453 _latestWKNavigation.reset([navigation retain]);
1448 } 1454 }
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
1722 runJavaScriptTextInputPanelWithPrompt:prompt 1728 runJavaScriptTextInputPanelWithPrompt:prompt
1723 defaultText:defaultText 1729 defaultText:defaultText
1724 requestURL:requestURL 1730 requestURL:requestURL
1725 completionHandler:completionHandler]; 1731 completionHandler:completionHandler];
1726 } else if (completionHandler) { 1732 } else if (completionHandler) {
1727 completionHandler(nil); 1733 completionHandler(nil);
1728 } 1734 }
1729 } 1735 }
1730 1736
1731 @end 1737 @end
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698