Skip to content

Commit

Permalink
CB-5193 Fix Android WebSQL sometime throwing SECURITY_ERR.
Browse files Browse the repository at this point in the history
Turns out our Quota logic has been wrong all along. If we were to
actually track the quota needed, we'd need to store a map of
dbName->quota for all dbNames. Instead, we just set a really high quota
since we don't ever want to decline storage.

I *think* this fixes all of the SECURITY_ERR exceptions we've been
seeing. Even those on Honeycomb / ICS.
  • Loading branch information
agrieve committed Oct 24, 2013
1 parent 4437d7f commit 6e4ef50
Showing 1 changed file with 1 addition and 21 deletions.
22 changes: 1 addition & 21 deletions framework/src/org/apache/cordova/CordovaChromeClient.java
Expand Up @@ -280,33 +280,13 @@ public void onClick(DialogInterface dialog, int which) {

/**
* Handle database quota exceeded notification.
*
* @param url
* @param databaseIdentifier
* @param currentQuota
* @param estimatedSize
* @param totalUsedQuota
* @param quotaUpdater
*/
@Override
public void onExceededDatabaseQuota(String url, String databaseIdentifier, long currentQuota, long estimatedSize,
long totalUsedQuota, WebStorage.QuotaUpdater quotaUpdater)
{
LOG.d(TAG, "onExceededDatabaseQuota estimatedSize: %d currentQuota: %d totalUsedQuota: %d", estimatedSize, currentQuota, totalUsedQuota);

if (estimatedSize < MAX_QUOTA)
{
//increase for 1Mb
long newQuota = estimatedSize;
LOG.d(TAG, "calling quotaUpdater.updateQuota newQuota: %d", newQuota);
quotaUpdater.updateQuota(newQuota);
}
else
{
// Set the quota to whatever it is and force an error
// TODO: get docs on how to handle this properly
quotaUpdater.updateQuota(currentQuota);
}
quotaUpdater.updateQuota(MAX_QUOTA);
}

// console.log in api level 7: http://developer.android.com/guide/developing/debug-tasks.html
Expand Down

0 comments on commit 6e4ef50

Please sign in to comment.