cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anton Merkulov (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CB-2823) window.openDatabase() throws exception 18 on BlackBerry and WP
Date Thu, 04 Apr 2013 15:27:15 GMT

    [ https://issues.apache.org/jira/browse/CB-2823?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13622414#comment-13622414
] 

Anton Merkulov commented on CB-2823:
------------------------------------

I've seen this issues for ios 5 and Android 3. And solution was implement in cordova.2.4.js
(android for example).

Database does not exists because I try to open a different databases with a different names.
Anyway if database is exist, I should to open it.

SD card is ready, and there are enough free space.
Here example how I check free space. I call method openDatabase in successCallback.
{code}
requestFileSystem(LocalFileSystem.PERSISTENT, 5000000, successCallback, errorCallback);
{code}
                
> window.openDatabase() throws exception 18 on BlackBerry and WP
> --------------------------------------------------------------
>
>                 Key: CB-2823
>                 URL: https://issues.apache.org/jira/browse/CB-2823
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: BlackBerry
>    Affects Versions: 2.4.0, 2.5.0
>            Reporter: Anton Merkulov
>            Assignee: Tim Kim
>         Attachments: IMAG0149.jpg
>
>
> For example this string
> {code}
>         document.addEventListener("deviceready", function onDeviceReady() {
>           var db = this.window.openDatabase('blackBerryDB', '1.0', 'blackBerryDBName',
5000000);
>         }, false);
> {code}
> will throw SECURITY_ERR: DOM Exception 18
> Looks like this problemm was resolved for androis and ios and stay actual for BlackBerry
and WP
> Example cordova.2.4.js for android
> {code:title=cordova.2.4.js|borderStyle=solid}
>   // some Android devices will throw a SECURITY_ERR -
>   // so we wrap the whole thing in a try-catch and shim in our own
>   // if the device has Android bug 16175.
>   var originalOpenDatabase = window.openDatabase;
>   window.openDatabase = function(name, version, desc, size) {
>     var db = null;
>     try {
>       db = originalOpenDatabase(name, version, desc, size);
>     } catch (ex) {
>       if (ex.code === 18) {
>         db = null;
>       } else {
>         throw ex;
>       }
>     }
>     if (db === null) {
>       return storage.openDatabase(name, version, desc, size);
>     } else {
>       return db;
>     }
>   };
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message