[Webkit-unassigned] [Bug 36513] New: Wrong error code on db.transaction error callback

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Mar 23 17:44:46 PDT 2010


https://bugs.webkit.org/show_bug.cgi?id=36513

           Summary: Wrong error code on db.transaction error callback
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: Macintosh Intel
               URL: http://dev.w3.org/html5/webdatabase/#dom-sqlexception-
                    code-constraint
        OS/Version: Mac OS X 10.6
            Status: UNCONFIRMED
          Severity: Normal
          Priority: P2
         Component: WebCore JavaScript
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: robain at gmail.com
                CC: robain at gmail.com


Using the offline database API...
When trying to add a new row to an existing table with unique id's, with an id
that is already present in the table and an error callback is defined, then the
error code for the error in the callback is wrong. Normally it should have code
== 6, for a constraint error (because the unique id is already defined in the
table), however it returns code == 1. The error message however is correct.

Code to reproduce (run twice, as the error will only occur after the table has
been created the first time) :

db = openDatabase('Test', '1.0', 'HTML5 Web Database API test', 1024*1024*1);
if(db) {
    db.transaction(function(tx) {
        tx.executeSql('CREATE TABLE IF NOT EXISTS test (id unique, text)');
        tx.executeSql('INSERT INTO test (id, text) VALUES (1, "foobar")');
    }, 
    function(error) {  /* Error callback */
        alert( "Error code : " + error.code + " (should be 6)\n Error message :
" + error.message );
    });
}

Definition or error codes :
http://dev.w3.org/html5/webdatabase/#dom-sqlexception-code-constraint

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list