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: 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: let transaction = event.target.transaction; michael@0: michael@0: let objectStore1 = db.createObjectStore("foo"); michael@0: let objectStore2 = transaction.objectStore("foo"); michael@0: ok(objectStore1 === objectStore2, "Got same objectStores"); michael@0: michael@0: let index1 = objectStore1.createIndex("bar", "key"); michael@0: let index2 = objectStore2.index("bar"); michael@0: ok(index1 === index2, "Got same indexes"); michael@0: michael@0: request.onsuccess = continueToNextStep; michael@0: yield undefined; michael@0: michael@0: transaction = db.transaction(db.objectStoreNames); michael@0: michael@0: let objectStore3 = transaction.objectStore("foo"); michael@0: let objectStore4 = transaction.objectStore("foo"); michael@0: ok(objectStore3 === objectStore4, "Got same objectStores"); michael@0: michael@0: ok(objectStore3 !== objectStore1, "Different objectStores"); michael@0: ok(objectStore4 !== objectStore2, "Different objectStores"); michael@0: michael@0: let index3 = objectStore3.index("bar"); michael@0: let index4 = objectStore4.index("bar"); michael@0: ok(index3 === index4, "Got same indexes"); michael@0: michael@0: ok(index3 !== index1, "Different indexes"); michael@0: ok(index4 !== index2, "Different indexes"); michael@0: michael@0: finishTest(); michael@0: yield undefined; michael@0: } michael@0: