diff options
author | pkasting <pkasting@chromium.org> | 2015-08-06 18:29:50 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-08-07 01:30:28 +0000 |
commit | c4afb05f67511e980cd13c021abf26e04b902977 (patch) | |
tree | 125f79c7a354095c4519128b0fe2c9983f644152 /extensions/common/csp_validator.cc | |
parent | ac97e8e270e8783230272fa07d18d360d2409d5f (diff) | |
download | chromium_src-c4afb05f67511e980cd13c021abf26e04b902977.zip chromium_src-c4afb05f67511e980cd13c021abf26e04b902977.tar.gz chromium_src-c4afb05f67511e980cd13c021abf26e04b902977.tar.bz2 |
Revert of Update SplitString calls to new form (patchset #5 id:80001 of https://codereview.chromium.org/1272823003/ )
Reason for revert:
Caused Blink layout test failures in media/encrypted-media/encrypted-media-requestmediakeysystemaccess.html :
http://test-results.appspot.com/dashboards/flakiness_dashboard.html#showExpectations=true&tests=media%2Fencrypted-media%2Fencrypted-media-requestmediakeysystemaccess.html
Original issue's description:
> Update SplitString calls to new form
>
> Uses the new form for most (but not quite all) of the remaining users of the old form.
>
> Changes media mime util codec list parsing to expect no result from the string "," rather than two empty strings. The old SplitString call had a special case where if the input was empty, it would return empty, but if it had one split character, it would return two empty strings as results.
>
> The new one lets you choose but the options are either (1) empty string -> one empty string and "," -> two empty strings, or (2) map both to no results for when you don't want empty results. I'm pretty sure media codec parsing actually wants the latter behavior, so I updated the call to discard empty results and MimeUtilTest.ParseCodecString is updated.
>
> Committed: https://crrev.com/0aa7c64253cca8b636d52d1d01d94f96ab9c13fa
> Cr-Commit-Position: refs/heads/master@{#342238}
TBR=sky@chromium.org,dalecurtis@chromium.org,brettw@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
Review URL: https://codereview.chromium.org/1278973003
Cr-Commit-Position: refs/heads/master@{#342257}
Diffstat (limited to 'extensions/common/csp_validator.cc')
-rw-r--r-- | extensions/common/csp_validator.cc | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/extensions/common/csp_validator.cc b/extensions/common/csp_validator.cc index d19b983..1fe2217 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, ";", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + std::vector<std::string> directives; + base::SplitString(policy, ';', &directives); DirectiveStatus default_src_status(kDefaultSrc); DirectiveStatus script_src_status(kScriptSrc); @@ -307,9 +307,13 @@ 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 (const std::string& input : base::SplitString( - policy, ";", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL)) { + + for (size_t i = 0; i < directives.size(); ++i) { + std::string& input = directives[i]; base::StringTokenizer tokenizer(input, " \t\r\n"); if (!tokenizer.GetNext()) continue; |