diff options
Diffstat (limited to 'LayoutTests/storage/indexeddb/transaction-basics.html')
-rw-r--r-- | LayoutTests/storage/indexeddb/transaction-basics.html | 164 |
1 files changed, 82 insertions, 82 deletions
diff --git a/LayoutTests/storage/indexeddb/transaction-basics.html b/LayoutTests/storage/indexeddb/transaction-basics.html index cd42419..8995e6d 100644 --- a/LayoutTests/storage/indexeddb/transaction-basics.html +++ b/LayoutTests/storage/indexeddb/transaction-basics.html @@ -1,28 +1,28 @@ -<html> -<head> -<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css"> -<script src="../../fast/js/resources/js-test-pre.js"></script> -<script src="../../fast/js/resources/js-test-post-function.js"></script> -<script src="resources/shared.js"></script> -</head> -<body> -<p id="description"></p> -<div id="console"></div> -<script> - -description("Test IndexedDB transaction basics."); -if (window.layoutTestController) - layoutTestController.waitUntilDone(); - -function test() -{ - shouldBeTrue("'webkitIndexedDB' in window"); - shouldBeFalse("webkitIndexedDB == null"); - - result = evalAndLog("webkitIndexedDB.open('name')"); - verifyResult(result); - result.onsuccess = openSuccess; - result.onerror = unexpectedErrorCallback; +<html>
+<head>
+<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+<script src="../../fast/js/resources/js-test-post-function.js"></script>
+<script src="resources/shared.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script>
+
+description("Test IndexedDB transaction basics.");
+if (window.layoutTestController)
+ layoutTestController.waitUntilDone();
+
+function test()
+{
+ shouldBeTrue("'webkitIndexedDB' in window");
+ shouldBeFalse("webkitIndexedDB == null");
+
+ result = evalAndLog("webkitIndexedDB.open('name')");
+ verifyResult(result);
+ result.onsuccess = openSuccess;
+ result.onerror = unexpectedErrorCallback;
}
function openSuccess()
@@ -184,7 +184,7 @@ function checkMetadataEmpty() {
shouldBe("window.db.objectStoreNames", "[]");
shouldBe("window.db.objectStoreNames.length", "0");
- shouldBe("window.db.objectStoreNames.contains('storeFail')", "false"); + shouldBe("window.db.objectStoreNames.contains('storeFail')", "false");
}
function checkMetadataExistingObjectStore()
@@ -192,63 +192,63 @@ function checkMetadataExistingObjectStore() shouldBe("db.objectStoreNames", "['storeFail']");
shouldBe("db.objectStoreNames.length", "1");
shouldBe("db.objectStoreNames.contains('storeFail')", "true");
-} - -function setNewVersion() -{ - result = evalAndLog("db.setVersion('new version')"); - verifyResult(result); - result.onsuccess = setVersionSuccess; - result.onerror = unexpectedErrorCallback; -} - -function setVersionSuccess() -{ - debug("setVersionSuccess():"); - verifySuccessEvent(event); - window.trans = evalAndLog("trans = event.result"); - shouldBeTrue("trans !== null"); - trans.onabort = unexpectedAbortCallback; - trans.oncomplete = completeCallback; - window.completeEventFired = false; - - deleteAllObjectStores(db, createObjectStoreAndStartTransaction); +}
+
+function setNewVersion()
+{
+ result = evalAndLog("db.setVersion('new version')");
+ verifyResult(result);
+ result.onsuccess = setVersionSuccess;
+ result.onerror = unexpectedErrorCallback;
+}
+
+function setVersionSuccess()
+{
+ debug("setVersionSuccess():");
+ verifySuccessEvent(event);
+ window.trans = evalAndLog("trans = event.result");
+ shouldBeTrue("trans !== null");
+ trans.onabort = unexpectedAbortCallback;
+ trans.oncomplete = completeCallback;
+ window.completeEventFired = false;
+
+ deleteAllObjectStores(db, createObjectStoreAndStartTransaction);
}
function createObjectStoreAndStartTransaction()
{
- evalAndLog("db.createObjectStore('storeName', null)"); - transaction = evalAndLog("db.transaction()"); - transaction.onabort = abortCallback; - var store = evalAndLog("store = transaction.objectStore('storeName')"); - shouldBeEqualToString("store.name", "storeName"); -} - -function completeCallback() -{ - verifyCompleteEvent(event); - window.completeEventFired = true; -} - -function abortCallback() -{ - verifyAbortEvent(event); - checkForCompleteEvent(); -} - -function checkForCompleteEvent() -{ - if (completeEventFired) { - testPassed("oncomplete event had fired"); - done(); - } else - setTimeout(checkForCompleteEvent, 1); -} - -var successfullyParsed = true; - -test(); - -</script> -</body> -</html> + evalAndLog("db.createObjectStore('storeName', null)");
+ transaction = evalAndLog("db.transaction({mode: webkitIDBTransaction.READ_WRITE})");
+ transaction.onabort = abortCallback;
+ var store = evalAndLog("store = transaction.objectStore('storeName')");
+ shouldBeEqualToString("store.name", "storeName");
+}
+
+function completeCallback()
+{
+ verifyCompleteEvent(event);
+ window.completeEventFired = true;
+}
+
+function abortCallback()
+{
+ verifyAbortEvent(event);
+ checkForCompleteEvent();
+}
+
+function checkForCompleteEvent()
+{
+ if (completeEventFired) {
+ testPassed("oncomplete event had fired");
+ done();
+ } else
+ setTimeout(checkForCompleteEvent, 1);
+}
+
+var successfullyParsed = true;
+
+test();
+
+</script>
+</body>
+</html>
|