blob: bcaf972ad303177fc12305c4cc306af9ae23b23d [file] [log] [blame]
<script>
var dbName = "StoreBlobToBeDeleted";
var request = window.indexedDB.deleteDatabase(dbName);
request.onsuccess = function(e)
{
continueTest();
}
request.onerror = function(e)
{
window.webkit.messageHandlers.testHandler.postMessage('Error deleting database');
}
var db;
function continueTest(event)
{
var request = window.indexedDB.open(dbName);
request.onupgradeneeded = function(e) {
db = e.target.result;
var objectStore = db.createObjectStore("TestStore");
const blobData = ["fun ", "times ", "all ", "around!"];
let blob = new Blob(blobData, { type: "text/plain" });
var addRequest = objectStore.add(blob, "BlobKey");
addRequest.onerror = function() {
window.webkit.messageHandlers.testHandler.postMessage('Error storing blob in database');
}
}
request.onsuccess = function() {
db.close();
window.webkit.messageHandlers.testHandler.postMessage('Success');
}
request.onerror = function() {
window.webkit.messageHandlers.testHandler.postMessage('Error storing blob in database');
}
}
</script>