Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(431)

Unified Diff: trunk/src/content/test/data/indexeddb/corrupted_open_db_detection.html

Issue 216433007: Revert 260147 "Handling LevelDB errors encountered after open." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: trunk/src/content/test/data/indexeddb/corrupted_open_db_detection.html
===================================================================
--- trunk/src/content/test/data/indexeddb/corrupted_open_db_detection.html (revision 260206)
+++ trunk/src/content/test/data/indexeddb/corrupted_open_db_detection.html (working copy)
@@ -1,114 +0,0 @@
-<!DOCTYPE html>
-<html>
-<!--
- Copyright 2014 The Chromium Authors. All rights reserved.
- Use of this source code is governed by a BSD-style license that can be
- found in the LICENSE file.
--->
-<head>
-<title>IDB test that db's corrupted while open are properly handled Part 1 / 2</title>
-<script type="text/javascript" src="common.js"></script>
-<script>
-
-function test() {
- indexedDBTest(upgradeCallback, openCallback);
-}
-
-var numObjectsWrittenToDb = 500;
-var numTransactions = 0;
-var numTransactionErrors = 0;
-var numTransactionAborts = 0;
-var numKeys = 0;
-var transaction;
-var request;
-var db;
-var objectStore;
-
-function upgradeCallback() {
- db = event.target.result;
- deleteAllObjectStores(db);
- objectStore = db.createObjectStore('storeName', { autoIncrement : true });
-
- var i;
- var len = 80;
- var data = Array(len);
- for (i = 0; i < len; ++i) {
- data[i] = i;
- }
-
- for (i = 0; i < numObjectsWrittenToDb; ++i) {
- var key = 'key-' + i;
- request = objectStore.add(data, key);
- request.onerror = unexpectedErrorCallback;
- request.onsuccess = upgradeTransactionComplete;
- }
-}
-
-function upgradeTransactionComplete() {
- ++numTransactions;
- if (numTransactions === numObjectsWrittenToDb) {
- debug("All transactions written");
- }
-}
-
-function transactionError(event) {
- if (event.target.error) {
- numTransactionErrors += 1;
- } else {
- fail("Transaction onerror had no error");
- }
-}
-
-function transactionAbort() {
- if (event.target.error) {
- numTransactionAborts += 1;
- } else {
- fail("Transaction onabort had no error");
- }
-}
-
-function requestError(event) {
- if (!event.target.error) {
- fail("get request had no/invalid error");
- }
-}
-
-function databaseClosed(event) {
- shouldBe("numTransactionErrors", "1");
- shouldBe("numTransactionAborts", "1");
-
- done("Closed as expected");
-}
-
-function getData() {
- transaction = db.transaction('storeName');
- db.onclose = databaseClosed;
- transaction.onabort = transactionAbort;
- transaction.onerror = transactionError;
- request.oncomplete = unexpectedCompleteCallback;
- store = transaction.objectStore('storeName');
- request = store.get('key-0');
- request.onsuccess = unexpectedSuccessCallback;
- request.onerror = requestError;
-}
-
-function openCallback() {
- var xmlhttp = new window.XMLHttpRequest();
- xmlhttp.open("GET", "/corrupt/test/corruptdb?storeName", false /*sync*/);
- xmlhttp.onreadystatechange = function() {
- if (xmlhttp.readyState === 4) {
- if (xmlhttp.status === 200) {
- // The database is now corrupt.
- getData();
- }
- }
- };
- xmlhttp.send();
-}
-
-</script>
-</head>
-<body onLoad="test()">
-<div id="status">Starting...</div>
-</body>
-</html>
« no previous file with comments | « trunk/src/content/test/data/indexeddb/common.js ('k') | trunk/src/content/test/data/indexeddb/corrupted_open_db_recovery.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698