Bug 1178196 - Fix race in Cache API orphaned data tests. r=ehsan, a=test-only
authorBen Kelly <ben@wanderview.com>
Tue, 30 Jun 2015 08:31:00 -0700
changeset 281365 a627cb75c00120ea69b08fcf5d22bbfc27288360
parent 281364 305900080dba4edb96b76b5881a5418b19ec0e9c
child 281366 b80325fdc034a0445d93da2b45bf477a3d6930ea
push id4932
push userjlund@mozilla.com
push dateMon, 10 Aug 2015 18:23:06 +0000
treeherdermozilla-beta@6dd5a4f5f745 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan, test-only
bugs1178196
milestone41.0a2
Bug 1178196 - Fix race in Cache API orphaned data tests. r=ehsan, a=test-only
dom/cache/test/mochitest/test_cache_orphaned_body.html
dom/cache/test/mochitest/test_cache_orphaned_cache.html
--- a/dom/cache/test/mochitest/test_cache_orphaned_body.html
+++ b/dom/cache/test/mochitest/test_cache_orphaned_body.html
@@ -105,16 +105,23 @@ SpecialPowers.pushPrefEnv({
   }).then(function(c) {
     return c.add(url);
   }).then(function() {
     return gc();
   }).then(function() {
     return caches.delete(name);
   }).then(function(deleted) {
     ok(deleted, 'cache should be deleted');
+
+    // This is a bit superfluous, but its necessary to make sure the Cache is
+    // fully deleted before we proceed.  The deletion actually takes place in
+    // two async steps.  We don't want to resetStorage() until the second step
+    // has taken place.  This extra Cache operation ensure that all the
+    // runnables have been flushed through the threads, etc.
+    return caches.has(name);
   })
 
   // Now measure initial disk usage
   .then(function() {
     return resetStorage();
   }).then(function() {
     return storageUsage();
   }).then(function(usage) {
--- a/dom/cache/test/mochitest/test_cache_orphaned_cache.html
+++ b/dom/cache/test/mochitest/test_cache_orphaned_cache.html
@@ -104,16 +104,23 @@ SpecialPowers.pushPrefEnv({
   }).then(function(c) {
     return c.add(url);
   }).then(function() {
     return gc();
   }).then(function() {
     return caches.delete(name);
   }).then(function(deleted) {
     ok(deleted, 'cache should be deleted');
+
+    // This is a bit superfluous, but its necessary to make sure the Cache is
+    // fully deleted before we proceed.  The deletion actually takes place in
+    // two async steps.  We don't want to resetStorage() until the second step
+    // has taken place.  This extra Cache operation ensure that all the
+    // runnables have been flushed through the threads, etc.
+    return caches.has(name);
   })
 
   // Now measure initial disk usage
   .then(function() {
     return resetStorage();
   }).then(function() {
     return storageUsage();
   }).then(function(usage) {