2 * Any copyright is dedicated to the Public Domain.
3 * http://creativecommons.org/publicdomain/zero/1.0/
6 /* exported testSteps */
7 async function testSteps() {
8 const name = this.window ? window.location.pathname : "Splendid Test";
9 const objectStoreName = "foo";
10 const indexName = "bar",
13 info("Opening database");
15 let request = indexedDB.open(name);
16 let event = await expectingUpgrade(request);
18 let db = event.target.result;
20 info("Creating objectStore");
22 let objectStore = db.createObjectStore(objectStoreName);
24 info("Creating a duplicated object store to get an error");
27 db.createObjectStore(objectStoreName);
30 "ConstraintError should be thrown if object store already exists"
33 ok(true, "ConstraintError should be thrown if object store already exists");
36 "IDBDatabase.createObjectStore: Object store named '" +
38 "' already exists at index '0'",
39 "Threw with correct error message"
43 info("Creating an index");
45 objectStore.createIndex(indexName, keyPath);
47 info("Creating a duplicated indexes to verify the error message");
50 objectStore.createIndex(indexName, keyPath);
52 ok(false, "ConstraintError should be thrown if index already exists");
54 ok(true, "ConstraintError should be thrown if index already exists");
57 `IDBObjectStore.createIndex: Index named '${indexName}' already exists at index '0'`,
58 "Threw with correct error message"
62 await expectingSuccess(request);