Chromium Code Reviews| Index: content/test/data/indexeddb/corrupted_open_db_detection.html |
| diff --git a/content/test/data/indexeddb/corrupted_open_db_detection.html b/content/test/data/indexeddb/corrupted_open_db_detection.html |
| index 198aed551b8562f7204bf4893915ca14f5668b78..9c98ae7950a5282b9de3698b872a387a339a3adf 100644 |
| --- a/content/test/data/indexeddb/corrupted_open_db_detection.html |
| +++ b/content/test/data/indexeddb/corrupted_open_db_detection.html |
| @@ -10,7 +10,10 @@ |
| <script type="text/javascript" src="common.js"></script> |
| <script> |
| +var testType = 'get'; |
| + |
| function test() { |
| + testType = location.hash.substring(1); |
| indexedDBTest(upgradeCallback, openCallback); |
| } |
| @@ -92,6 +95,27 @@ function getData() { |
| request.onerror = requestError; |
| } |
| +function iterateData() { |
| + transaction = db.transaction('storeName'); |
| + db.onclose = databaseClosed; |
| + transaction.onabort = transactionAbort; |
| + transaction.onerror = transactionError; |
| + var store = transaction.objectStore('storeName'); |
| + var request = store.openCursor(); |
| + request.oncomplete = unexpectedCompleteCallback; |
| + request.onerror = requestError; |
| + request.onsuccess = function (event){ |
| + var cursor = request.result; |
| + if (cursor) { |
| + // Get an object. Probably shouldn't get this far, but won't call this an error. |
| + cursor.continue(); |
| + } else { |
| + // Got the last object. We shouldn't get this far. |
| + fail("Should *not* have been able to iterate over database."); |
| + } |
| + }; |
| +} |
| + |
| function openCallback() { |
| var xmlhttp = new window.XMLHttpRequest(); |
| xmlhttp.open("GET", "/corrupt/test/corruptdb?storeName", false /*sync*/); |
| @@ -99,7 +123,14 @@ function openCallback() { |
| if (xmlhttp.readyState === 4) { |
| if (xmlhttp.status === 200) { |
| // The database is now corrupt. |
| - getData(); |
| + if (testType === 'get') { |
| + getData(); |
| + } else if (testType === 'iterate') { |
| + iterateData(); |
| + } |
| + else { |
|
jsbell
2014/04/14 20:44:20
nit: Put on same line as }
cmumford
2014/04/14 23:39:23
Done.
|
| + fail('Unknown test: "' + testType + '"'); |
| + } |
| } |
| } |
| }; |