Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /** |
michael@0 | 2 | * Any copyright is dedicated to the Public Domain. |
michael@0 | 3 | * http://creativecommons.org/publicdomain/zero/1.0/ |
michael@0 | 4 | */ |
michael@0 | 5 | |
michael@0 | 6 | var testGenerator = testSteps(); |
michael@0 | 7 | |
michael@0 | 8 | function testSteps() |
michael@0 | 9 | { |
michael@0 | 10 | let request = indexedDB.open(this.window ? window.location.pathname : "Splendid Test", 1); |
michael@0 | 11 | request.onerror = errorHandler; |
michael@0 | 12 | request.onupgradeneeded = grabEventAndContinueHandler; |
michael@0 | 13 | let event = yield undefined; |
michael@0 | 14 | |
michael@0 | 15 | let db = event.target.result; |
michael@0 | 16 | db.onerror = errorHandler; |
michael@0 | 17 | |
michael@0 | 18 | request.onsuccess = continueToNextStep; |
michael@0 | 19 | |
michael@0 | 20 | db.createObjectStore("foo"); |
michael@0 | 21 | yield undefined; |
michael@0 | 22 | |
michael@0 | 23 | let trans1 = db.transaction("foo", "readwrite"); |
michael@0 | 24 | let trans2 = db.transaction("foo", "readwrite"); |
michael@0 | 25 | |
michael@0 | 26 | let request1 = trans2.objectStore("foo").put("2", 42); |
michael@0 | 27 | let request2 = trans1.objectStore("foo").put("1", 42); |
michael@0 | 28 | |
michael@0 | 29 | request1.onerror = errorHandler; |
michael@0 | 30 | request2.onerror = errorHandler; |
michael@0 | 31 | |
michael@0 | 32 | trans1.oncomplete = grabEventAndContinueHandler; |
michael@0 | 33 | trans2.oncomplete = grabEventAndContinueHandler; |
michael@0 | 34 | |
michael@0 | 35 | yield undefined; |
michael@0 | 36 | yield undefined; |
michael@0 | 37 | |
michael@0 | 38 | let trans3 = db.transaction("foo", "readonly"); |
michael@0 | 39 | let request = trans3.objectStore("foo").get(42); |
michael@0 | 40 | request.onsuccess = grabEventAndContinueHandler; |
michael@0 | 41 | request.onerror = errorHandler; |
michael@0 | 42 | |
michael@0 | 43 | let event = yield undefined; |
michael@0 | 44 | is(event.target.result, "2", "Transactions were ordered properly."); |
michael@0 | 45 | |
michael@0 | 46 | finishTest(); |
michael@0 | 47 | yield undefined; |
michael@0 | 48 | } |
michael@0 | 49 |