2 * Any copyright is dedicated to the Public Domain.
3 * http://creativecommons.org/publicdomain/zero/1.0/
6 /* exported testGenerator */
7 var testGenerator = testSteps();
9 function* testSteps() {
10 let request = indexedDB.open(
11 this.window ? window.location.pathname : "Splendid Test",
14 request.onerror = errorHandler;
15 request.onupgradeneeded = grabEventAndContinueHandler;
16 let event = yield undefined;
18 let db = event.target.result;
20 event.target.onsuccess = continueToNextStep;
22 let objectStore = db.createObjectStore("foo");
23 objectStore.add({}, 1).onerror = errorHandler;
27 objectStore = db.transaction("foo").objectStore("foo");
29 let transaction = objectStore.transaction;
30 transaction.oncomplete = unexpectedSuccessHandler;
31 transaction.onabort = grabEventAndContinueHandler;
35 request = objectStore.get(1);
36 request.onsuccess = unexpectedSuccessHandler;
37 request.onerror = function(event) {
38 is(event.target.error.name, "AbortError", "Good error");
40 event.preventDefault();
45 event = yield undefined;
47 is(event.type, "abort", "Got abort event");
48 is(sawError, true, "Saw get() error");
50 // Make sure the success event isn't queued somehow.
51 SpecialPowers.Services.tm.spinEventLoopUntilEmpty();