Index: extensions/common/csp_validator.cc |
diff --git a/extensions/common/csp_validator.cc b/extensions/common/csp_validator.cc |
index 1fe22178854f13df8826df4c0e1eea293a353dea..d19b983b9e722e0a81924cb71a6e765ad7313573 100644 |
--- a/extensions/common/csp_validator.cc |
+++ b/extensions/common/csp_validator.cc |
@@ -240,8 +240,8 @@ std::string SanitizeContentSecurityPolicy( |
int options, |
std::vector<InstallWarning>* warnings) { |
// See http://www.w3.org/TR/CSP/#parse-a-csp-policy for parsing algorithm. |
- std::vector<std::string> directives; |
- base::SplitString(policy, ';', &directives); |
+ std::vector<std::string> directives = base::SplitString( |
+ policy, ";", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
DirectiveStatus default_src_status(kDefaultSrc); |
DirectiveStatus script_src_status(kScriptSrc); |
@@ -307,13 +307,9 @@ std::string SanitizeContentSecurityPolicy( |
bool ContentSecurityPolicyIsSandboxed( |
const std::string& policy, Manifest::Type type) { |
// See http://www.w3.org/TR/CSP/#parse-a-csp-policy for parsing algorithm. |
- std::vector<std::string> directives; |
- base::SplitString(policy, ';', &directives); |
- |
bool seen_sandbox = false; |
- |
- for (size_t i = 0; i < directives.size(); ++i) { |
- std::string& input = directives[i]; |
+ for (const std::string& input : base::SplitString( |
+ policy, ";", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL)) { |
base::StringTokenizer tokenizer(input, " \t\r\n"); |
if (!tokenizer.GetNext()) |
continue; |