axemclion / jquery-indexeddb

An IndexedDB Plugin for Jquery.
Other
195 stars 71 forks source link

interrupte in chrome #47

Open kiyaL opened 10 years ago

kiyaL commented 10 years ago

Browser: 27.0.1453.116

Code:

batchAdd: function(tableName, items, i, success, failure) {
                var that = this;
                var objectStore = $.indexedDB(constants.DbName).objectStore(tableName);
                if(items.length > i) {
                    objectStore.add(items[i]).done(function() {
                        console.log("batchAdd success");
                        that.batchAdd(tableName, items, ++i, success, failure);
                    }).fail(function() {
                        console.log("batchAdd error");
                        if(!!failure){
                            failure();
                        }
                    });
                } else {
                    if(!!success){
                        success(items);
                    }
                }
            },

openDatabase: function(success, failure) {
                $.indexedDB(constants.DbName).done(function() {
                    console.log("openDatabase success");
                    if(!!success){
                        success();
                    }
                }).fail(function() {
                    console.log("openDatabase error");
                    if(!!failure){
                        failure();
                    }
                });
            },

deleteDatabase: function(success, failure) {
                $.indexedDB(constants.DbName).deleteDatabase().done(function() {
                    console.log("deleteDatabase success");
                    if(!!success){
                        success();
                    }
                }).fail(function() {
                    console.log("deleteDatabase error");
                    if(!!failure){
                        failure();
                    }
                }).progress(function(){
                    console.log("deleteDatabase progress");
                });
            }

I call batchAdd to add 10000 items and refresh browser when batchAdd haven’t completed. batchAdd process is interrupted. Then I find I can't operation the database any more. Such as deleteDatabase and openDatabase have no response.

But firefox 22.0 works fine.

I don‘t know if my code is correct or it is bug in jquery-indexeddb. Is there any way to fix this issue? thanks.

kiyaL commented 10 years ago

In additional, it works fine after I manually delete the folder C:\Documents and Settings\Administrator\Local Settings\Application Data\Google\Chrome\User Data\Default\IndexedDB\http_localhost_8080.indexeddb.leveldb