Bug 1681924 - add application/zip to extraMimeEntries to help recognize zip files, r=mak

Differential Revision: https://phabricator.services.mozilla.com/D100009
This commit is contained in:
Gijs Kruitbosch 2020-12-18 12:54:40 +00:00
Родитель 988f23dd34
Коммит 8f053bc4d0
2 изменённых файлов: 9 добавлений и 8 удалений

Просмотреть файл

@ -488,6 +488,7 @@ static const nsExtraMimeTypeEntry extraMimeEntries[] = {
{APPLICATION_GZIP2, "gz", "gzip"},
{"application/x-arj", "arj", "ARJ file"},
{"application/rtf", "rtf", "Rich Text Format File"},
{APPLICATION_ZIP, "zip", "ZIP Archive"},
{APPLICATION_XPINSTALL, "xpi", "XPInstall Install"},
{APPLICATION_PDF, "pdf", "Portable Document Format"},
{APPLICATION_POSTSCRIPT, "ps,eps,ai", "Postscript File"},

Просмотреть файл

@ -15,18 +15,18 @@ add_task(async function test_check_unknown_mime_type() {
Assert.equal(zipType, "application/x-zip-compressed");
try {
let extension = mimeService.getPrimaryExtension("application/zip", "");
Assert.ok(!extension, "Expect no known extension for zip files.");
} catch (ex) {
Assert.ok(
ex,
"We'll take an exception instead of an empty string, I guess."
Assert.equal(
extension,
"zip",
"Expect our own info to provide an extension for zip files."
);
} catch (ex) {
Assert.ok(false, "We shouldn't throw when getting zip info.");
}
let found = {};
let mimeInfo = mimeService.getMIMEInfoFromOS("application/zip", "zip", found);
Assert.ok(
found.value,
"Should be able to find mime info even for the unknown mimetype."
mimeInfo.hasDefaultHandler,
"Should have a default app for zip files"
);
Assert.ok(mimeInfo.hasDefaultHandler, "Should have a default app");
});