Chromium Code Reviews| Index: content/browser/child_process_security_policy_impl.cc |
| diff --git a/content/browser/child_process_security_policy_impl.cc b/content/browser/child_process_security_policy_impl.cc |
| index 779aa5b398a5868d21dd407cf5a658a7f22ca328..a8def4b81c43c88fdf41d38bb101da8a90161600 100644 |
| --- a/content/browser/child_process_security_policy_impl.cc |
| +++ b/content/browser/child_process_security_policy_impl.cc |
| @@ -671,6 +671,31 @@ bool ChildProcessSecurityPolicyImpl::CanRequestURL( |
| !net::URLRequest::IsHandledURL(url); |
| } |
| +bool ChildProcessSecurityPolicyImpl::CanRedirectToURL(const GURL& url) { |
| + if (!url.is_valid()) |
| + return false; // Can't redirect to invalid URLs. |
| + |
| + const std::string& scheme = url.scheme(); |
| + |
| + if (IsPseudoScheme(scheme)) { |
| + // Redirects to a pseudo scheme (about, javascript, view-source, ...) are |
| + // not allowed. An exception is made for <about:blank> and its variations. |
| + return url.IsAboutBlank(); |
| + } |
| + |
| + // Note about redirects and some special URLs: |
|
clamy
2017/07/12 14:19:57
s/some/
arthursonzogni
2017/07/12 14:27:38
Done.
|
| + // * data-url: Blocked by net::DataProtocolHandler::IsSafeRedirectTarget(). |
| + // * blob-url: Not necessary blocked, but a 'file not found' response will be |
|
clamy
2017/07/12 14:19:56
* Move the Depending... paragraph above this line.
arthursonzogni
2017/07/12 14:27:38
Done.
|
| + // generated in net::BlobURLRequestJob::DidStart(). |
| + // * filesystem-url: Not necessary blocked and the response can be displayed. |
| + // |
| + // Depending on their inner origins and if the request is browser-initiated or |
| + // renderer-initiated, blob-urls and filesystem-urls might get blocked by |
| + // CanCommitURL or in DocumentLoader::RedirectReceived. |
| + |
| + return true; |
| +} |
| + |
| bool ChildProcessSecurityPolicyImpl::CanCommitURL(int child_id, |
| const GURL& url) { |
| if (!url.is_valid()) |