cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shingo Toda (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CB-3180) windows.openDatabase returns invalid object on Android >= 4.0
Date Tue, 17 Sep 2013 01:25:52 GMT

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

Shingo Toda commented on CB-3180:
---------------------------------

Hi

As far as I know, Android 2.x may use WebSQL and openDatabase returns Database object which
has changeVersion method.
On the other hand, openDatabase may return plugin's object even when I use Android 4.0.4 on
a physical device.
I have confirmed this behavior on 2.3.3 (emulator) and 4.0.4 (physical device) by adding debug
alert in cordova.js (as below) and checking if returned object has changeVersion method.
When plugin is used, calling WebSQL's openDatabase usually gets SECURITY_ERR then plugin's
openDatabase is called instead.

{code}
module.exports = function(name, version, desc, size) {
    // First patch WebSQL if necessary
    if (!originalOpenDatabase) {
        // Not defined, create an openDatabase function for all to use!
        {color:red} alert("openDatabase does not exists. Plugin will be used"); {color}
        return storage.openDatabase.apply(this, arguments);
    }

    // Defined, but 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.
    try {
        return originalOpenDatabase(name, version, desc, size);
    } catch (ex) {
        if (ex.code !== 18) {
            throw ex;
        }
    }
    {color:red}alert("SECURITY_ERR. Plugin will be used");{color}
    return storage.openDatabase(name, version, desc, size);
};
{code}

So as far as I know, this behavior does not depend on Android version and devices/emulators
with higher version of Android also have the same problem. I hope you Cordova guys will complete
implementing your Storage API plugin to provide users with consistent behavior for all of
devices.
                
> windows.openDatabase returns invalid object on Android >= 4.0
> -------------------------------------------------------------
>
>                 Key: CB-3180
>                 URL: https://issues.apache.org/jira/browse/CB-3180
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Android
>    Affects Versions: 2.6.0
>            Reporter: Kirill Pugin
>             Fix For: 3.2.0
>
>
> After upgrading form cordova 2.5 to cordova 2.6 application stopped working properly
on android sdk >= 4.0.
> After some investigation we found out that window.opendDatabase method returns object
with only one method "transaction", but on SDK < 4.0 it also has "version", "changeVersion".

--
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