michael@0: /** michael@0: * Any copyright is dedicated to the Public Domain. michael@0: * http://creativecommons.org/publicdomain/zero/1.0/ michael@0: */ michael@0: michael@0: var testGenerator = testSteps(); michael@0: michael@0: function testSteps() michael@0: { michael@0: const Bob = { ss: "237-23-7732", name: "Bob" }; michael@0: michael@0: let request = indexedDB.open(this.window ? window.location.pathname : "Splendid Test", 1); michael@0: request.onerror = errorHandler; michael@0: request.onupgradeneeded = grabEventAndContinueHandler; michael@0: let event = yield undefined; michael@0: michael@0: let db = event.target.result; michael@0: event.target.onsuccess = continueToNextStep; michael@0: michael@0: let objectStore = db.createObjectStore("foo", { keyPath: "ss" }); michael@0: objectStore.createIndex("name", "name", { unique: true }); michael@0: objectStore.add(Bob); michael@0: yield undefined; michael@0: michael@0: db.transaction("foo", "readwrite").objectStore("foo") michael@0: .index("name").openCursor().onsuccess = function(event) { michael@0: event.target.transaction.oncomplete = continueToNextStep; michael@0: let cursor = event.target.result; michael@0: if (cursor) { michael@0: let objectStore = event.target.transaction.objectStore("foo"); michael@0: objectStore.delete(Bob.ss) michael@0: .onsuccess = function(event) { cursor.continue(); }; michael@0: } michael@0: }; michael@0: yield undefined; michael@0: finishTest(); michael@0: michael@0: objectStore = null; // Bug 943409 workaround. michael@0: michael@0: yield undefined; michael@0: }