OLD | NEW |
---|---|
(Empty) | |
1 if (this.importScripts) { | |
2 importScripts('../../../resources/js-test.js'); | |
3 importScripts('shared.js'); | |
4 } | |
5 | |
6 description("read-only transaction should see the result of a previous readwrite transaction"); | |
jsbell
2014/11/20 18:39:19
nit: Either use the enum values (readonly, readwri
dgrogan
2014/11/21 01:33:11
Done.
| |
7 | |
8 indexedDBTest(prepareDatabase, runTransactions); | |
9 | |
10 function prepareDatabase(evt) | |
11 { | |
12 preamble(evt); | |
13 evalAndLog("db = event.target.result"); | |
14 evalAndLog("store = db.createObjectStore('store')"); | |
15 evalAndLog("store.put('original value', 'key')"); | |
16 } | |
17 | |
18 function runTransactions(evt) | |
19 { | |
20 preamble(evt); | |
21 evalAndLog("db = event.target.result"); | |
22 evalAndLog("transaction1 = db.transaction('store', 'readwrite')"); | |
23 transaction1.onabort = unexpectedAbortCallback; | |
24 evalAndLog("transaction2 = db.transaction('store', 'readonly')"); | |
25 transaction2.onabort = unexpectedAbortCallback; | |
26 | |
27 evalAndLog("request = transaction1.objectStore('store').put('new value', 'ke y')"); | |
28 request.onerror = unexpectedErrorCallback; | |
29 | |
30 evalAndLog("request2 = transaction2.objectStore('store').get('key')"); | |
31 request2.onerror = unexpectedErrorCallback; | |
32 request2.onsuccess = function checkResult(evt) { | |
33 preamble(evt); | |
34 shouldBeEqualToString('request2.result', 'new value'); | |
35 db.close(); | |
36 finishJSTest(); | |
37 }; | |
38 } | |
OLD | NEW |