зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1824959 - add tests for .desktop sanitization, r=NeilDeakin
Differential Revision: https://phabricator.services.mozilla.com/D173966
This commit is contained in:
Родитель
859144ba5e
Коммит
83b725df8b
|
@ -110,6 +110,11 @@ add_task(async function test_sanitize() {
|
|||
testSanitize("thing.local|", "thing.local.download");
|
||||
testSanitize("thing.lo|cal", "thing.lo cal");
|
||||
testSanitize('thing.local/*"', "thing.local_");
|
||||
|
||||
testSanitize("thing.desktoP", "thing.desktoP.download");
|
||||
testSanitize("thing.desktoP \n", "thing.desktoP", {
|
||||
allowInvalidFilenames: true,
|
||||
});
|
||||
});
|
||||
|
||||
add_task(async function test_splitBaseNameAndExtension() {
|
||||
|
|
|
@ -375,4 +375,24 @@ add_task(async function validate_filename_method() {
|
|||
"filename.URL",
|
||||
"filename.URL allow invalid, sanitize only"
|
||||
);
|
||||
|
||||
Assert.equal(
|
||||
mimeService.validateFileNameForSaving(
|
||||
"filename.desktop",
|
||||
"text/unknown",
|
||||
mimeService.VALIDATE_SANITIZE_ONLY
|
||||
),
|
||||
"filename.desktop.download",
|
||||
"filename.desktop sanitize only"
|
||||
);
|
||||
Assert.equal(
|
||||
mimeService.validateFileNameForSaving(
|
||||
"filename.DESKTOP\n",
|
||||
"text/unknown",
|
||||
mimeService.VALIDATE_SANITIZE_ONLY |
|
||||
mimeService.VALIDATE_ALLOW_INVALID_FILENAMES
|
||||
),
|
||||
"filename.DESKTOP",
|
||||
"filename.DESKTOP allow invalid, sanitize only"
|
||||
);
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче