Bug 701634, Make flaky tests wait for transactions to complete before continuing to the next test
authorBen Turner <bent.mozilla@gmail.com>
Wed, 17 Dec 2014 09:04:06 -0800
changeset 220209 8d40b95ffdbfa357790e81ee4dc39b67b506576e
parent 220208 3e6f63e57dc5fa4e1f6cf8b01c325aec8a635572
child 220210 3a105575e0da5af97664769a4fb5bd9f4fbfdf8a
push id10457
push userryanvm@gmail.com
push dateThu, 18 Dec 2014 01:54:25 +0000
treeherderfx-team@0e441ff66c5e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs701634
milestone37.0a1
Bug 701634, Make flaky tests wait for transactions to complete before continuing to the next test
dom/indexedDB/test/unit/test_remove_index.js
dom/indexedDB/test/unit/test_remove_objectStore.js
--- a/dom/indexedDB/test/unit/test_remove_index.js
+++ b/dom/indexedDB/test/unit/test_remove_index.js
@@ -45,11 +45,14 @@ function testSteps()
 
   let index2 = objectStore.createIndex(indexName, "foo");
   isnot(index, index2, "New instance should be created");
 
   is(objectStore.indexNames.length, 1, "Correct recreacted indexNames list");
   is(objectStore.indexNames.item(0), indexName, "Correct recreacted name");
   is(objectStore.index(indexName), index2, "Correct instance");
 
+  event.target.transaction.oncomplete = grabEventAndContinueHandler;
+  event = yield undefined;
+
   finishTest();
   yield undefined;
 }
--- a/dom/indexedDB/test/unit/test_remove_objectStore.js
+++ b/dom/indexedDB/test/unit/test_remove_objectStore.js
@@ -32,16 +32,19 @@ function testSteps()
       }
     }
   }
   yield undefined;
 
   is(db.objectStoreNames.length, 1, "Correct objectStoreNames list");
   is(db.objectStoreNames.item(0), objectStoreName, "Correct name");
 
+  event.target.transaction.oncomplete = grabEventAndContinueHandler;
+  event = yield undefined;
+
   db.close();
 
   request = indexedDB.open(name, 2);
   request.onerror = errorHandler;
   request.onupgradeneeded = grabEventAndContinueHandler;
   event = yield undefined;
 
   db = event.target.result;
@@ -76,30 +79,37 @@ function testSteps()
   event = yield undefined;
 
   db.deleteObjectStore(objectStore.name);
   is(db.objectStoreNames.length, 0, "Correct objectStores list");
 
   continueToNextStep();
   yield undefined;
 
+  trans.oncomplete = grabEventAndContinueHandler;
+  event = yield undefined;
+
   db.close();
 
   request = indexedDB.open(name, 3);
   request.onerror = errorHandler;
   request.onupgradeneeded = grabEventAndContinueHandler;
   event = yield undefined;
 
   db = event.target.result;
+  trans = event.target.transaction;
 
   objectStore = db.createObjectStore(objectStoreName, { keyPath: "foo" });
 
   request = objectStore.add({foo:"bar"});
   request.onerror = errorHandler;
   request.onsuccess = grabEventAndContinueHandler;
 
   db.deleteObjectStore(objectStoreName);
 
   event = yield undefined;
 
+  trans.oncomplete = grabEventAndContinueHandler;
+  event = yield undefined;
+
   finishTest();
   yield undefined;
 }