Backed out 2 changesets (bug 1581067) for xpcshell failures at dom/cache/test/xpcshell/test_empty_directories.js on a CLOSED TREE
authorCoroiu Cristina <ccoroiu@mozilla.com>
Mon, 30 Sep 2019 14:35:01 +0300
changeset 495642 5d83a502d367de1332ceb234275416f315328340
parent 495641 283763664a4b94cdfe9124846cdb04114c197440
child 495643 a633169505d41ea1377124758adc13eac7ec0ff0
push id114140
push userdvarga@mozilla.com
push dateWed, 02 Oct 2019 18:04:51 +0000
treeherdermozilla-inbound@32eb0ea893f3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1581067
milestone71.0a1
backs oute7a90d8f615d7902d127febd00e5c2231cbef5ee
b7c882c1e3d30ea3ddaf09bb77125906aeb50329
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out 2 changesets (bug 1581067) for xpcshell failures at dom/cache/test/xpcshell/test_empty_directories.js on a CLOSED TREE Backed out changeset e7a90d8f615d (bug 1581067) Backed out changeset b7c882c1e3d3 (bug 1581067)
dom/cache/Manager.cpp
dom/cache/test/xpcshell/test_empty_directories.js
dom/cache/test/xpcshell/xpcshell.ini
--- a/dom/cache/Manager.cpp
+++ b/dom/cache/Manager.cpp
@@ -1447,25 +1447,17 @@ class Manager::OpenStreamAction final : 
     if (NS_WARN_IF(!mBodyStream)) {
       return NS_ERROR_FILE_NOT_FOUND;
     }
 
     return rv;
   }
 
   virtual void Complete(Listener* aListener, ErrorResult&& aRv) override {
-    if (aRv.Failed()) {
-      // Ignore the reason for fail and just pass a null input stream to let it
-      // fail.
-      aRv.SuppressException();
-      mResolver(nullptr);
-    } else {
-      mResolver(std::move(mBodyStream));
-    }
-
+    mResolver(std::move(mBodyStream));
     mResolver = nullptr;
   }
 
  private:
   InputStreamResolver mResolver;
   const nsID mBodyId;
   nsCOMPtr<nsIInputStream> mBodyStream;
 };
deleted file mode 100644
--- a/dom/cache/test/xpcshell/test_empty_directories.js
+++ /dev/null
@@ -1,105 +0,0 @@
-/**
- *  This test is mainly to verify cache won't leave emptry directory.
- */
-
-function resetStorage() {
-  return new Promise(function(resolve, reject) {
-    var qms = Services.qms;
-    var request = qms.reset();
-    request.callback = resolve;
-  });
-}
-
-async function setUpEnv() {
-  Services.prefs.setBoolPref("dom.quotaManager.testing", true);
-
-  create_test_profile("schema_25_profile.zip");
-
-  // Trigger storage upgrade
-  await caches.open("test");
-  const cacheDir = getCacheDir();
-  let morgueDir = cacheDir.clone();
-  morgueDir.append("morgue");
-
-  // There are two body directories inside the the profile. To test the
-  // initOrigin should remove the empty directories and keep the directories
-  // with files inside, we need to do some hacks here.
-  let makeEmptyDir = false;
-  for (let dir of morgueDir.directoryEntries) {
-    if (!makeEmptyDir) {
-      for (let file of dir.directoryEntries) {
-        file.remove(false);
-      }
-      makeEmptyDir = true;
-    }
-  }
-
-  await resetStorage();
-}
-
-// This function ensure the directory with file shouldn't have been deleted and
-// ensure the directory without file should've been deleted.
-function verifyResult() {
-  const cacheDir = getCacheDir();
-  let morgueDir = cacheDir.clone();
-  morgueDir.append("morgue");
-
-  let foundEmpty = false;
-  let foundNotempty = false;
-  for (let dir of morgueDir.directoryEntries) {
-    let empty = true;
-    // eslint-disable-next-line no-unused-vars
-    for (let file of dir.directoryEntries) {
-      empty = false;
-    }
-
-    foundNotempty = !empty || foundNotempty;
-    foundEmpty = foundEmpty || empty;
-  }
-  return !foundEmpty && foundNotempty;
-}
-
-async function run_test() {
-  const url = "https://www.mozilla.org";
-  do_test_pending();
-
-  info("Setting up environment");
-
-  await setUpEnv();
-
-  info("Test 0 - InitOrigin shouldn't leave an empty directoy");
-
-  let cache = await caches.open("test");
-  let response = await cache.match(url);
-  ok(!!response, "Upgrade from 25 to 26 do succeed");
-  ok(verifyResult(), "InitOrigin should clean all empty directories");
-
-  info("Test 1 - DeleteBodyFiles shouldn't leave an empty directoy");
-
-  await cache.put(url, response.clone());
-  await cache.delete(url);
-
-  // Extra operation to ensure the deletion is completed
-  await cache.match(url);
-
-  ok(verifyResult(), "Empty directory should be removed");
-
-  info("Test 2 - DeleteOrphanedBodyFiles shouldn't leave an empty directoy");
-
-  await cache.put(url, response.clone());
-  // eslint-disable-next-line no-unused-vars
-  let r = await cache.match(url);
-  await cache.delete(url);
-  await resetStorage();
-
-  cache = await caches.open("test");
-
-  // Extra operation to ensure the deletion is completed
-  await cache.match(url);
-
-  ok(verifyResult(), "Empty directory should be removed");
-
-  await caches.delete("test");
-
-  do_test_finished();
-}
--- a/dom/cache/test/xpcshell/xpcshell.ini
+++ b/dom/cache/test/xpcshell/xpcshell.ini
@@ -9,12 +9,11 @@ support-files =
   schema_15_profile.zip
   schema_25_profile.zip
 
 # dummy test entry to generate profile zip files
 [make_profile.js]
   skip-if = true
 
 [test_bug1425146.js]
-[test_empty_directories.js]
 [test_migration.js]
 [test_padding_error_handle.js]
 [test_schema_26_upgrade.js]