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

Unified Diff: Source/wtf/text/Base64.h

Issue 19623002: Make atob() throw an InvalidCharacterError on excess padding characters (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 years, 5 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
« no previous file with comments | « Source/core/page/DOMWindowBase64.cpp ('k') | Source/wtf/text/Base64.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/wtf/text/Base64.h
diff --git a/Source/wtf/text/Base64.h b/Source/wtf/text/Base64.h
index ac599c49f7abdf5c4ab26351327c81096253f319..7b14fea0e6f67d4c87443e0b80a1a4dfe8f4c0e7 100644
--- a/Source/wtf/text/Base64.h
+++ b/Source/wtf/text/Base64.h
@@ -39,12 +39,17 @@ enum Base64EncodePolicy {
Base64InsertLFs
};
-enum Base64DecodePolicy {
+enum Base64InvalidCharactersPolicy {
Base64FailOnInvalidCharacter,
Base64IgnoreWhitespace,
Base64IgnoreInvalidCharacters
};
+enum Base64PaddingValidationPolicy {
+ Base64NoPaddingValidation,
+ Base64StrictPaddingValidation
+};
+
WTF_EXPORT void base64Encode(const char*, unsigned, Vector<char>&, Base64EncodePolicy = Base64DoNotInsertLFs);
WTF_EXPORT void base64Encode(const Vector<char>&, Vector<char>&, Base64EncodePolicy = Base64DoNotInsertLFs);
WTF_EXPORT void base64Encode(const CString&, Vector<char>&, Base64EncodePolicy = Base64DoNotInsertLFs);
@@ -52,9 +57,9 @@ WTF_EXPORT String base64Encode(const char*, unsigned, Base64EncodePolicy = Base6
WTF_EXPORT String base64Encode(const Vector<char>&, Base64EncodePolicy = Base64DoNotInsertLFs);
WTF_EXPORT String base64Encode(const CString&, Base64EncodePolicy = Base64DoNotInsertLFs);
-WTF_EXPORT bool base64Decode(const String&, Vector<char>&, Base64DecodePolicy = Base64FailOnInvalidCharacter);
-WTF_EXPORT bool base64Decode(const Vector<char>&, Vector<char>&, Base64DecodePolicy = Base64FailOnInvalidCharacter);
-WTF_EXPORT bool base64Decode(const char*, unsigned, Vector<char>&, Base64DecodePolicy = Base64FailOnInvalidCharacter);
+WTF_EXPORT bool base64Decode(const String&, Vector<char>&, Base64InvalidCharactersPolicy = Base64FailOnInvalidCharacter, Base64PaddingValidationPolicy = Base64NoPaddingValidation);
+WTF_EXPORT bool base64Decode(const Vector<char>&, Vector<char>&, Base64InvalidCharactersPolicy = Base64FailOnInvalidCharacter, Base64PaddingValidationPolicy = Base64NoPaddingValidation);
+WTF_EXPORT bool base64Decode(const char*, unsigned, Vector<char>&, Base64InvalidCharactersPolicy = Base64FailOnInvalidCharacter, Base64PaddingValidationPolicy = Base64NoPaddingValidation);
inline void base64Encode(const Vector<char>& in, Vector<char>& out, Base64EncodePolicy policy)
{
@@ -81,10 +86,13 @@ inline String base64Encode(const CString& in, Base64EncodePolicy policy)
using WTF::Base64EncodePolicy;
using WTF::Base64DoNotInsertLFs;
using WTF::Base64InsertLFs;
-using WTF::Base64DecodePolicy;
+using WTF::Base64InvalidCharactersPolicy;
using WTF::Base64FailOnInvalidCharacter;
using WTF::Base64IgnoreWhitespace;
using WTF::Base64IgnoreInvalidCharacters;
+using WTF::Base64PaddingValidationPolicy;
+using WTF::Base64NoPaddingValidation;
+using WTF::Base64StrictPaddingValidation;
using WTF::base64Encode;
using WTF::base64Decode;
« no previous file with comments | « Source/core/page/DOMWindowBase64.cpp ('k') | Source/wtf/text/Base64.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698