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

Unified Diff: content/common/content_security_policy/csp_source_list.cc

Issue 2792973004: Moved all tests about bypassing CSP into csp-tests (content layer) (Closed)
Patch Set: CR changes Jochen Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: content/common/content_security_policy/csp_source_list.cc
diff --git a/content/common/content_security_policy/csp_source_list.cc b/content/common/content_security_policy/csp_source_list.cc
index f05cc4d28ee218978507e3aec930e2264424c300..9ce5d0582b9ce2fd33e79fab23a5707380cc1bf5 100644
--- a/content/common/content_security_policy/csp_source_list.cc
+++ b/content/common/content_security_policy/csp_source_list.cc
@@ -8,25 +8,6 @@ namespace content {
namespace {
-const GURL ExtractInnerURL(const GURL& url) {
- if (const GURL* inner_url = url.inner_url())
- return *inner_url;
- else
- // TODO(arthursonzogni): revisit this once GURL::inner_url support blob-URL.
- return GURL(url.path());
-}
-
-const GURL GetEffectiveURL(CSPContext* context, const GURL& url) {
- // Due to backwards-compatibility concerns, we allow 'self' to match blob and
- // filesystem inner URLs if we are in a context that bypasses
- // ContentSecurityPolicy in the main world.
- if (context->SelfSchemeShouldBypassCsp()) {
- if (url.SchemeIsFileSystem() || url.SchemeIsBlob())
- return ExtractInnerURL(url);
- }
- return url;
-}
-
bool AllowFromSources(const GURL& url,
const std::vector<CSPSource>& sources,
CSPContext* context,
@@ -70,13 +51,9 @@ bool CSPSourceList::Allow(const CSPSourceList& source_list,
return AllowFromSources(url, source_list.sources, context, is_redirect);
}
- const GURL effective_url = GetEffectiveURL(context, url);
-
- if (source_list.allow_self && context->AllowSelf(effective_url))
- return true;
+ if (source_list.allow_self && context->AllowSelf(url)) return true;
- return AllowFromSources(effective_url, source_list.sources, context,
- is_redirect);
+ return AllowFromSources(url, source_list.sources, context, is_redirect);
}
std::string CSPSourceList::ToString() const {

Powered by Google App Engine
This is Rietveld 408576698