The problem with the above code was basically that I was missing an error callback for the transaction wrapping the sql insertion. For more info on generally how to actually handle user prompts, see this elaborated blog post on the matter.
From the specification on the Asynchronous Database API
void transaction(in SQLTransactionCallback callback,
in optional SQLTransactionErrorCallback errorCallback,
in optional SQLVoidCallback successCallback);
No example code showed this, and so I kept on assuming the transaction
method was used without callbacks.
So instead of writing
db.transaction(function (tx) {
// if this prompts the user to increase the size it will not execute the sql or run any of the callbacks
tx.executeSql('INSERT INTO foo (id, text) VALUES (1, createReallyBigString('4MB')', onComplete, onError );
});
Do this
// Note the reverse order of the callbacks!
db.transaction(function (tx) {
// this will prompt the user to increase the size and the sql will not be executed
tx.executeSql('INSERT INTO foo (id, text) VALUES (1, createReallyBigString('4MB')');
}, onError, onComplete );