Bug 944918 - Allow thumbs.db in the storage directory; r=asuth a=jcristau
authorTom Tung <shes050117@gmail.com>
Mon, 03 Jun 2019 16:22:43 +0000
changeset 536698 5ec902740c06f2f5a07e29daef9fdcbdba72e1df
parent 536697 794943628c3b0f522df456695520b9083038062d
child 536699 0be0455b63e02d8cd9c096a4837f6a47167fcb62
push id2082
push userffxbld-merge
push dateMon, 01 Jul 2019 08:34:18 +0000
treeherdermozilla-release@2fb19d0466d2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersasuth, jcristau
bugs944918
milestone68.0
Bug 944918 - Allow thumbs.db in the storage directory; r=asuth a=jcristau Differential Revision: https://phabricator.services.mozilla.com/D33453
dom/quota/ActorsParent.cpp
dom/quota/QuotaCommon.h
dom/quota/test/unit/test_allowListFiles.js
dom/quota/test/unit/test_whiteListFiles.js
dom/quota/test/unit/xpcshell.ini
--- a/dom/quota/ActorsParent.cpp
+++ b/dom/quota/ActorsParent.cpp
@@ -3134,17 +3134,17 @@ void QuotaManager::ShutdownInstance() {
   MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(runnable.forget()));
 }
 
 // static
 bool QuotaManager::IsOSMetadata(const nsAString& aFileName) {
   return aFileName.EqualsLiteral(DSSTORE_FILE_NAME) ||
          aFileName.EqualsLiteral(DESKTOP_FILE_NAME) ||
          aFileName.LowerCaseEqualsLiteral(DESKTOP_INI_FILE_NAME) ||
-         aFileName.EqualsLiteral(THUMBS_DB_FILE_NAME);
+         aFileName.LowerCaseEqualsLiteral(THUMBS_DB_FILE_NAME);
 }
 
 // static
 bool QuotaManager::IsDotFile(const nsAString& aFileName) {
   return aFileName.First() == char16_t('.');
 }
 
 auto QuotaManager::CreateDirectoryLock(
--- a/dom/quota/QuotaCommon.h
+++ b/dom/quota/QuotaCommon.h
@@ -21,17 +21,17 @@
   } /* namespace quota */   \
   } /* namespace dom */     \
   } /* namespace mozilla */
 #define USING_QUOTA_NAMESPACE using namespace mozilla::dom::quota;
 
 #define DSSTORE_FILE_NAME ".DS_Store"
 #define DESKTOP_FILE_NAME ".desktop"
 #define DESKTOP_INI_FILE_NAME "desktop.ini"
-#define THUMBS_DB_FILE_NAME "Thumbs.db"
+#define THUMBS_DB_FILE_NAME "thumbs.db"
 
 #define QM_WARNING(...)                                                      \
   do {                                                                       \
     nsPrintfCString str(__VA_ARGS__);                                        \
     mozilla::dom::quota::ReportInternalError(__FILE__, __LINE__, str.get()); \
     NS_WARNING(str.get());                                                   \
   } while (0)
 
rename from dom/quota/test/unit/test_whiteListFiles.js
rename to dom/quota/test/unit/test_allowListFiles.js
--- a/dom/quota/test/unit/test_whiteListFiles.js
+++ b/dom/quota/test/unit/test_allowListFiles.js
@@ -1,39 +1,40 @@
 /**
  * Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /**
- * This test is mainly to verify thoes unexpected files are in the white list of
+ * This test is mainly to verify thoes unexpected files are in the allow list of
  * QuotaManager. They aren't expected in the repository but if there are,
  * QuotaManager shouldn't fail to initialize an origin and getting usage, though
  * those files aren't managed by QuotaManager.
  */
 
 async function testSteps()
 {
-  const whiteListFiles = [
+  const allowListFiles = [
     ".dot-file",
     "desktop.ini",
     "Desktop.ini",
-    "Thumbs.db"
+    "Thumbs.db",
+    "thumbs.db"
   ];
 
-  for (let whiteListFile of whiteListFiles) {
-    info("Testing " + whiteListFile + " in the repository");
+  for (let allowListFile of allowListFiles) {
+    info("Testing " + allowListFile + " in the repository");
 
     info("Creating unknown file");
 
     for (let dir of ["persistenceType dir", "origin dir"]) {
       let dirPath =
         dir == "persistenceType dir" ? "storage/default/"
                                      : "storage/default/http+++example.com/";
-        let file = getRelativeFile(dirPath + whiteListFile);
+        let file = getRelativeFile(dirPath + allowListFile);
         file.create(Ci.nsIFile.NORMAL_FILE_TYPE, parseInt("0644", 8));
     }
 
     info("Initializing an origin");
 
     let request = initOrigin(getPrincipal("http://example.com"), "default");
     await requestFinished(request);
 
--- a/dom/quota/test/unit/xpcshell.ini
+++ b/dom/quota/test/unit/xpcshell.ini
@@ -21,16 +21,17 @@ support-files =
   originAttributesUpgrade_profile.zip
   removeLocalStorage1_profile.zip
   removeLocalStorage2_profile.zip
   storagePersistentUpgrade_profile.zip
   tempMetadataCleanup_profile.zip
   version2_1upgrade_profile.zip
   version2_2upgrade_profile.zip
 
+[test_allowListFiles.js]
 [test_basics.js]
 [test_bad_origin_directory.js]
 [test_createLocalStorage.js]
 [test_clearStorageForPrincipal.js]
 [test_defaultStorageUpgrade.js]
 [test_getUsage.js]
 [test_groupMismatch.js]
 [test_idbSubdirUpgrade.js]
@@ -52,9 +53,8 @@ support-files =
 [test_simpledb.js]
 [test_specialOrigins.js]
 [test_storagePersistentUpgrade.js]
 [test_storagePressure.js]
 [test_tempMetadataCleanup.js]
 [test_unknownFiles.js]
 [test_validOrigins.js]
 [test_version2_1upgrade.js]
-[test_whiteListFiles.js]