blob: 587b5d59ce46503d3ab4d7d4a0c0e3c66c564cb0 [file] [log] [blame]
indexedDBTest(prepareDatabase);
function done() { finishJSTest(); }
function unexpectedErrorCallback() { alert("unexpected error"); done(); }
function getRequestCallback(event) {
alert(event.target.result);
done();
}
function dbOpenedSecondTime(event) {
var getRequest = event.target.result.transaction(["foo"], "readonly").objectStore("foo").get("key");
getRequest.onsuccess = getRequestCallback;
getRequest.onerror = unexpectedErrorCallback;
}
function getValueFromIDB() {
var openRequest = window.indexedDB.open(dbname);
openRequest.onsuccess = dbOpenedSecondTime;
openRequest.onblocked = unexpectedErrorCallback;
}
function makeDetachedFrame() {
var iframe = document.getElementById('testIframe');
iframe.contentWindow.postMessage('value1inDB', '*');
setTimeout(getValueFromIDB, 500);
}
function prepareDatabase(event) {
var request = event.target.result.createObjectStore("foo").add("original value", "key");
request.onsuccess = makeDetachedFrame;
request.onerror = unexpectedErrorCallback;
}