Merge pull request #167 from kwkofler/issue#136
Issue #136 - Added more verbose errors for situations where Private Brow...
This commit is contained in:
commit
073fe45223
|
@ -9,6 +9,7 @@ define(function(require) {
|
||||||
|
|
||||||
var IDB_RW = require('src/constants').IDB_RW;
|
var IDB_RW = require('src/constants').IDB_RW;
|
||||||
var IDB_RO = require('src/constants').IDB_RO;
|
var IDB_RO = require('src/constants').IDB_RO;
|
||||||
|
var Errors = require('src/errors');
|
||||||
|
|
||||||
function IndexedDBContext(db, mode) {
|
function IndexedDBContext(db, mode) {
|
||||||
var transaction = db.transaction(FILE_STORE_NAME, mode);
|
var transaction = db.transaction(FILE_STORE_NAME, mode);
|
||||||
|
@ -112,7 +113,7 @@ define(function(require) {
|
||||||
callback(null, firstAccess);
|
callback(null, firstAccess);
|
||||||
};
|
};
|
||||||
openRequest.onerror = function onerror(error) {
|
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() {
|
IndexedDB.prototype.getReadOnlyContext = function() {
|
||||||
|
|
|
@ -5,6 +5,7 @@ define(function(require) {
|
||||||
var WSQL_SIZE = require('src/constants').WSQL_SIZE;
|
var WSQL_SIZE = require('src/constants').WSQL_SIZE;
|
||||||
var WSQL_DESC = require('src/constants').WSQL_DESC;
|
var WSQL_DESC = require('src/constants').WSQL_DESC;
|
||||||
var u8toArray = require('src/shared').u8toArray;
|
var u8toArray = require('src/shared').u8toArray;
|
||||||
|
var Errors = require('src/errors');
|
||||||
|
|
||||||
function WebSQLContext(db, isReadOnly) {
|
function WebSQLContext(db, isReadOnly) {
|
||||||
var that = this;
|
var that = this;
|
||||||
|
@ -116,6 +117,9 @@ define(function(require) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function onError(transaction, error) {
|
function onError(transaction, error) {
|
||||||
|
if (error.code === 5) {
|
||||||
|
callback(new Errors.EINVAL('WebSQL cannot be accessed. If private browsing is enabled, disable it.'));
|
||||||
|
}
|
||||||
callback(error);
|
callback(error);
|
||||||
}
|
}
|
||||||
function onSuccess(transaction, result) {
|
function onSuccess(transaction, result) {
|
||||||
|
|
Loading…
Reference in New Issue