blob: 6b084fa14355f6670b5625ad203b10368718e3bf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
/**
* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
/* exported testGenerator */
var testGenerator = testSteps();
function* testSteps() {
const dbName = this.window
? window.location.pathname
: "test_transaction_duplicate_store_names";
const dbVersion = 1;
const objectStoreName = "foo";
const data = {};
const dataKey = 1;
let request = indexedDB.open(dbName, dbVersion);
request.onerror = errorHandler;
request.onupgradeneeded = grabEventAndContinueHandler;
request.onsuccess = grabEventAndContinueHandler;
let event = yield undefined;
let db = event.target.result;
let objectStore = db.createObjectStore(objectStoreName);
objectStore.add(data, dataKey);
event = yield undefined;
db = event.target.result;
let transaction = db.transaction(
[objectStoreName, objectStoreName],
"readwrite"
);
transaction.onerror = errorHandler;
transaction.oncomplete = grabEventAndContinueHandler;
event = yield undefined;
ok(true, "Transaction created successfully");
finishTest();
}
|