OLD | NEW |
---|---|
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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_web_controller.h" | 5 #import "ios/web/web_state/ui/crw_web_controller.h" |
6 | 6 |
7 #import <WebKit/WebKit.h> | 7 #import <WebKit/WebKit.h> |
8 | 8 |
9 #import <objc/runtime.h> | 9 #import <objc/runtime.h> |
10 #include <stddef.h> | 10 #include <stddef.h> |
(...skipping 4197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4208 DLOG(WARNING) << "Unable to open a window with invalid URL: " | 4208 DLOG(WARNING) << "Unable to open a window with invalid URL: " |
4209 << requestURL.spec(); | 4209 << requestURL.spec(); |
4210 return nil; | 4210 return nil; |
4211 } | 4211 } |
4212 | 4212 |
4213 NSString* referrer = [self referrerFromNavigationAction:action]; | 4213 NSString* referrer = [self referrerFromNavigationAction:action]; |
4214 GURL openerURL = | 4214 GURL openerURL = |
4215 referrer.length ? GURL(base::SysNSStringToUTF8(referrer)) : _documentURL; | 4215 referrer.length ? GURL(base::SysNSStringToUTF8(referrer)) : _documentURL; |
4216 | 4216 |
4217 WebState* childWebState = _webStateImpl->CreateNewWebState( | 4217 WebState* childWebState = _webStateImpl->CreateNewWebState( |
4218 requestURL, openerURL, [self userIsInteracting]); | 4218 requestURL, openerURL, [self userClickedRecently]); |
Eugene But (OOO till 7-30)
2017/03/22 00:59:38
This will allow more popups from malicious pages,
| |
4219 if (!childWebState) | 4219 if (!childWebState) |
4220 return nil; | 4220 return nil; |
4221 | 4221 |
4222 CRWWebController* childWebController = | 4222 CRWWebController* childWebController = |
4223 static_cast<WebStateImpl*>(childWebState)->GetWebController(); | 4223 static_cast<WebStateImpl*>(childWebState)->GetWebController(); |
4224 | 4224 |
4225 DCHECK(!childWebController || childWebController.hasOpener); | 4225 DCHECK(!childWebController || childWebController.hasOpener); |
4226 | 4226 |
4227 // WKWebView requires WKUIDelegate to return a child view created with | 4227 // WKWebView requires WKUIDelegate to return a child view created with |
4228 // exactly the same |configuration| object (exception is raised if config is | 4228 // exactly the same |configuration| object (exception is raised if config is |
(...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5075 - (void)simulateLoadRequestWithURL:(const GURL&)URL { | 5075 - (void)simulateLoadRequestWithURL:(const GURL&)URL { |
5076 _lastRegisteredRequestURL = URL; | 5076 _lastRegisteredRequestURL = URL; |
5077 _loadPhase = web::LOAD_REQUESTED; | 5077 _loadPhase = web::LOAD_REQUESTED; |
5078 } | 5078 } |
5079 | 5079 |
5080 - (NSString*)referrerFromNavigationAction:(WKNavigationAction*)action { | 5080 - (NSString*)referrerFromNavigationAction:(WKNavigationAction*)action { |
5081 return [action.request valueForHTTPHeaderField:kReferrerHeaderName]; | 5081 return [action.request valueForHTTPHeaderField:kReferrerHeaderName]; |
5082 } | 5082 } |
5083 | 5083 |
5084 @end | 5084 @end |
OLD | NEW |