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: db.onerror = errorHandler; michael@0: michael@0: request.onsuccess = continueToNextStep; michael@0: michael@0: db.createObjectStore("foo"); michael@0: yield undefined; michael@0: michael@0: let trans1 = db.transaction("foo", "readwrite"); michael@0: let trans2 = db.transaction("foo", "readwrite"); michael@0: michael@0: let request1 = trans2.objectStore("foo").put("2", 42); michael@0: let request2 = trans1.objectStore("foo").put("1", 42); michael@0: michael@0: request1.onerror = errorHandler; michael@0: request2.onerror = errorHandler; michael@0: michael@0: trans1.oncomplete = grabEventAndContinueHandler; michael@0: trans2.oncomplete = grabEventAndContinueHandler; michael@0: michael@0: yield undefined; michael@0: yield undefined; michael@0: michael@0: let trans3 = db.transaction("foo", "readonly"); michael@0: let request = trans3.objectStore("foo").get(42); michael@0: request.onsuccess = grabEventAndContinueHandler; michael@0: request.onerror = errorHandler; michael@0: michael@0: let event = yield undefined; michael@0: is(event.target.result, "2", "Transactions were ordered properly."); michael@0: michael@0: finishTest(); michael@0: yield undefined; michael@0: } michael@0: