mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-07 23:03:11 +08:00
CB-5193 Fix Android WebSQL sometime throwing SECURITY_ERR.
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.
(cherry picked from commit 6e4ef508e8
)
This commit is contained in:
parent
1dfbebf98e
commit
bb08abc0b9
@ -275,33 +275,13 @@ public class CordovaChromeClient extends WebChromeClient {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle database quota exceeded notification.
|
* Handle database quota exceeded notification.
|
||||||
*
|
|
||||||
* @param url
|
|
||||||
* @param databaseIdentifier
|
|
||||||
* @param currentQuota
|
|
||||||
* @param estimatedSize
|
|
||||||
* @param totalUsedQuota
|
|
||||||
* @param quotaUpdater
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onExceededDatabaseQuota(String url, String databaseIdentifier, long currentQuota, long estimatedSize,
|
public void onExceededDatabaseQuota(String url, String databaseIdentifier, long currentQuota, long estimatedSize,
|
||||||
long totalUsedQuota, WebStorage.QuotaUpdater quotaUpdater)
|
long totalUsedQuota, WebStorage.QuotaUpdater quotaUpdater)
|
||||||
{
|
{
|
||||||
LOG.d(TAG, "onExceededDatabaseQuota estimatedSize: %d currentQuota: %d totalUsedQuota: %d", estimatedSize, currentQuota, totalUsedQuota);
|
LOG.d(TAG, "onExceededDatabaseQuota estimatedSize: %d currentQuota: %d totalUsedQuota: %d", estimatedSize, currentQuota, totalUsedQuota);
|
||||||
|
quotaUpdater.updateQuota(MAX_QUOTA);
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// console.log in api level 7: http://developer.android.com/guide/developing/debug-tasks.html
|
// console.log in api level 7: http://developer.android.com/guide/developing/debug-tasks.html
|
||||||
|
Loading…
Reference in New Issue
Block a user