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

Unified Diff: Source/core/testing/Internals.cpp

Issue 730203007: CSP: Permit exempting schemes only for certain policy areas. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: AssertMatchingEnums Created 6 years, 1 month 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
« no previous file with comments | « Source/core/testing/Internals.h ('k') | Source/core/testing/Internals.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/testing/Internals.cpp
diff --git a/Source/core/testing/Internals.cpp b/Source/core/testing/Internals.cpp
index 70e7b51614d8b6a18e95a86829d308c69a9fb689..48ed144e940ad0a04b89f6d185dc5b71698ec3af 100644
--- a/Source/core/testing/Internals.cpp
+++ b/Source/core/testing/Internals.cpp
@@ -1768,6 +1768,19 @@ void Internals::registerURLSchemeAsBypassingContentSecurityPolicy(const String&
SchemeRegistry::registerURLSchemeAsBypassingContentSecurityPolicy(scheme);
}
+void Internals::registerURLSchemeAsBypassingContentSecurityPolicy(const String& scheme, const Vector<String>& policyAreas)
+{
+ uint32_t policyAreasEnum = SchemeRegistry::PolicyAreaNone;
+ for (const auto& policyArea : policyAreas) {
+ if (policyArea == "img")
+ policyAreasEnum |= SchemeRegistry::PolicyAreaImage;
+ else if (policyArea == "style")
+ policyAreasEnum |= SchemeRegistry::PolicyAreaStyle;
+ }
+ SchemeRegistry::registerURLSchemeAsBypassingContentSecurityPolicy(
+ scheme, static_cast<SchemeRegistry::PolicyAreas>(policyAreasEnum));
+}
+
void Internals::removeURLSchemeRegisteredAsBypassingContentSecurityPolicy(const String& scheme)
{
SchemeRegistry::removeURLSchemeRegisteredAsBypassingContentSecurityPolicy(scheme);
« no previous file with comments | « Source/core/testing/Internals.h ('k') | Source/core/testing/Internals.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698