ks32 / CrosswalkNative

Embedded Crosswalk 77 webview based sample project.
96 stars 43 forks source link

indexDB apis always returns null #51

Closed nonameShijian closed 12 months ago

nonameShijian commented 1 year ago

I use cordova-plugin-crosswalk-webview-v3 and this project‘s aar to change webview, but when I use the JavaScript API 'indexDB' interface 'store. openCursor()', the interface always get null.

This is my JavaScript code:

var db;
var request = window.indexedDB.open('xxxx', 1);
request.onsuccess=function(e){
    db=e.target.result;
    var store=db.transaction(['config'],'readwrite').objectStore('config');
        var obj={};
        store.openCursor().onsuccess=function(e){
            var cursor=e.target.result;
            console.log(cursor); // always null
            if(cursor){
                obj[cursor.key]=cursor.value;
                cursor.continue();
            } else {
                console.log(obj);
            }
      }
}

Variable 'obj' is always an empty object, but when I use the 'put' operation of 'indexDB', the returned field 'type' is always' success'.

This is my JavaScript code:

var put = db.transaction(['config'],'readwrite').objectStore('config').put(['xxx'], 'extensions');
put.onsuccess = function(e){
    console.log(e.type); // 'success'
};

So, when I discovered this issue, I first used the "put" code to confirm that the returned field "type" was "success", and then used "store. openCursor". However, I still only got null

mikrohard commented 1 year ago

There's an issue with storage quota calculation. The app gets assigned a storage quota of 0 and thus all database transactions are rejected (over quota).

Add --unlimited-storage to your xwalk-command-line parameters and it should start working.

nonameShijian commented 12 months ago

There's an issue with storage quota calculation. The app gets assigned a storage quota of 0 and thus all database transactions are rejected (over quota).

Add --unlimited-storage to your xwalk-command-line parameters and it should start working. Thank you very much. The problem has been resolved.