let index1 = objectStore.createIndex(indexName1, "bar");
is(objectStore.index(indexName1).name, index1.name, "Correct index name");
is(index1.name, indexName1, "Correct index name");
let index2 = objectStore.createIndex(indexName2, "baz");
is(objectStore.index(indexName2).name, index2.name, "Correct index name");
is(index2.name, indexName2, "Correct index name");
db = event.target.result;
txn = event.target.transaction;
objectStore = txn.objectStore(storeName);
index1 = objectStore.index(indexName1);
index2 = objectStore.index(indexName2);
is(index1.name, indexName1, "Correct index name");
is(index2.name, indexName2, "Correct index name");
// Rename with the name already adopted by the other index. try {
index1.name = indexName2;
ok( false, "ConstraintError shall be thrown if the index name already exists."
);
} catch (e) {
ok(e instanceof DOMException, "got a database exception");
is(e.name, "ConstraintError", "correct error");
}
// Rename with identical name. try {
index1.name = indexName1;
ok(true, "It shall be fine to set the same name.");
} catch (e) {
ok(false, "Got a database exception: " + e.name);
}
objectStore.deleteIndex(indexName2);
// Rename after deleted. try {
index2.name = indexName2;
ok(false, "InvalidStateError shall be thrown if deleted.");
} catch (e) {
ok(e instanceof DOMException, "got a database exception");
is(e.name, "InvalidStateError", "correct error");
}
// Rename when the transaction is inactive. try {
index1.name = indexName1;
ok( false, "TransactionInactiveError shall be thrown if the transaction is inactive."
);
} catch (e) {
ok(e instanceof DOMException, "got a database exception");
is(e.name, "TransactionInactiveError", "correct error");
}
info("Rename when the transaction is not an upgrade one.");
request = indexedDB.open(name, 2);
request.onerror = errorHandler;
request.onupgradeneeded = errorHandler;
request.onsuccess = grabEventAndContinueHandler;
event = yield undefined;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.