diff --git a/include/internal/cef_types.h b/include/internal/cef_types.h index 09c262250..c76722316 100644 --- a/include/internal/cef_types.h +++ b/include/internal/cef_types.h @@ -2303,21 +2303,10 @@ typedef enum { /// UU_URL_SPECIAL_CHARS_EXCEPT_PATH_SEPARATORS = 1 << 3, - /// - // Unescapes characters that can be used in spoofing attempts (such as LOCK) - // and control characters (such as BiDi control characters and %01). This - // INCLUDES NULLs. This is used for rare cases such as data: URL decoding - // where the result is binary data. - // - // DO NOT use UU_SPOOFING_AND_CONTROL_CHARS if the URL is going to be - // displayed in the UI for security reasons. - /// - UU_SPOOFING_AND_CONTROL_CHARS = 1 << 4, - /// // URL queries use "+" for space. This flag controls that replacement. /// - UU_REPLACE_PLUS_WITH_SPACE = 1 << 5, + UU_REPLACE_PLUS_WITH_SPACE = 1 << 4, } cef_uri_unescape_rule_t; /// diff --git a/tests/ceftests/parser_unittest.cc b/tests/ceftests/parser_unittest.cc index 3f7177e0a..cc5e6be3f 100644 --- a/tests/ceftests/parser_unittest.cc +++ b/tests/ceftests/parser_unittest.cc @@ -329,6 +329,13 @@ TEST(ParserTest, URIEncode) { EXPECT_STREQ(test_str_encoded.c_str(), encoded_value.ToString().c_str()); } +TEST(ParserTest, URIEncodeWithPlusSpace) { + const std::string& test_str_decoded = "A test string="; + const std::string& test_str_encoded = "A+test+string%3D"; + const CefString& encoded_value = CefURIEncode(test_str_decoded, true); + EXPECT_STREQ(test_str_encoded.c_str(), encoded_value.ToString().c_str()); +} + TEST(ParserTest, URIDecode) { const std::string& test_str_decoded = "A test string="; const std::string& test_str_encoded = "A%20test%20string%3D"; @@ -339,6 +346,17 @@ TEST(ParserTest, URIDecode) { EXPECT_STREQ(test_str_decoded.c_str(), decoded_value.ToString().c_str()); } +TEST(ParserTest, URIDecodeWithPlusSpace) { + const std::string& test_str_decoded = "A test string="; + const std::string& test_str_encoded = "A+test+string%3D"; + const CefString& decoded_value = + CefURIDecode(test_str_encoded, false, + static_cast( + UU_SPACES | UU_URL_SPECIAL_CHARS_EXCEPT_PATH_SEPARATORS | + UU_REPLACE_PLUS_WITH_SPACE)); + EXPECT_STREQ(test_str_decoded.c_str(), decoded_value.ToString().c_str()); +} + TEST(ParserTest, ParseJSONInvalid) { const char data[] = "This is my test data"; CefRefPtr value = CefParseJSON(data, JSON_PARSER_RFC);