<!DOCTYPE html>
<title>IndexedDB: Deleting an object store with a new index should complete</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script>
var t = async_test('Deleting an object store with a new index should complete');
t.step(function() {
var dbName = 'db' + location.pathname;
var deleteRequest = indexedDB.deleteDatabase(dbName);
deleteRequest.onsuccess = t.step_func(function() {
var openRequest = indexedDB.open(dbName);
openRequest.onupgradeneeded = t.step_func(function(e) {
var db = openRequest.result;
var store = db.createObjectStore('store');
store.put('value', 'key');
store.createIndex('index', 'keyPath');
assert_array_equals(db.objectStoreNames, ['store'], 'One store should be present.');
assert_array_equals(store.indexNames, ['index'], 'One index should be present.');
db.deleteObjectStore('store');
assert_array_equals(db.objectStoreNames, [], 'No stores should be present.');
});
openRequest.onsuccess = t.step_func(function(e) {
var db = openRequest.result;
assert_array_equals(db.objectStoreNames, [], 'No stores should be present.');
t.done();
});
});
});
</script>