diff options
Diffstat (limited to 'LayoutTests/storage/indexeddb/database-quota.html')
-rw-r--r-- | LayoutTests/storage/indexeddb/database-quota.html | 94 |
1 files changed, 47 insertions, 47 deletions
diff --git a/LayoutTests/storage/indexeddb/database-quota.html b/LayoutTests/storage/indexeddb/database-quota.html index b4207d4..d21b051 100644 --- a/LayoutTests/storage/indexeddb/database-quota.html +++ b/LayoutTests/storage/indexeddb/database-quota.html @@ -53,8 +53,8 @@ function createNewObjectStore() shouldBe("db.objectStoreNames.length", "0"); shouldBe("db.objectStoreNames.contains('')", "false"); - objectStore = evalAndLog('db.createObjectStore("test123")');
- checkObjectStore();
+ objectStore = evalAndLog('db.createObjectStore("test123")'); + checkObjectStore(); commitAndContinue(); } @@ -64,54 +64,54 @@ function checkObjectStore() shouldBe("db.objectStoreNames.length", "1"); shouldBe("db.objectStoreNames.contains('')", "false"); shouldBe("db.objectStoreNames.contains('test456')", "false"); - shouldBe("db.objectStoreNames.contains('test123')", "true");
-}
-
-function commitAndContinue()
-{
+ shouldBe("db.objectStoreNames.contains('test123')", "true"); +} + +function commitAndContinue() +{ window.setTimeout(checkQuotaEnforcing, 0); -}
-
-function checkQuotaEnforcing()
-{
- var trans = evalAndLog("trans = db.transaction()");
- trans.onabort = testComplete;
- trans.oncomplete = unexpectedCompleteCallback;
- debug("Creating 'data' which contains 64K of data");
- window.data = "X";
- for (var i = 0; i < 16; i++)
- data += data;
- shouldBe("data.length", "65536");
- window.dataAdded = 0;
- window.store = evalAndLog("store = trans.objectStore('test123')");
- addData();
-}
-
-function addData()
-{
- if (dataAdded < 5 * 1024 * 1024) {
+} + +function checkQuotaEnforcing() +{ + var trans = evalAndLog("trans = db.transaction({mode: webkitIDBTransaction.READ_WRITE})"); + trans.onabort = testComplete; + trans.oncomplete = unexpectedCompleteCallback; + debug("Creating 'data' which contains 64K of data"); + window.data = "X"; + for (var i = 0; i < 16; i++) + data += data; + shouldBe("data.length", "65536"); + window.dataAdded = 0; + window.store = evalAndLog("store = trans.objectStore('test123')"); + addData(); +} + +function addData() +{ + if (dataAdded < 5 * 1024 * 1024) { if (dataAdded > 0) store = event.source; - } else {
- testFailed("added more than quota");
- done();
- return;
- }
- dataAdded += 65536;
- result = store.add({x: data}, dataAdded);
- result.onsuccess = addData;
- result.onerror = logError;
-}
-
-function logError()
-{
- debug("Error function called: (" + event.code + ") " + event.message);
- verifyErrorEvent(event);
-}
-
-function testComplete()
-{
- testPassed("Adding data failed due to quota error. Data added was about " + Math.round(dataAdded / 1024 / 1024) + " MB");
+ } else { + testFailed("added more than quota"); + done(); + return; + } + dataAdded += 65536; + result = store.add({x: data}, dataAdded); + result.onsuccess = addData; + result.onerror = logError; +} + +function logError() +{ + debug("Error function called: (" + event.code + ") " + event.message); + verifyErrorEvent(event); +} + +function testComplete() +{ + testPassed("Adding data failed due to quota error. Data added was about " + Math.round(dataAdded / 1024 / 1024) + " MB"); done(); } |