Issue #136 - Added more verbose errors for situations where Private Browsing prevents DB access

This commit is contained in:
kwkofler 2014-03-29 13:23:51 -04:00
parent 8d55a5ebe9
commit 67ada1ba73
2 changed files with 6 additions and 1 deletions

View File

@ -9,6 +9,7 @@ define(function(require) {
var IDB_RW = require('src/constants').IDB_RW;
var IDB_RO = require('src/constants').IDB_RO;
var Errors = require('src/errors');
function IndexedDBContext(db, mode) {
var transaction = db.transaction(FILE_STORE_NAME, mode);
@ -112,7 +113,7 @@ define(function(require) {
callback(null, firstAccess);
};
openRequest.onerror = function onerror(error) {
callback(error);
callback(new Errors.EINVAL('IndexedDB cannot be accessed. If private browsing is enabled, disable it.'));
};
};
IndexedDB.prototype.getReadOnlyContext = function() {

View File

@ -5,6 +5,7 @@ define(function(require) {
var WSQL_SIZE = require('src/constants').WSQL_SIZE;
var WSQL_DESC = require('src/constants').WSQL_DESC;
var u8toArray = require('src/shared').u8toArray;
var Errors = require('src/errors');
function WebSQLContext(db, isReadOnly) {
var that = this;
@ -116,6 +117,9 @@ define(function(require) {
}
function onError(transaction, error) {
if (error.code === 5) {
callback(new Errors.EINVAL('WebSQL access not authorized. If private browsing is enabled, disable it.'));
}
callback(error);
}
function onSuccess(transaction, result) {