blob: 7055adee3716c385fd74264bb1cd613e434b550f [file] [log] [blame]
<!DOCTYPE html>
<script>
var objectStore = null;
var putRequest = null;
function keepTransactionAlive() {
try {
putRequest = objectStore.put("value", "key");
putRequest.onsuccess = keepTransactionAlive;
} catch (e) {
putRequest = null;
}
}
function openDatabase() {
var databaseName = "database-transaction-cycle-iframe";
window.indexedDB.deleteDatabase(databaseName);
var openRequest = window.indexedDB.open(databaseName);
openRequest.onupgradeneeded = (event) => {
var database = event.target.result;
objectStore = database.createObjectStore("objectStore");
event.target.transaction.onabort = () => parent.frameTransactionAborted();
keepTransactionAlive();
parent.frameDatabaseOpened();
};
}
openDatabase();
</script>