| Index: net/base/filename_util_unittest.cc
|
| diff --git a/net/base/filename_util_unittest.cc b/net/base/filename_util_unittest.cc
|
| index 0e7d5046ddf16910c0efcee7e7aa7cd002e01318..9d91fb7f4f72dff6697d69402b4ca500fc66b81c 100644
|
| --- a/net/base/filename_util_unittest.cc
|
| +++ b/net/base/filename_util_unittest.cc
|
| @@ -81,37 +81,37 @@ void RunGenerateFileNameTestCase(const GenerateFilenameCase* test_case) {
|
| } // namespace
|
|
|
| static const base::FilePath::CharType* kSafePortableBasenames[] = {
|
| - FILE_PATH_LITERAL("a"),
|
| - FILE_PATH_LITERAL("a.txt"),
|
| - FILE_PATH_LITERAL("a b.txt"),
|
| - FILE_PATH_LITERAL("a-b.txt"),
|
| - FILE_PATH_LITERAL("My Computer"),
|
| - FILE_PATH_LITERAL(" Computer"),
|
| + FILE_PATH_LITERAL("a"),
|
| + FILE_PATH_LITERAL("a.txt"),
|
| + FILE_PATH_LITERAL("a b.txt"),
|
| + FILE_PATH_LITERAL("a-b.txt"),
|
| + FILE_PATH_LITERAL("My Computer"),
|
| };
|
|
|
| static const base::FilePath::CharType* kUnsafePortableBasenames[] = {
|
| - FILE_PATH_LITERAL(""),
|
| - FILE_PATH_LITERAL("."),
|
| - FILE_PATH_LITERAL(".."),
|
| - FILE_PATH_LITERAL("..."),
|
| - FILE_PATH_LITERAL("con"),
|
| - FILE_PATH_LITERAL("con.zip"),
|
| - FILE_PATH_LITERAL("NUL"),
|
| - FILE_PATH_LITERAL("NUL.zip"),
|
| - FILE_PATH_LITERAL(".a"),
|
| - FILE_PATH_LITERAL("a."),
|
| - FILE_PATH_LITERAL("a\"a"),
|
| - FILE_PATH_LITERAL("a<a"),
|
| - FILE_PATH_LITERAL("a>a"),
|
| - FILE_PATH_LITERAL("a?a"),
|
| - FILE_PATH_LITERAL("a/"),
|
| - FILE_PATH_LITERAL("a\\"),
|
| - FILE_PATH_LITERAL("a "),
|
| - FILE_PATH_LITERAL("a . ."),
|
| - FILE_PATH_LITERAL("My Computer.{a}"),
|
| - FILE_PATH_LITERAL("My Computer.{20D04FE0-3AEA-1069-A2D8-08002B30309D}"),
|
| + FILE_PATH_LITERAL(""),
|
| + FILE_PATH_LITERAL("."),
|
| + FILE_PATH_LITERAL(".."),
|
| + FILE_PATH_LITERAL("..."),
|
| + FILE_PATH_LITERAL("con"),
|
| + FILE_PATH_LITERAL("con.zip"),
|
| + FILE_PATH_LITERAL("NUL"),
|
| + FILE_PATH_LITERAL("NUL.zip"),
|
| + FILE_PATH_LITERAL(".a"),
|
| + FILE_PATH_LITERAL("a."),
|
| + FILE_PATH_LITERAL("a\"a"),
|
| + FILE_PATH_LITERAL("a<a"),
|
| + FILE_PATH_LITERAL("a>a"),
|
| + FILE_PATH_LITERAL("a?a"),
|
| + FILE_PATH_LITERAL("a/"),
|
| + FILE_PATH_LITERAL("a\\"),
|
| + FILE_PATH_LITERAL("a "),
|
| + FILE_PATH_LITERAL("a . ."),
|
| + FILE_PATH_LITERAL(" Computer"),
|
| + FILE_PATH_LITERAL("My Computer.{a}"),
|
| + FILE_PATH_LITERAL("My Computer.{20D04FE0-3AEA-1069-A2D8-08002B30309D}"),
|
| #if !defined(OS_WIN)
|
| - FILE_PATH_LITERAL("a\\a"),
|
| + FILE_PATH_LITERAL("a\\a"),
|
| #endif
|
| };
|
|
|
| @@ -952,720 +952,614 @@ TEST(FilenameUtilTest, GenerateFileName) {
|
| // a correct extension should be added if necessary.
|
| const GenerateFilenameCase generation_tests[] = {
|
| // Dotfiles. Ensures preceeding period(s) stripped.
|
| - {
|
| - __LINE__,
|
| - "http://www.google.com/.test.html",
|
| - "",
|
| - "",
|
| - "",
|
| - "",
|
| - L"",
|
| - L"test.html"
|
| - },
|
| - {
|
| - __LINE__,
|
| - "http://www.google.com/.test",
|
| - "",
|
| - "",
|
| - "",
|
| - "",
|
| - L"",
|
| - L"test"
|
| - },
|
| - {
|
| - __LINE__,
|
| - "http://www.google.com/..test",
|
| - "",
|
| - "",
|
| - "",
|
| - "",
|
| - L"",
|
| - L"test"
|
| - },
|
| - { // Disposition has relative paths, remove directory separators
|
| - __LINE__,
|
| - "http://www.evil.com/my_download.txt",
|
| - "filename=../../../../././../a_file_name.txt",
|
| - "",
|
| - "",
|
| - "text/plain",
|
| - L"download",
|
| - L"-..-..-..-.-.-..-a_file_name.txt"
|
| - },
|
| - { // Disposition has parent directories, remove directory separators
|
| - __LINE__,
|
| - "http://www.evil.com/my_download.txt",
|
| - "filename=dir1/dir2/a_file_name.txt",
|
| - "",
|
| - "",
|
| - "text/plain",
|
| - L"download",
|
| - L"dir1-dir2-a_file_name.txt"
|
| - },
|
| - { // Disposition has relative paths, remove directory separators
|
| - __LINE__,
|
| - "http://www.evil.com/my_download.txt",
|
| - "filename=..\\..\\..\\..\\.\\.\\..\\a_file_name.txt",
|
| - "",
|
| - "",
|
| - "text/plain",
|
| - L"download",
|
| - L"-..-..-..-.-.-..-a_file_name.txt"
|
| - },
|
| - { // Disposition has parent directories, remove directory separators
|
| - __LINE__,
|
| - "http://www.evil.com/my_download.txt",
|
| - "filename=dir1\\dir2\\a_file_name.txt",
|
| - "",
|
| - "",
|
| - "text/plain",
|
| - L"download",
|
| - L"dir1-dir2-a_file_name.txt"
|
| - },
|
| - { // No useful information in disposition or URL, use default
|
| - __LINE__,
|
| - "http://www.truncated.com/path/",
|
| - "",
|
| - "",
|
| - "",
|
| - "text/plain",
|
| - L"download",
|
| - L"download" TXT_EXT
|
| - },
|
| - { // Filename looks like HTML?
|
| - __LINE__,
|
| - "http://www.evil.com/get/malware/here",
|
| - "filename=\"<blink>Hello kitty</blink>\"",
|
| - "",
|
| - "",
|
| - "text/plain",
|
| - L"default",
|
| - L"-blink-Hello kitty--blink-"
|
| - },
|
| - { // A normal avi should get .avi and not .avi.avi
|
| - __LINE__,
|
| - "https://blah.google.com/misc/2.avi",
|
| - "",
|
| - "",
|
| - "",
|
| - "video/x-msvideo",
|
| - L"download",
|
| - L"2.avi"
|
| - },
|
| - { // Extension generation
|
| - __LINE__,
|
| - "http://www.example.com/my-cat",
|
| - "filename=my-cat",
|
| - "",
|
| - "",
|
| - "image/jpeg",
|
| - L"download",
|
| - L"my-cat"
|
| - },
|
| - {
|
| - __LINE__,
|
| - "http://www.example.com/my-cat",
|
| - "filename=my-cat",
|
| - "",
|
| - "",
|
| - "text/plain",
|
| - L"download",
|
| - L"my-cat"
|
| - },
|
| - {
|
| - __LINE__,
|
| - "http://www.example.com/my-cat",
|
| - "filename=my-cat",
|
| - "",
|
| - "",
|
| - "text/html",
|
| - L"download",
|
| - L"my-cat"
|
| - },
|
| - { // Unknown MIME type
|
| - __LINE__,
|
| - "http://www.example.com/my-cat",
|
| - "filename=my-cat",
|
| - "",
|
| - "",
|
| - "dance/party",
|
| - L"download",
|
| - L"my-cat"
|
| - },
|
| - {
|
| - __LINE__,
|
| - "http://www.example.com/my-cat.jpg",
|
| - "filename=my-cat.jpg",
|
| - "",
|
| - "",
|
| - "text/plain",
|
| - L"download",
|
| - L"my-cat.jpg"
|
| - },
|
| + {__LINE__,
|
| + "http://www.google.com/.test.html",
|
| + "",
|
| + "",
|
| + "",
|
| + "",
|
| + L"",
|
| + L"test.html"},
|
| + {__LINE__, "http://www.google.com/.test", "", "", "", "", L"", L"test"},
|
| + {__LINE__, "http://www.google.com/..test", "", "", "", "", L"", L"test"},
|
| + {// Disposition has relative paths, remove directory separators
|
| + __LINE__,
|
| + "http://www.evil.com/my_download.txt",
|
| + "filename=../../../../././../a_file_name.txt",
|
| + "",
|
| + "",
|
| + "text/plain",
|
| + L"download",
|
| + L"-..-..-..-.-.-..-a_file_name.txt"},
|
| + {// Disposition has parent directories, remove directory separators
|
| + __LINE__,
|
| + "http://www.evil.com/my_download.txt",
|
| + "filename=dir1/dir2/a_file_name.txt",
|
| + "",
|
| + "",
|
| + "text/plain",
|
| + L"download",
|
| + L"dir1-dir2-a_file_name.txt"},
|
| + {// Disposition has relative paths, remove directory separators
|
| + __LINE__,
|
| + "http://www.evil.com/my_download.txt",
|
| + "filename=..\\..\\..\\..\\.\\.\\..\\a_file_name.txt",
|
| + "",
|
| + "",
|
| + "text/plain",
|
| + L"download",
|
| + L"-..-..-..-.-.-..-a_file_name.txt"},
|
| + {// Disposition has parent directories, remove directory separators
|
| + __LINE__,
|
| + "http://www.evil.com/my_download.txt",
|
| + "filename=dir1\\dir2\\a_file_name.txt",
|
| + "",
|
| + "",
|
| + "text/plain",
|
| + L"download",
|
| + L"dir1-dir2-a_file_name.txt"},
|
| + {// No useful information in disposition or URL, use default
|
| + __LINE__,
|
| + "http://www.truncated.com/path/",
|
| + "",
|
| + "",
|
| + "",
|
| + "text/plain",
|
| + L"download",
|
| + L"download" TXT_EXT},
|
| + {// Filename looks like HTML?
|
| + __LINE__,
|
| + "http://www.evil.com/get/malware/here",
|
| + "filename=\"<blink>Hello kitty</blink>\"",
|
| + "",
|
| + "",
|
| + "text/plain",
|
| + L"default",
|
| + L"-blink-Hello kitty--blink-"},
|
| + {// A normal avi should get .avi and not .avi.avi
|
| + __LINE__,
|
| + "https://blah.google.com/misc/2.avi",
|
| + "",
|
| + "",
|
| + "",
|
| + "video/x-msvideo",
|
| + L"download",
|
| + L"2.avi"},
|
| + {// Extension generation
|
| + __LINE__,
|
| + "http://www.example.com/my-cat",
|
| + "filename=my-cat",
|
| + "",
|
| + "",
|
| + "image/jpeg",
|
| + L"download",
|
| + L"my-cat"},
|
| + {__LINE__,
|
| + "http://www.example.com/my-cat",
|
| + "filename=my-cat",
|
| + "",
|
| + "",
|
| + "text/plain",
|
| + L"download",
|
| + L"my-cat"},
|
| + {__LINE__,
|
| + "http://www.example.com/my-cat",
|
| + "filename=my-cat",
|
| + "",
|
| + "",
|
| + "text/html",
|
| + L"download",
|
| + L"my-cat"},
|
| + {// Unknown MIME type
|
| + __LINE__,
|
| + "http://www.example.com/my-cat",
|
| + "filename=my-cat",
|
| + "",
|
| + "",
|
| + "dance/party",
|
| + L"download",
|
| + L"my-cat"},
|
| + {__LINE__,
|
| + "http://www.example.com/my-cat.jpg",
|
| + "filename=my-cat.jpg",
|
| + "",
|
| + "",
|
| + "text/plain",
|
| + L"download",
|
| + L"my-cat.jpg"},
|
| // Windows specific tests
|
| #if defined(OS_WIN)
|
| - {
|
| - __LINE__,
|
| - "http://www.goodguy.com/evil.exe",
|
| - "filename=evil.exe",
|
| - "",
|
| - "",
|
| - "image/jpeg",
|
| - L"download",
|
| - L"evil.exe"
|
| - },
|
| - {
|
| - __LINE__,
|
| - "http://www.goodguy.com/ok.exe",
|
| - "filename=ok.exe",
|
| - "",
|
| - "",
|
| - "binary/octet-stream",
|
| - L"download",
|
| - L"ok.exe"
|
| - },
|
| - {
|
| - __LINE__,
|
| - "http://www.goodguy.com/evil.dll",
|
| - "filename=evil.dll",
|
| - "",
|
| - "",
|
| - "dance/party",
|
| - L"download",
|
| - L"evil.dll"
|
| - },
|
| - {
|
| - __LINE__,
|
| - "http://www.goodguy.com/evil.exe",
|
| - "filename=evil",
|
| - "",
|
| - "",
|
| - "application/rss+xml",
|
| - L"download",
|
| - L"evil"
|
| - },
|
| + {__LINE__,
|
| + "http://www.goodguy.com/evil.exe",
|
| + "filename=evil.exe",
|
| + "",
|
| + "",
|
| + "image/jpeg",
|
| + L"download",
|
| + L"evil.exe"},
|
| + {__LINE__,
|
| + "http://www.goodguy.com/ok.exe",
|
| + "filename=ok.exe",
|
| + "",
|
| + "",
|
| + "binary/octet-stream",
|
| + L"download",
|
| + L"ok.exe"},
|
| + {__LINE__,
|
| + "http://www.goodguy.com/evil.dll",
|
| + "filename=evil.dll",
|
| + "",
|
| + "",
|
| + "dance/party",
|
| + L"download",
|
| + L"evil.dll"},
|
| + {__LINE__,
|
| + "http://www.goodguy.com/evil.exe",
|
| + "filename=evil",
|
| + "",
|
| + "",
|
| + "application/rss+xml",
|
| + L"download",
|
| + L"evil"},
|
| // Test truncation of trailing dots and spaces
|
| - {
|
| - __LINE__,
|
| - "http://www.goodguy.com/evil.exe ",
|
| - "filename=evil.exe ",
|
| - "",
|
| - "",
|
| - "binary/octet-stream",
|
| - L"download",
|
| - L"evil.exe"
|
| - },
|
| - {
|
| - __LINE__,
|
| - "http://www.goodguy.com/evil.exe.",
|
| - "filename=evil.exe.",
|
| - "",
|
| - "",
|
| - "binary/octet-stream",
|
| - L"download",
|
| - L"evil.exe-"
|
| - },
|
| - {
|
| - __LINE__,
|
| - "http://www.goodguy.com/evil.exe. . .",
|
| - "filename=evil.exe. . .",
|
| - "",
|
| - "",
|
| - "binary/octet-stream",
|
| - L"download",
|
| - L"evil.exe-------"
|
| - },
|
| - {
|
| - __LINE__,
|
| - "http://www.goodguy.com/evil.",
|
| - "filename=evil.",
|
| - "",
|
| - "",
|
| - "binary/octet-stream",
|
| - L"download",
|
| - L"evil-"
|
| - },
|
| - {
|
| - __LINE__,
|
| - "http://www.goodguy.com/. . . . .",
|
| - "filename=. . . . .",
|
| - "",
|
| - "",
|
| - "binary/octet-stream",
|
| - L"download",
|
| - L"download"
|
| - },
|
| - {
|
| - __LINE__,
|
| - "http://www.badguy.com/attachment?name=meh.exe%C2%A0",
|
| - "attachment; filename=\"meh.exe\xC2\xA0\"",
|
| - "",
|
| - "",
|
| - "binary/octet-stream",
|
| - L"",
|
| - L"meh.exe-"
|
| - },
|
| + {__LINE__,
|
| + "http://www.goodguy.com/evil.exe ",
|
| + "filename=evil.exe ",
|
| + "",
|
| + "",
|
| + "binary/octet-stream",
|
| + L"download",
|
| + L"evil.exe"},
|
| + {__LINE__,
|
| + "http://www.goodguy.com/evil.exe.",
|
| + "filename=evil.exe.",
|
| + "",
|
| + "",
|
| + "binary/octet-stream",
|
| + L"download",
|
| + L"evil.exe-"},
|
| + {__LINE__,
|
| + "http://www.goodguy.com/evil.exe. . .",
|
| + "filename=evil.exe. . .",
|
| + "",
|
| + "",
|
| + "binary/octet-stream",
|
| + L"download",
|
| + L"evil.exe-------"},
|
| + {__LINE__,
|
| + "http://www.goodguy.com/evil.",
|
| + "filename=evil.",
|
| + "",
|
| + "",
|
| + "binary/octet-stream",
|
| + L"download",
|
| + L"evil-"},
|
| + {__LINE__,
|
| + "http://www.goodguy.com/. . . . .",
|
| + "filename=. . . . .",
|
| + "",
|
| + "",
|
| + "binary/octet-stream",
|
| + L"download",
|
| + L"download"},
|
| + {__LINE__,
|
| + "http://www.badguy.com/attachment?name=meh.exe%C2%A0",
|
| + "attachment; filename=\"meh.exe\xC2\xA0\"",
|
| + "",
|
| + "",
|
| + "binary/octet-stream",
|
| + L"",
|
| + L"meh.exe-"},
|
| #endif // OS_WIN
|
| - {
|
| - __LINE__,
|
| - "http://www.goodguy.com/utils.js",
|
| - "filename=utils.js",
|
| - "",
|
| - "",
|
| - "application/x-javascript",
|
| - L"download",
|
| - L"utils.js"
|
| - },
|
| - {
|
| - __LINE__,
|
| - "http://www.goodguy.com/contacts.js",
|
| - "filename=contacts.js",
|
| - "",
|
| - "",
|
| - "application/json",
|
| - L"download",
|
| - L"contacts.js"
|
| - },
|
| - {
|
| - __LINE__,
|
| - "http://www.goodguy.com/utils.js",
|
| - "filename=utils.js",
|
| - "",
|
| - "",
|
| - "text/javascript",
|
| - L"download",
|
| - L"utils.js"
|
| - },
|
| - {
|
| - __LINE__,
|
| - "http://www.goodguy.com/utils.js",
|
| - "filename=utils.js",
|
| - "",
|
| - "",
|
| - "text/javascript;version=2",
|
| - L"download",
|
| - L"utils.js"
|
| - },
|
| - {
|
| - __LINE__,
|
| - "http://www.goodguy.com/utils.js",
|
| - "filename=utils.js",
|
| - "",
|
| - "",
|
| - "application/ecmascript",
|
| - L"download",
|
| - L"utils.js"
|
| - },
|
| - {
|
| - __LINE__,
|
| - "http://www.goodguy.com/utils.js",
|
| - "filename=utils.js",
|
| - "",
|
| - "",
|
| - "application/ecmascript;version=4",
|
| - L"download",
|
| - L"utils.js"
|
| - },
|
| - {
|
| - __LINE__,
|
| - "http://www.goodguy.com/program.exe",
|
| - "filename=program.exe",
|
| - "",
|
| - "",
|
| - "application/foo-bar",
|
| - L"download",
|
| - L"program.exe"
|
| - },
|
| - {
|
| - __LINE__,
|
| - "http://www.evil.com/../foo.txt",
|
| - "filename=../foo.txt",
|
| - "",
|
| - "",
|
| - "text/plain",
|
| - L"download",
|
| - L"-foo.txt"
|
| - },
|
| - {
|
| - __LINE__,
|
| - "http://www.evil.com/..\\foo.txt",
|
| - "filename=..\\foo.txt",
|
| - "",
|
| - "",
|
| - "text/plain",
|
| - L"download",
|
| - L"-foo.txt"
|
| - },
|
| - {
|
| - __LINE__,
|
| - "http://www.evil.com/.hidden",
|
| - "filename=.hidden",
|
| - "",
|
| - "",
|
| - "text/plain",
|
| - L"download",
|
| - L"hidden"
|
| - },
|
| - {
|
| - __LINE__,
|
| - "http://www.evil.com/trailing.",
|
| - "filename=trailing.",
|
| - "",
|
| - "",
|
| - "dance/party",
|
| - L"download",
|
| + {__LINE__,
|
| + "http://www.goodguy.com/utils.js",
|
| + "filename=utils.js",
|
| + "",
|
| + "",
|
| + "application/x-javascript",
|
| + L"download",
|
| + L"utils.js"},
|
| + {__LINE__,
|
| + "http://www.goodguy.com/contacts.js",
|
| + "filename=contacts.js",
|
| + "",
|
| + "",
|
| + "application/json",
|
| + L"download",
|
| + L"contacts.js"},
|
| + {__LINE__,
|
| + "http://www.goodguy.com/utils.js",
|
| + "filename=utils.js",
|
| + "",
|
| + "",
|
| + "text/javascript",
|
| + L"download",
|
| + L"utils.js"},
|
| + {__LINE__,
|
| + "http://www.goodguy.com/utils.js",
|
| + "filename=utils.js",
|
| + "",
|
| + "",
|
| + "text/javascript;version=2",
|
| + L"download",
|
| + L"utils.js"},
|
| + {__LINE__,
|
| + "http://www.goodguy.com/utils.js",
|
| + "filename=utils.js",
|
| + "",
|
| + "",
|
| + "application/ecmascript",
|
| + L"download",
|
| + L"utils.js"},
|
| + {__LINE__,
|
| + "http://www.goodguy.com/utils.js",
|
| + "filename=utils.js",
|
| + "",
|
| + "",
|
| + "application/ecmascript;version=4",
|
| + L"download",
|
| + L"utils.js"},
|
| + {__LINE__,
|
| + "http://www.goodguy.com/program.exe",
|
| + "filename=program.exe",
|
| + "",
|
| + "",
|
| + "application/foo-bar",
|
| + L"download",
|
| + L"program.exe"},
|
| + {__LINE__,
|
| + "http://www.evil.com/../foo.txt",
|
| + "filename=../foo.txt",
|
| + "",
|
| + "",
|
| + "text/plain",
|
| + L"download",
|
| + L"-foo.txt"},
|
| + {__LINE__,
|
| + "http://www.evil.com/..\\foo.txt",
|
| + "filename=..\\foo.txt",
|
| + "",
|
| + "",
|
| + "text/plain",
|
| + L"download",
|
| + L"-foo.txt"},
|
| + {__LINE__,
|
| + "http://www.evil.com/.hidden",
|
| + "filename=.hidden",
|
| + "",
|
| + "",
|
| + "text/plain",
|
| + L"download",
|
| + L"hidden"},
|
| + {__LINE__,
|
| + "http://www.evil.com/trailing.",
|
| + "filename=trailing.",
|
| + "",
|
| + "",
|
| + "dance/party",
|
| + L"download",
|
| #if defined(OS_WIN)
|
| - L"trailing-"
|
| + L"trailing-"
|
| #else
|
| - L"trailing"
|
| + L"trailing"
|
| #endif
|
| },
|
| - {
|
| - __LINE__,
|
| - "http://www.evil.com/trailing.",
|
| - "filename=trailing.",
|
| - "",
|
| - "",
|
| - "text/plain",
|
| - L"download",
|
| + {__LINE__,
|
| + "http://www.evil.com/trailing.",
|
| + "filename=trailing.",
|
| + "",
|
| + "",
|
| + "text/plain",
|
| + L"download",
|
| #if defined(OS_WIN)
|
| - L"trailing-"
|
| + L"trailing-"
|
| #else
|
| - L"trailing"
|
| + L"trailing"
|
| #endif
|
| },
|
| - {
|
| - __LINE__,
|
| - "http://www.evil.com/.",
|
| - "filename=.",
|
| - "",
|
| - "",
|
| - "dance/party",
|
| - L"download",
|
| - L"download"
|
| - },
|
| - {
|
| - __LINE__,
|
| - "http://www.evil.com/..",
|
| - "filename=..",
|
| - "",
|
| - "",
|
| - "dance/party",
|
| - L"download",
|
| - L"download"
|
| - },
|
| - {
|
| - __LINE__,
|
| - "http://www.evil.com/...",
|
| - "filename=...",
|
| - "",
|
| - "",
|
| - "dance/party",
|
| - L"download",
|
| - L"download"
|
| - },
|
| - { // Note that this one doesn't have "filename=" on it.
|
| - __LINE__,
|
| - "http://www.evil.com/",
|
| - "a_file_name.txt",
|
| - "",
|
| - "",
|
| - "image/jpeg",
|
| - L"download",
|
| - L"download" JPEG_EXT
|
| - },
|
| - {
|
| - __LINE__,
|
| - "http://www.evil.com/",
|
| - "filename=",
|
| - "",
|
| - "",
|
| - "image/jpeg",
|
| - L"download",
|
| - L"download" JPEG_EXT
|
| - },
|
| - {
|
| - __LINE__,
|
| - "http://www.example.com/simple",
|
| - "filename=simple",
|
| - "",
|
| - "",
|
| - "application/octet-stream",
|
| - L"download",
|
| - L"simple"
|
| - },
|
| + {__LINE__,
|
| + "http://www.evil.com/.",
|
| + "filename=.",
|
| + "",
|
| + "",
|
| + "dance/party",
|
| + L"download",
|
| + L"download"},
|
| + {__LINE__,
|
| + "http://www.evil.com/..",
|
| + "filename=..",
|
| + "",
|
| + "",
|
| + "dance/party",
|
| + L"download",
|
| + L"download"},
|
| + {__LINE__,
|
| + "http://www.evil.com/...",
|
| + "filename=...",
|
| + "",
|
| + "",
|
| + "dance/party",
|
| + L"download",
|
| + L"download"},
|
| + {// Note that this one doesn't have "filename=" on it.
|
| + __LINE__,
|
| + "http://www.evil.com/",
|
| + "a_file_name.txt",
|
| + "",
|
| + "",
|
| + "image/jpeg",
|
| + L"download",
|
| + L"download" JPEG_EXT},
|
| + {__LINE__,
|
| + "http://www.evil.com/",
|
| + "filename=",
|
| + "",
|
| + "",
|
| + "image/jpeg",
|
| + L"download",
|
| + L"download" JPEG_EXT},
|
| + {__LINE__,
|
| + "http://www.example.com/simple",
|
| + "filename=simple",
|
| + "",
|
| + "",
|
| + "application/octet-stream",
|
| + L"download",
|
| + L"simple"},
|
| // Reserved words on Windows
|
| - {
|
| - __LINE__,
|
| - "http://www.goodguy.com/COM1",
|
| - "filename=COM1",
|
| - "",
|
| - "",
|
| - "application/foo-bar",
|
| - L"download",
|
| + {__LINE__,
|
| + "http://www.goodguy.com/COM1",
|
| + "filename=COM1",
|
| + "",
|
| + "",
|
| + "application/foo-bar",
|
| + L"download",
|
| #if defined(OS_WIN)
|
| - L"_COM1"
|
| + L"_COM1"
|
| #else
|
| - L"COM1"
|
| + L"COM1"
|
| #endif
|
| },
|
| - {
|
| - __LINE__,
|
| - "http://www.goodguy.com/COM4.txt",
|
| - "filename=COM4.txt",
|
| - "",
|
| - "",
|
| - "text/plain",
|
| - L"download",
|
| + {__LINE__,
|
| + "http://www.goodguy.com/COM4.txt",
|
| + "filename=COM4.txt",
|
| + "",
|
| + "",
|
| + "text/plain",
|
| + L"download",
|
| #if defined(OS_WIN)
|
| - L"_COM4.txt"
|
| + L"_COM4.txt"
|
| #else
|
| - L"COM4.txt"
|
| + L"COM4.txt"
|
| #endif
|
| },
|
| - {
|
| - __LINE__,
|
| - "http://www.goodguy.com/lpt1.TXT",
|
| - "filename=lpt1.TXT",
|
| - "",
|
| - "",
|
| - "text/plain",
|
| - L"download",
|
| + {__LINE__,
|
| + "http://www.goodguy.com/lpt1.TXT",
|
| + "filename=lpt1.TXT",
|
| + "",
|
| + "",
|
| + "text/plain",
|
| + L"download",
|
| #if defined(OS_WIN)
|
| - L"_lpt1.TXT"
|
| + L"_lpt1.TXT"
|
| #else
|
| - L"lpt1.TXT"
|
| + L"lpt1.TXT"
|
| #endif
|
| },
|
| - {
|
| - __LINE__,
|
| - "http://www.goodguy.com/clock$.txt",
|
| - "filename=clock$.txt",
|
| - "",
|
| - "",
|
| - "text/plain",
|
| - L"download",
|
| + {__LINE__,
|
| + "http://www.goodguy.com/clock$.txt",
|
| + "filename=clock$.txt",
|
| + "",
|
| + "",
|
| + "text/plain",
|
| + L"download",
|
| #if defined(OS_WIN)
|
| - L"_clock$.txt"
|
| + L"_clock$.txt"
|
| #else
|
| - L"clock$.txt"
|
| + L"clock$.txt"
|
| #endif
|
| },
|
| - { // Validation should also apply to sugested name
|
| - __LINE__,
|
| - "http://www.goodguy.com/blah$.txt",
|
| - "filename=clock$.txt",
|
| - "",
|
| - "clock$.txt",
|
| - "text/plain",
|
| - L"download",
|
| + {// Validation should also apply to sugested name
|
| + __LINE__,
|
| + "http://www.goodguy.com/blah$.txt",
|
| + "filename=clock$.txt",
|
| + "",
|
| + "clock$.txt",
|
| + "text/plain",
|
| + L"download",
|
| #if defined(OS_WIN)
|
| - L"_clock$.txt"
|
| + L"_clock$.txt"
|
| #else
|
| - L"clock$.txt"
|
| + L"clock$.txt"
|
| #endif
|
| },
|
| - {
|
| - __LINE__,
|
| - "http://www.goodguy.com/mycom1.foo",
|
| - "filename=mycom1.foo",
|
| - "",
|
| - "",
|
| - "text/plain",
|
| - L"download",
|
| - L"mycom1.foo"
|
| - },
|
| - {
|
| - __LINE__,
|
| - "http://www.badguy.com/Setup.exe.local",
|
| - "filename=Setup.exe.local",
|
| - "",
|
| - "",
|
| - "application/foo-bar",
|
| - L"download",
|
| + {__LINE__,
|
| + "http://www.goodguy.com/mycom1.foo",
|
| + "filename=mycom1.foo",
|
| + "",
|
| + "",
|
| + "text/plain",
|
| + L"download",
|
| + L"mycom1.foo"},
|
| + {__LINE__,
|
| + "http://www.badguy.com/Setup.exe.local",
|
| + "filename=Setup.exe.local",
|
| + "",
|
| + "",
|
| + "application/foo-bar",
|
| + L"download",
|
| #if defined(OS_WIN)
|
| - L"Setup.exe.download"
|
| + L"Setup.exe.download"
|
| #else
|
| - L"Setup.exe.local"
|
| + L"Setup.exe.local"
|
| #endif
|
| },
|
| - {
|
| - __LINE__,
|
| - "http://www.badguy.com/Setup.exe.local",
|
| - "filename=Setup.exe.local.local",
|
| - "",
|
| - "",
|
| - "application/foo-bar",
|
| - L"download",
|
| + {__LINE__,
|
| + "http://www.badguy.com/Setup.exe.local",
|
| + "filename=Setup.exe.local.local",
|
| + "",
|
| + "",
|
| + "application/foo-bar",
|
| + L"download",
|
| #if defined(OS_WIN)
|
| - L"Setup.exe.local.download"
|
| + L"Setup.exe.local.download"
|
| #else
|
| - L"Setup.exe.local.local"
|
| + L"Setup.exe.local.local"
|
| #endif
|
| },
|
| - {
|
| - __LINE__,
|
| - "http://www.badguy.com/Setup.exe.lnk",
|
| - "filename=Setup.exe.lnk",
|
| - "",
|
| - "",
|
| - "application/foo-bar",
|
| - L"download",
|
| + {__LINE__,
|
| + "http://www.badguy.com/Setup.exe.lnk",
|
| + "filename=Setup.exe.lnk",
|
| + "",
|
| + "",
|
| + "application/foo-bar",
|
| + L"download",
|
| #if defined(OS_WIN)
|
| - L"Setup.exe.download"
|
| + L"Setup.exe.download"
|
| #else
|
| - L"Setup.exe.lnk"
|
| + L"Setup.exe.lnk"
|
| #endif
|
| },
|
| - {
|
| - __LINE__,
|
| - "http://www.badguy.com/Desktop.ini",
|
| - "filename=Desktop.ini",
|
| - "",
|
| - "",
|
| - "application/foo-bar",
|
| - L"download",
|
| + {__LINE__,
|
| + "http://www.badguy.com/Desktop.ini",
|
| + "filename=Desktop.ini",
|
| + "",
|
| + "",
|
| + "application/foo-bar",
|
| + L"download",
|
| #if defined(OS_WIN)
|
| - L"_Desktop.ini"
|
| + L"_Desktop.ini"
|
| #else
|
| - L"Desktop.ini"
|
| + L"Desktop.ini"
|
| #endif
|
| },
|
| - {
|
| - __LINE__,
|
| - "http://www.badguy.com/Thumbs.db",
|
| - "filename=Thumbs.db",
|
| - "",
|
| - "",
|
| - "application/foo-bar",
|
| - L"download",
|
| + {__LINE__,
|
| + "http://www.badguy.com/Thumbs.db",
|
| + "filename=Thumbs.db",
|
| + "",
|
| + "",
|
| + "application/foo-bar",
|
| + L"download",
|
| #if defined(OS_WIN)
|
| - L"_Thumbs.db"
|
| + L"_Thumbs.db"
|
| #else
|
| - L"Thumbs.db"
|
| + L"Thumbs.db"
|
| #endif
|
| },
|
| - {
|
| - __LINE__,
|
| - "http://www.hotmail.com",
|
| - "filename=source.jpg",
|
| - "",
|
| - "",
|
| - "application/x-javascript",
|
| - L"download",
|
| - L"source.jpg"
|
| - },
|
| - { // http://crbug.com/5772.
|
| - __LINE__,
|
| - "http://www.example.com/foo.tar.gz",
|
| - "",
|
| - "",
|
| - "",
|
| - "application/x-tar",
|
| - L"download",
|
| - L"foo.tar.gz"
|
| - },
|
| - { // http://crbug.com/52250.
|
| - __LINE__,
|
| - "http://www.example.com/foo.tgz",
|
| - "",
|
| - "",
|
| - "",
|
| - "application/x-tar",
|
| - L"download",
|
| - L"foo.tgz"
|
| - },
|
| - { // http://crbug.com/7337.
|
| - __LINE__,
|
| - "http://maged.lordaeron.org/blank.reg",
|
| - "",
|
| - "",
|
| - "",
|
| - "text/x-registry",
|
| - L"download",
|
| - L"blank.reg"
|
| - },
|
| - {
|
| - __LINE__,
|
| - "http://www.example.com/bar.tar",
|
| - "",
|
| - "",
|
| - "",
|
| - "application/x-tar",
|
| - L"download",
|
| - L"bar.tar"
|
| - },
|
| - {
|
| - __LINE__,
|
| - "http://www.example.com/bar.bogus",
|
| - "",
|
| - "",
|
| - "",
|
| - "application/x-tar",
|
| - L"download",
|
| - L"bar.bogus"
|
| - },
|
| - { // http://crbug.com/20337
|
| - __LINE__,
|
| - "http://www.example.com/.download.txt",
|
| - "filename=.download.txt",
|
| - "",
|
| - "",
|
| - "text/plain",
|
| - L"-download",
|
| - L"download.txt"
|
| - },
|
| - { // http://crbug.com/56855.
|
| - __LINE__,
|
| - "http://www.example.com/bar.sh",
|
| - "",
|
| - "",
|
| - "",
|
| - "application/x-sh",
|
| - L"download",
|
| - L"bar.sh"
|
| - },
|
| - { // http://crbug.com/61571
|
| - __LINE__,
|
| - "http://www.example.com/npdf.php?fn=foobar.pdf",
|
| - "",
|
| - "",
|
| - "",
|
| - "text/plain",
|
| - L"download",
|
| - L"npdf" TXT_EXT
|
| - },
|
| - { // Shouldn't overwrite C-D specified extension.
|
| - __LINE__,
|
| - "http://www.example.com/npdf.php?fn=foobar.pdf",
|
| - "filename=foobar.jpg",
|
| - "",
|
| - "",
|
| - "text/plain",
|
| - L"download",
|
| - L"foobar.jpg"
|
| - },
|
| - { // http://crbug.com/87719
|
| - __LINE__,
|
| - "http://www.example.com/image.aspx?id=blargh",
|
| - "",
|
| - "",
|
| - "",
|
| - "image/jpeg",
|
| - L"download",
|
| - L"image" JPEG_EXT
|
| - },
|
| + {__LINE__,
|
| + "http://www.hotmail.com",
|
| + "filename=source.jpg",
|
| + "",
|
| + "",
|
| + "application/x-javascript",
|
| + L"download",
|
| + L"source.jpg"},
|
| + {// http://crbug.com/5772.
|
| + __LINE__,
|
| + "http://www.example.com/foo.tar.gz",
|
| + "",
|
| + "",
|
| + "",
|
| + "application/x-tar",
|
| + L"download",
|
| + L"foo.tar.gz"},
|
| + {// http://crbug.com/52250.
|
| + __LINE__,
|
| + "http://www.example.com/foo.tgz",
|
| + "",
|
| + "",
|
| + "",
|
| + "application/x-tar",
|
| + L"download",
|
| + L"foo.tgz"},
|
| + {// http://crbug.com/7337.
|
| + __LINE__,
|
| + "http://maged.lordaeron.org/blank.reg",
|
| + "",
|
| + "",
|
| + "",
|
| + "text/x-registry",
|
| + L"download",
|
| + L"blank.reg"},
|
| + {__LINE__,
|
| + "http://www.example.com/bar.tar",
|
| + "",
|
| + "",
|
| + "",
|
| + "application/x-tar",
|
| + L"download",
|
| + L"bar.tar"},
|
| + {__LINE__,
|
| + "http://www.example.com/bar.bogus",
|
| + "",
|
| + "",
|
| + "",
|
| + "application/x-tar",
|
| + L"download",
|
| + L"bar.bogus"},
|
| + {// http://crbug.com/20337
|
| + __LINE__,
|
| + "http://www.example.com/.download.txt",
|
| + "filename=.download.txt",
|
| + "",
|
| + "",
|
| + "text/plain",
|
| + L"-download",
|
| + L"download.txt"},
|
| + {// http://crbug.com/56855.
|
| + __LINE__,
|
| + "http://www.example.com/bar.sh",
|
| + "",
|
| + "",
|
| + "",
|
| + "application/x-sh",
|
| + L"download",
|
| + L"bar.sh"},
|
| + {// http://crbug.com/61571
|
| + __LINE__,
|
| + "http://www.example.com/npdf.php?fn=foobar.pdf",
|
| + "",
|
| + "",
|
| + "",
|
| + "text/plain",
|
| + L"download",
|
| + L"npdf" TXT_EXT},
|
| + {// Shouldn't overwrite C-D specified extension.
|
| + __LINE__,
|
| + "http://www.example.com/npdf.php?fn=foobar.pdf",
|
| + "filename=foobar.jpg",
|
| + "",
|
| + "",
|
| + "text/plain",
|
| + L"download",
|
| + L"foobar.jpg"},
|
| + {// http://crbug.com/87719
|
| + __LINE__,
|
| + "http://www.example.com/image.aspx?id=blargh",
|
| + "",
|
| + "",
|
| + "",
|
| + "image/jpeg",
|
| + L"download",
|
| + L"image" JPEG_EXT},
|
| + {__LINE__,
|
| + "http://www.example.com/image.aspx?id=blargh",
|
| + "",
|
| + "",
|
| + " .foo",
|
| + "",
|
| + L"download",
|
| + L"-.foo"},
|
| #if defined(OS_CHROMEOS)
|
| - { // http://crosbug.com/26028
|
| - __LINE__,
|
| - "http://www.example.com/fooa%cc%88.txt",
|
| - "",
|
| - "",
|
| - "",
|
| - "image/jpeg",
|
| - L"foo\xe4",
|
| - L"foo\xe4.txt"
|
| - },
|
| + {// http://crosbug.com/26028
|
| + __LINE__,
|
| + "http://www.example.com/fooa%cc%88.txt",
|
| + "",
|
| + "",
|
| + "",
|
| + "image/jpeg",
|
| + L"foo\xe4",
|
| + L"foo\xe4.txt"},
|
| #endif
|
| };
|
|
|
|
|