Bug 1291472 - Add more application reputation extensions. r=gcp

MozReview-Commit-ID: EKXupjU5JG4

--HG--
extra : rebase_source : efc20c18b830c2d942a3b0076969319a66a7f0f6
This commit is contained in:
Francois Marier 2016-08-05 16:56:46 -07:00
Родитель 6346d9e755
Коммит 46576ed14d
1 изменённых файлов: 300 добавлений и 26 удалений

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

@ -396,47 +396,321 @@ PendingLookup::IsBinaryFile()
LOG(("Suggested filename: %s [this = %p]", LOG(("Suggested filename: %s [this = %p]",
NS_ConvertUTF16toUTF8(fileName).get(), this)); NS_ConvertUTF16toUTF8(fileName).get(), this));
return return
// From https://code.google.com/p/chromium/codesearch#chromium/src/chrome/common/safe_browsing/download_protection_util.cc&l=14 // Extracted from the "File Type Policies" Chrome extension
// Archives _may_ contain binaries //StringEndsWith(fileName, NS_LITERAL_STRING(".001")) ||
//StringEndsWith(fileName, NS_LITERAL_STRING(".7z")) ||
//StringEndsWith(fileName, NS_LITERAL_STRING(".ace")) ||
StringEndsWith(fileName, NS_LITERAL_STRING(".action")) || // Mac script
StringEndsWith(fileName, NS_LITERAL_STRING(".ad")) || // AppleDouble encoded file
StringEndsWith(fileName, NS_LITERAL_STRING(".ade")) || // MS Access
StringEndsWith(fileName, NS_LITERAL_STRING(".adp")) || // MS Access
StringEndsWith(fileName, NS_LITERAL_STRING(".apk")) || // Android package
StringEndsWith(fileName, NS_LITERAL_STRING(".app")) || // Mac app
//StringEndsWith(fileName, NS_LITERAL_STRING(".application")) ||
StringEndsWith(fileName, NS_LITERAL_STRING(".appref-ms")) || // Windows
//StringEndsWith(fileName, NS_LITERAL_STRING(".arc")) ||
//StringEndsWith(fileName, NS_LITERAL_STRING(".arj")) ||
StringEndsWith(fileName, NS_LITERAL_STRING(".as")) || // Adobe Flash
StringEndsWith(fileName, NS_LITERAL_STRING(".asp")) || // Windows Server script
StringEndsWith(fileName, NS_LITERAL_STRING(".asx")) || // Windows Media Player
//StringEndsWith(fileName, NS_LITERAL_STRING(".b64")) ||
//StringEndsWith(fileName, NS_LITERAL_STRING(".balz")) ||
StringEndsWith(fileName, NS_LITERAL_STRING(".bas")) || // Basic script
StringEndsWith(fileName, NS_LITERAL_STRING(".bash")) || // Linux shell
StringEndsWith(fileName, NS_LITERAL_STRING(".bat")) || // Windows shell
//StringEndsWith(fileName, NS_LITERAL_STRING(".bhx")) ||
StringEndsWith(fileName, NS_LITERAL_STRING(".bin")) || // Generic binary
//StringEndsWith(fileName, NS_LITERAL_STRING(".bz")) || // Linux archive (bzip)
StringEndsWith(fileName, NS_LITERAL_STRING(".bz2")) || // Linux archive (bzip2)
StringEndsWith(fileName, NS_LITERAL_STRING(".bzip2")) || // Linux archive (bzip2)
StringEndsWith(fileName, NS_LITERAL_STRING(".cab")) || // Windows archive
//StringEndsWith(fileName, NS_LITERAL_STRING(".cdr")) || // Audio CD image
//StringEndsWith(fileName, NS_LITERAL_STRING(".cfg")) ||
StringEndsWith(fileName, NS_LITERAL_STRING(".chi")) || // Windows Help
StringEndsWith(fileName, NS_LITERAL_STRING(".chm")) || // Windows Help
StringEndsWith(fileName, NS_LITERAL_STRING(".class")) || // Java
StringEndsWith(fileName, NS_LITERAL_STRING(".cmd")) || // Windows executable
StringEndsWith(fileName, NS_LITERAL_STRING(".com")) || // Windows executable
StringEndsWith(fileName, NS_LITERAL_STRING(".command")) || // Mac script
//StringEndsWith(fileName, NS_LITERAL_STRING(".cpgz")) ||
//StringEndsWith(fileName, NS_LITERAL_STRING(".cpio")) ||
StringEndsWith(fileName, NS_LITERAL_STRING(".cpl")) || // Windows
StringEndsWith(fileName, NS_LITERAL_STRING(".crt")) || // Windows
StringEndsWith(fileName, NS_LITERAL_STRING(".crx")) || // Chrome extensions
StringEndsWith(fileName, NS_LITERAL_STRING(".csh")) || // Linux shell
StringEndsWith(fileName, NS_LITERAL_STRING(".dart")) || // Dart script
StringEndsWith(fileName, NS_LITERAL_STRING(".dc42")) || // Apple DiskCopy Image
StringEndsWith(fileName, NS_LITERAL_STRING(".deb")) || // Linux package
StringEndsWith(fileName, NS_LITERAL_STRING(".dex")) || // MS Excel
StringEndsWith(fileName, NS_LITERAL_STRING(".diskcopy42")) || // Apple DiskCopy Image
StringEndsWith(fileName, NS_LITERAL_STRING(".dll")) || // Windows
StringEndsWith(fileName, NS_LITERAL_STRING(".dmg")) || // Mac disk image
StringEndsWith(fileName, NS_LITERAL_STRING(".dmgpart")) || // Mac disk image
//StringEndsWith(fileName, NS_LITERAL_STRING(".docb")) ||
StringEndsWith(fileName, NS_LITERAL_STRING(".docm")) || // MS Word
StringEndsWith(fileName, NS_LITERAL_STRING(".docx")) || // MS Word
StringEndsWith(fileName, NS_LITERAL_STRING(".dotm")) || // MS Word
//StringEndsWith(fileName, NS_LITERAL_STRING(".dott")) ||
StringEndsWith(fileName, NS_LITERAL_STRING(".drv")) || // Windows driver
//StringEndsWith(fileName, NS_LITERAL_STRING(".dvdr")) || // DVD image
StringEndsWith(fileName, NS_LITERAL_STRING(".efi")) || // Firmware
StringEndsWith(fileName, NS_LITERAL_STRING(".eml")) || // Email
StringEndsWith(fileName, NS_LITERAL_STRING(".exe")) || // Windows executable
//StringEndsWith(fileName, NS_LITERAL_STRING(".fat")) ||
StringEndsWith(fileName, NS_LITERAL_STRING(".fon")) || // Windows font
//StringEndsWith(fileName, NS_LITERAL_STRING(".fxp")) ||
StringEndsWith(fileName, NS_LITERAL_STRING(".gadget")) || // Windows
StringEndsWith(fileName, NS_LITERAL_STRING(".grp")) || // Windows
StringEndsWith(fileName, NS_LITERAL_STRING(".gz")) || // Linux archive (gzip)
StringEndsWith(fileName, NS_LITERAL_STRING(".gzip")) || // Linux archive (gzip)
StringEndsWith(fileName, NS_LITERAL_STRING(".hfs")) || // Mac disk image
StringEndsWith(fileName, NS_LITERAL_STRING(".hlp")) || // Windows Help
StringEndsWith(fileName, NS_LITERAL_STRING(".hqx")) || // Mac archive
StringEndsWith(fileName, NS_LITERAL_STRING(".hta")) || // HTML program file
StringEndsWith(fileName, NS_LITERAL_STRING(".htt")) || // MS HTML template
StringEndsWith(fileName, NS_LITERAL_STRING(".img")) || // Generic image
StringEndsWith(fileName, NS_LITERAL_STRING(".imgpart")) || // Mac disk image
StringEndsWith(fileName, NS_LITERAL_STRING(".inf")) || // Windows installer
//StringEndsWith(fileName, NS_LITERAL_STRING(".ini")) ||
StringEndsWith(fileName, NS_LITERAL_STRING(".ins")) || // InstallShield
StringEndsWith(fileName, NS_LITERAL_STRING(".inx")) || // InstallShield
StringEndsWith(fileName, NS_LITERAL_STRING(".iso")) || // CD image
//StringEndsWith(fileName, NS_LITERAL_STRING(".isp")) ||
StringEndsWith(fileName, NS_LITERAL_STRING(".isu")) || // InstallShield
StringEndsWith(fileName, NS_LITERAL_STRING(".jar")) || // Java
StringEndsWith(fileName, NS_LITERAL_STRING(".jnlp")) || // Java
StringEndsWith(fileName, NS_LITERAL_STRING(".job")) || // Windows
StringEndsWith(fileName, NS_LITERAL_STRING(".js")) || // JavaScript script
StringEndsWith(fileName, NS_LITERAL_STRING(".jse")) || // JScript
StringEndsWith(fileName, NS_LITERAL_STRING(".ksh")) || // Linux shell
//StringEndsWith(fileName, NS_LITERAL_STRING(".lha")) ||
StringEndsWith(fileName, NS_LITERAL_STRING(".lnk")) || // Windows
//StringEndsWith(fileName, NS_LITERAL_STRING(".local")) ||
//StringEndsWith(fileName, NS_LITERAL_STRING(".lpaq1")) ||
//StringEndsWith(fileName, NS_LITERAL_STRING(".lpaq5")) ||
//StringEndsWith(fileName, NS_LITERAL_STRING(".lpaq8")) ||
//StringEndsWith(fileName, NS_LITERAL_STRING(".lzh")) ||
//StringEndsWith(fileName, NS_LITERAL_STRING(".lzma")) ||
StringEndsWith(fileName, NS_LITERAL_STRING(".mad")) || // MS Access
StringEndsWith(fileName, NS_LITERAL_STRING(".maf")) || // MS Access
StringEndsWith(fileName, NS_LITERAL_STRING(".mag")) || // MS Access
StringEndsWith(fileName, NS_LITERAL_STRING(".mam")) || // MS Access
//StringEndsWith(fileName, NS_LITERAL_STRING(".manifest")) ||
StringEndsWith(fileName, NS_LITERAL_STRING(".maq")) || // MS Access
StringEndsWith(fileName, NS_LITERAL_STRING(".mar")) || // MS Access
StringEndsWith(fileName, NS_LITERAL_STRING(".mas")) || // MS Access
StringEndsWith(fileName, NS_LITERAL_STRING(".mat")) || // MS Access
//StringEndsWith(fileName, NS_LITERAL_STRING(".mau")) ||
StringEndsWith(fileName, NS_LITERAL_STRING(".mav")) || // MS Access
StringEndsWith(fileName, NS_LITERAL_STRING(".maw")) || // MS Access
StringEndsWith(fileName, NS_LITERAL_STRING(".mda")) || // MS Access
StringEndsWith(fileName, NS_LITERAL_STRING(".mdb")) || // MS Access
StringEndsWith(fileName, NS_LITERAL_STRING(".mde")) || // MS Access
StringEndsWith(fileName, NS_LITERAL_STRING(".mdt")) || // MS Access
StringEndsWith(fileName, NS_LITERAL_STRING(".mdw")) || // MS Access
StringEndsWith(fileName, NS_LITERAL_STRING(".mdz")) || // MS Access
StringEndsWith(fileName, NS_LITERAL_STRING(".mht")) || // MS HTML
StringEndsWith(fileName, NS_LITERAL_STRING(".mhtml")) || // MS HTML
StringEndsWith(fileName, NS_LITERAL_STRING(".mim")) || // MS Mail
StringEndsWith(fileName, NS_LITERAL_STRING(".mmc")) || // MS Office
//StringEndsWith(fileName, NS_LITERAL_STRING(".mof")) ||
//StringEndsWith(fileName, NS_LITERAL_STRING(".mpkg")) ||
StringEndsWith(fileName, NS_LITERAL_STRING(".msc")) || // MS Windows
StringEndsWith(fileName, NS_LITERAL_STRING(".msg")) || // Email
StringEndsWith(fileName, NS_LITERAL_STRING(".msh")) || // Windows shell
StringEndsWith(fileName, NS_LITERAL_STRING(".msh1")) || // Windows shell
StringEndsWith(fileName, NS_LITERAL_STRING(".msh1xml")) || // Windows shell
StringEndsWith(fileName, NS_LITERAL_STRING(".msh2")) || // Windows shell
StringEndsWith(fileName, NS_LITERAL_STRING(".msh2xml")) || // Windows shell
StringEndsWith(fileName, NS_LITERAL_STRING(".mshxml")) || // Windows
StringEndsWith(fileName, NS_LITERAL_STRING(".msi")) || // Windows installer
StringEndsWith(fileName, NS_LITERAL_STRING(".msp")) || // Windows installer
StringEndsWith(fileName, NS_LITERAL_STRING(".mst")) || // Windows installer
StringEndsWith(fileName, NS_LITERAL_STRING(".ndif")) || // Mac disk image
//StringEndsWith(fileName, NS_LITERAL_STRING(".ntfs")) || // 7z
StringEndsWith(fileName, NS_LITERAL_STRING(".ocx")) || // ActiveX
StringEndsWith(fileName, NS_LITERAL_STRING(".ops")) || // MS Office
StringEndsWith(fileName, NS_LITERAL_STRING(".osx")) || // Mac PowerPC executable
StringEndsWith(fileName, NS_LITERAL_STRING(".out")) || // Linux binary
StringEndsWith(fileName, NS_LITERAL_STRING(".paf")) || // PortableApps package
//StringEndsWith(fileName, NS_LITERAL_STRING(".paq8f")) ||
//StringEndsWith(fileName, NS_LITERAL_STRING(".paq8jd")) ||
//StringEndsWith(fileName, NS_LITERAL_STRING(".paq8l")) ||
//StringEndsWith(fileName, NS_LITERAL_STRING(".paq8o")) ||
StringEndsWith(fileName, NS_LITERAL_STRING(".partial")) || // Downloads
//StringEndsWith(fileName, NS_LITERAL_STRING(".pax")) ||
//StringEndsWith(fileName, NS_LITERAL_STRING(".pcd")) || // Kodak Picture CD
StringEndsWith(fileName, NS_LITERAL_STRING(".pdf")) || // Adobe Acrobat
//StringEndsWith(fileName, NS_LITERAL_STRING(".pea")) ||
StringEndsWith(fileName, NS_LITERAL_STRING(".pet")) || // Linux package
StringEndsWith(fileName, NS_LITERAL_STRING(".pif")) || // Windows
StringEndsWith(fileName, NS_LITERAL_STRING(".pkg")) || // Mac installer
StringEndsWith(fileName, NS_LITERAL_STRING(".pl")) || // Perl script
//StringEndsWith(fileName, NS_LITERAL_STRING(".plg")) ||
StringEndsWith(fileName, NS_LITERAL_STRING(".potx")) || // MS PowerPoint
StringEndsWith(fileName, NS_LITERAL_STRING(".ppam")) || // MS PowerPoint
StringEndsWith(fileName, NS_LITERAL_STRING(".ppsx")) || // MS PowerPoint
StringEndsWith(fileName, NS_LITERAL_STRING(".pptm")) || // MS PowerPoint
StringEndsWith(fileName, NS_LITERAL_STRING(".pptx")) || // MS PowerPoint
StringEndsWith(fileName, NS_LITERAL_STRING(".prf")) || // MS Outlook
//StringEndsWith(fileName, NS_LITERAL_STRING(".prg")) ||
StringEndsWith(fileName, NS_LITERAL_STRING(".ps1")) || // Windows shell
StringEndsWith(fileName, NS_LITERAL_STRING(".ps1xml")) || // Windows shell
StringEndsWith(fileName, NS_LITERAL_STRING(".ps2")) || // Windows shell
StringEndsWith(fileName, NS_LITERAL_STRING(".ps2xml")) || // Windows shell
StringEndsWith(fileName, NS_LITERAL_STRING(".psc1")) || // Windows shell
StringEndsWith(fileName, NS_LITERAL_STRING(".psc2")) || // Windows shell
StringEndsWith(fileName, NS_LITERAL_STRING(".pst")) || // MS Outlook
StringEndsWith(fileName, NS_LITERAL_STRING(".pup")) || // Linux package
StringEndsWith(fileName, NS_LITERAL_STRING(".py")) || // Python script
StringEndsWith(fileName, NS_LITERAL_STRING(".pyc")) || // Python binary
StringEndsWith(fileName, NS_LITERAL_STRING(".pyw")) || // Python GUI
//StringEndsWith(fileName, NS_LITERAL_STRING(".quad")) ||
//StringEndsWith(fileName, NS_LITERAL_STRING(".r00")) ||
//StringEndsWith(fileName, NS_LITERAL_STRING(".r01")) ||
//StringEndsWith(fileName, NS_LITERAL_STRING(".r02")) ||
//StringEndsWith(fileName, NS_LITERAL_STRING(".r03")) ||
//StringEndsWith(fileName, NS_LITERAL_STRING(".r04")) ||
//StringEndsWith(fileName, NS_LITERAL_STRING(".r05")) ||
//StringEndsWith(fileName, NS_LITERAL_STRING(".r06")) ||
//StringEndsWith(fileName, NS_LITERAL_STRING(".r07")) ||
//StringEndsWith(fileName, NS_LITERAL_STRING(".r08")) ||
//StringEndsWith(fileName, NS_LITERAL_STRING(".r09")) ||
//StringEndsWith(fileName, NS_LITERAL_STRING(".r10")) ||
//StringEndsWith(fileName, NS_LITERAL_STRING(".r11")) ||
//StringEndsWith(fileName, NS_LITERAL_STRING(".r12")) ||
//StringEndsWith(fileName, NS_LITERAL_STRING(".r13")) ||
//StringEndsWith(fileName, NS_LITERAL_STRING(".r14")) ||
//StringEndsWith(fileName, NS_LITERAL_STRING(".r15")) ||
//StringEndsWith(fileName, NS_LITERAL_STRING(".r16")) ||
//StringEndsWith(fileName, NS_LITERAL_STRING(".r17")) ||
//StringEndsWith(fileName, NS_LITERAL_STRING(".r18")) ||
//StringEndsWith(fileName, NS_LITERAL_STRING(".r19")) ||
//StringEndsWith(fileName, NS_LITERAL_STRING(".r20")) ||
//StringEndsWith(fileName, NS_LITERAL_STRING(".r21")) ||
//StringEndsWith(fileName, NS_LITERAL_STRING(".r22")) ||
//StringEndsWith(fileName, NS_LITERAL_STRING(".r23")) ||
//StringEndsWith(fileName, NS_LITERAL_STRING(".r24")) ||
//StringEndsWith(fileName, NS_LITERAL_STRING(".r25")) ||
//StringEndsWith(fileName, NS_LITERAL_STRING(".r26")) ||
//StringEndsWith(fileName, NS_LITERAL_STRING(".r27")) ||
//StringEndsWith(fileName, NS_LITERAL_STRING(".r28")) ||
//StringEndsWith(fileName, NS_LITERAL_STRING(".r29")) ||
//StringEndsWith(fileName, NS_LITERAL_STRING(".rar")) ||
StringEndsWith(fileName, NS_LITERAL_STRING(".rb")) || // Ruby script
StringEndsWith(fileName, NS_LITERAL_STRING(".reg")) || // Windows
StringEndsWith(fileName, NS_LITERAL_STRING(".rels")) || // MS Office
StringEndsWith(fileName, NS_LITERAL_STRING(".rgs")) || // InstallShield
StringEndsWith(fileName, NS_LITERAL_STRING(".rpm")) || // Linux package
StringEndsWith(fileName, NS_LITERAL_STRING(".rtf")) || // MS Office
StringEndsWith(fileName, NS_LITERAL_STRING(".run")) || // Linux shell
StringEndsWith(fileName, NS_LITERAL_STRING(".scf")) || // Windows shell
StringEndsWith(fileName, NS_LITERAL_STRING(".scr")) || // Windows
StringEndsWith(fileName, NS_LITERAL_STRING(".sct")) || // Windows shell
StringEndsWith(fileName, NS_LITERAL_STRING(".search-ms")) || // Windows
StringEndsWith(fileName, NS_LITERAL_STRING(".sh")) || // Linux shell
StringEndsWith(fileName, NS_LITERAL_STRING(".shar")) || // Linux shell
StringEndsWith(fileName, NS_LITERAL_STRING(".shb")) || // Windows
StringEndsWith(fileName, NS_LITERAL_STRING(".shs")) || // Windows shell
StringEndsWith(fileName, NS_LITERAL_STRING(".sldm")) || // MS PowerPoint
StringEndsWith(fileName, NS_LITERAL_STRING(".sldx")) || // MS PowerPoint
StringEndsWith(fileName, NS_LITERAL_STRING(".slp")) || // Linux package
StringEndsWith(fileName, NS_LITERAL_STRING(".smi")) || // Mac disk image
StringEndsWith(fileName, NS_LITERAL_STRING(".sparsebundle")) || // Mac disk image
StringEndsWith(fileName, NS_LITERAL_STRING(".sparseimage")) || // Mac disk image
StringEndsWith(fileName, NS_LITERAL_STRING(".spl")) || // Windows
//StringEndsWith(fileName, NS_LITERAL_STRING(".squashfs")) ||
StringEndsWith(fileName, NS_LITERAL_STRING(".svg")) ||
StringEndsWith(fileName, NS_LITERAL_STRING(".swf")) || // Adobe Flash
StringEndsWith(fileName, NS_LITERAL_STRING(".swm")) || // Windows Imaging
StringEndsWith(fileName, NS_LITERAL_STRING(".sys")) || // Windows
StringEndsWith(fileName, NS_LITERAL_STRING(".tar")) || // Linux archive
StringEndsWith(fileName, NS_LITERAL_STRING(".taz")) || // Linux archive (bzip2)
StringEndsWith(fileName, NS_LITERAL_STRING(".tbz")) || // Linux archive (bzip2)
StringEndsWith(fileName, NS_LITERAL_STRING(".tbz2")) || // Linux archive (bzip2)
StringEndsWith(fileName, NS_LITERAL_STRING(".tcsh")) || // Linux shell
StringEndsWith(fileName, NS_LITERAL_STRING(".tgz")) || // Linux archive (gzip)
//StringEndsWith(fileName, NS_LITERAL_STRING(".toast")) ||
//StringEndsWith(fileName, NS_LITERAL_STRING(".torrent")) || // Bittorrent
StringEndsWith(fileName, NS_LITERAL_STRING(".tpz")) || // Linux archive (gzip)
StringEndsWith(fileName, NS_LITERAL_STRING(".txz")) || // Linux archive (xz)
StringEndsWith(fileName, NS_LITERAL_STRING(".tz")) || // Linux archive (gzip)
//StringEndsWith(fileName, NS_LITERAL_STRING(".u3p")) ||
StringEndsWith(fileName, NS_LITERAL_STRING(".udf")) || // MS Excel
StringEndsWith(fileName, NS_LITERAL_STRING(".udif")) || // Mac disk image
StringEndsWith(fileName, NS_LITERAL_STRING(".url")) || // Windows
//StringEndsWith(fileName, NS_LITERAL_STRING(".uu")) ||
//StringEndsWith(fileName, NS_LITERAL_STRING(".uue")) ||
StringEndsWith(fileName, NS_LITERAL_STRING(".vb")) || // Visual Basic script
StringEndsWith(fileName, NS_LITERAL_STRING(".vbe")) || // Visual Basic script
StringEndsWith(fileName, NS_LITERAL_STRING(".vbs")) || // Visual Basic script
StringEndsWith(fileName, NS_LITERAL_STRING(".vbscript")) || // Visual Basic script
StringEndsWith(fileName, NS_LITERAL_STRING(".vhd")) || // Windows virtual hard drive
StringEndsWith(fileName, NS_LITERAL_STRING(".vhdx")) || // Windows virtual hard drive
StringEndsWith(fileName, NS_LITERAL_STRING(".vmdk")) || // VMware virtual disk
StringEndsWith(fileName, NS_LITERAL_STRING(".vsd")) || // MS Visio
StringEndsWith(fileName, NS_LITERAL_STRING(".vsmacros")) || // MS Visual Studio
StringEndsWith(fileName, NS_LITERAL_STRING(".vss")) || // MS Visio
StringEndsWith(fileName, NS_LITERAL_STRING(".vst")) || // MS Visio
StringEndsWith(fileName, NS_LITERAL_STRING(".vsw")) || // MS Visio
StringEndsWith(fileName, NS_LITERAL_STRING(".website")) || // MSIE
StringEndsWith(fileName, NS_LITERAL_STRING(".wim")) || // Windows Imaging
StringEndsWith(fileName, NS_LITERAL_STRING(".workflow")) || // Mac Automator
//StringEndsWith(fileName, NS_LITERAL_STRING(".wrc")) || // FreeArc archive
StringEndsWith(fileName, NS_LITERAL_STRING(".ws")) || // Windows script
StringEndsWith(fileName, NS_LITERAL_STRING(".wsc")) || // Windows script
StringEndsWith(fileName, NS_LITERAL_STRING(".wsf")) || // Windows script
StringEndsWith(fileName, NS_LITERAL_STRING(".wsh")) || // Windows script
StringEndsWith(fileName, NS_LITERAL_STRING(".xar")) || // MS Excel
StringEndsWith(fileName, NS_LITERAL_STRING(".xbap")) || // MS Silverlight
//StringEndsWith(fileName, NS_LITERAL_STRING(".xip")) ||
StringEndsWith(fileName, NS_LITERAL_STRING(".xlsm")) || // MS Excel
StringEndsWith(fileName, NS_LITERAL_STRING(".xlsx")) || // MS Excel
StringEndsWith(fileName, NS_LITERAL_STRING(".xltm")) || // MS Excel
StringEndsWith(fileName, NS_LITERAL_STRING(".xltx")) || // MS Excel
StringEndsWith(fileName, NS_LITERAL_STRING(".xml")) ||
StringEndsWith(fileName, NS_LITERAL_STRING(".xnk")) || // MS Exchange
StringEndsWith(fileName, NS_LITERAL_STRING(".xrm-ms")) || // Windows
StringEndsWith(fileName, NS_LITERAL_STRING(".xsl")) || // XML Stylesheet
//StringEndsWith(fileName, NS_LITERAL_STRING(".xxe")) ||
StringEndsWith(fileName, NS_LITERAL_STRING(".xz")) || // Linux archive (xz)
StringEndsWith(fileName, NS_LITERAL_STRING(".z")) || // InstallShield
#ifdef XP_WIN // disable on Mac/Linux, see 1167493 #ifdef XP_WIN // disable on Mac/Linux, see 1167493
StringEndsWith(fileName, NS_LITERAL_STRING(".zip")) || StringEndsWith(fileName, NS_LITERAL_STRING(".zip")) || // Generic archive
#endif #endif
// Android extensions StringEndsWith(fileName, NS_LITERAL_STRING(".zipx")); // WinZip
StringEndsWith(fileName, NS_LITERAL_STRING(".apk")) || //StringEndsWith(fileName, NS_LITERAL_STRING(".zpaq"));
// Windows extensions
StringEndsWith(fileName, NS_LITERAL_STRING(".bas")) ||
StringEndsWith(fileName, NS_LITERAL_STRING(".bat")) ||
StringEndsWith(fileName, NS_LITERAL_STRING(".cab")) ||
StringEndsWith(fileName, NS_LITERAL_STRING(".cmd")) ||
StringEndsWith(fileName, NS_LITERAL_STRING(".com")) ||
StringEndsWith(fileName, NS_LITERAL_STRING(".exe")) ||
StringEndsWith(fileName, NS_LITERAL_STRING(".hta")) ||
StringEndsWith(fileName, NS_LITERAL_STRING(".msi")) ||
StringEndsWith(fileName, NS_LITERAL_STRING(".pif")) ||
StringEndsWith(fileName, NS_LITERAL_STRING(".reg")) ||
StringEndsWith(fileName, NS_LITERAL_STRING(".scr")) ||
StringEndsWith(fileName, NS_LITERAL_STRING(".vb")) ||
StringEndsWith(fileName, NS_LITERAL_STRING(".vbs")) ||
// Mac extensions
StringEndsWith(fileName, NS_LITERAL_STRING(".app")) ||
StringEndsWith(fileName, NS_LITERAL_STRING(".dmg")) ||
StringEndsWith(fileName, NS_LITERAL_STRING(".osx")) ||
StringEndsWith(fileName, NS_LITERAL_STRING(".pkg"));
} }
ClientDownloadRequest::DownloadType ClientDownloadRequest::DownloadType
PendingLookup::GetDownloadType(const nsAString& aFilename) { PendingLookup::GetDownloadType(const nsAString& aFilename) {
MOZ_ASSERT(IsBinaryFile()); MOZ_ASSERT(IsBinaryFile());
// From https://code.google.com/p/chromium/codesearch#chromium/src/chrome/common/safe_browsing/download_protection_util.cc&l=46 // From https://cs.chromium.org/chromium/src/chrome/common/safe_browsing/download_protection_util.cc?l=17
if (StringEndsWith(aFilename, NS_LITERAL_STRING(".zip"))) { if (StringEndsWith(aFilename, NS_LITERAL_STRING(".zip"))) {
return ClientDownloadRequest::ZIPPED_EXECUTABLE; return ClientDownloadRequest::ZIPPED_EXECUTABLE;
} else if (StringEndsWith(aFilename, NS_LITERAL_STRING(".apk"))) { } else if (StringEndsWith(aFilename, NS_LITERAL_STRING(".apk"))) {
return ClientDownloadRequest::ANDROID_APK; return ClientDownloadRequest::ANDROID_APK;
} else if (StringEndsWith(aFilename, NS_LITERAL_STRING(".app")) || } else if (StringEndsWith(aFilename, NS_LITERAL_STRING(".app")) ||
StringEndsWith(aFilename, NS_LITERAL_STRING(".cdr")) ||
StringEndsWith(aFilename, NS_LITERAL_STRING(".dart")) ||
StringEndsWith(aFilename, NS_LITERAL_STRING(".dc42")) ||
StringEndsWith(aFilename, NS_LITERAL_STRING(".diskcopy42")) ||
StringEndsWith(aFilename, NS_LITERAL_STRING(".dmg")) || StringEndsWith(aFilename, NS_LITERAL_STRING(".dmg")) ||
StringEndsWith(aFilename, NS_LITERAL_STRING(".dmgpart")) ||
StringEndsWith(aFilename, NS_LITERAL_STRING(".dvdr")) ||
StringEndsWith(aFilename, NS_LITERAL_STRING(".img")) ||
StringEndsWith(aFilename, NS_LITERAL_STRING(".imgpart")) ||
StringEndsWith(aFilename, NS_LITERAL_STRING(".iso")) ||
StringEndsWith(aFilename, NS_LITERAL_STRING(".mpkg")) ||
StringEndsWith(aFilename, NS_LITERAL_STRING(".ndif")) ||
StringEndsWith(aFilename, NS_LITERAL_STRING(".osx")) || StringEndsWith(aFilename, NS_LITERAL_STRING(".osx")) ||
StringEndsWith(aFilename, NS_LITERAL_STRING(".pkg"))) { StringEndsWith(aFilename, NS_LITERAL_STRING(".pkg")) ||
StringEndsWith(aFilename, NS_LITERAL_STRING(".smi")) ||
StringEndsWith(aFilename, NS_LITERAL_STRING(".sparsebundle")) ||
StringEndsWith(aFilename, NS_LITERAL_STRING(".sparseimage")) ||
StringEndsWith(aFilename, NS_LITERAL_STRING(".toast")) ||
StringEndsWith(aFilename, NS_LITERAL_STRING(".udif"))) {
return ClientDownloadRequest::MAC_EXECUTABLE; return ClientDownloadRequest::MAC_EXECUTABLE;
} }