Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
jio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Roque
jio
Commits
58c970e5
Commit
58c970e5
authored
Sep 15, 2021
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[indexeddb] add compatibility with Firefox in private mode
parent
ea9a9ec4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
24 deletions
+19
-24
src/jio.js
src/jio.js
+4
-1
src/jio.storage/indexeddbstorage.js
src/jio.storage/indexeddbstorage.js
+5
-4
test/jio.storage/indexeddbstorage.tests.js
test/jio.storage/indexeddbstorage.tests.js
+10
-19
No files found.
src/jio.js
View file @
58c970e5
...
@@ -24,8 +24,11 @@
...
@@ -24,8 +24,11 @@
"
use strict
"
;
"
use strict
"
;
/* Safari does not define DOMError */
/* Safari does not define DOMError */
/* + compat issue with private Firefox */
if
(
window
.
DOMError
===
undefined
)
{
if
(
window
.
DOMError
===
undefined
)
{
window
.
DOMError
=
{};
window
.
DOMError
=
function
FakeDOMError
(
message
)
{
this
.
message
=
message
;
};
}
}
var
util
=
{},
var
util
=
{},
...
...
src/jio.storage/indexeddbstorage.js
View file @
58c970e5
...
@@ -43,10 +43,10 @@
...
@@ -43,10 +43,10 @@
/*jslint nomen: true */
/*jslint nomen: true */
/*global indexedDB, jIO, RSVP, Blob, Math, IDBKeyRange, IDBOpenDBRequest,
/*global indexedDB, jIO, RSVP, Blob, Math, IDBKeyRange, IDBOpenDBRequest,
DOMError, Set*/
DOMError,
DOMException,
Set*/
(
function
(
indexedDB
,
jIO
,
RSVP
,
Blob
,
Math
,
IDBKeyRange
,
IDBOpenDBRequest
,
(
function
(
indexedDB
,
jIO
,
RSVP
,
Blob
,
Math
,
IDBKeyRange
,
IDBOpenDBRequest
,
DOMError
,
Set
)
{
DOMError
,
DOMException
,
Set
)
{
"
use strict
"
;
"
use strict
"
;
// Read only as changing it can lead to data corruption
// Read only as changing it can lead to data corruption
...
@@ -145,7 +145,8 @@
...
@@ -145,7 +145,8 @@
canceller
();
canceller
();
if
((
error
!==
undefined
)
&&
if
((
error
!==
undefined
)
&&
(
error
.
target
instanceof
IDBOpenDBRequest
)
&&
(
error
.
target
instanceof
IDBOpenDBRequest
)
&&
(
error
.
target
.
error
instanceof
DOMError
))
{
((
error
.
target
.
error
instanceof
DOMError
)
||
(
error
.
target
.
error
instanceof
DOMException
)))
{
reject
(
"
Connection to:
"
+
db_name
+
"
failed:
"
+
reject
(
"
Connection to:
"
+
db_name
+
"
failed:
"
+
error
.
target
.
error
.
message
);
error
.
target
.
error
.
message
);
}
else
{
}
else
{
...
@@ -709,4 +710,4 @@
...
@@ -709,4 +710,4 @@
jIO
.
addStorage
(
"
indexeddb
"
,
IndexedDBStorage
);
jIO
.
addStorage
(
"
indexeddb
"
,
IndexedDBStorage
);
}(
indexedDB
,
jIO
,
RSVP
,
Blob
,
Math
,
IDBKeyRange
,
IDBOpenDBRequest
,
DOMError
,
}(
indexedDB
,
jIO
,
RSVP
,
Blob
,
Math
,
IDBKeyRange
,
IDBOpenDBRequest
,
DOMError
,
Set
));
DOMException
,
Set
));
test/jio.storage/indexeddbstorage.tests.js
View file @
58c970e5
...
@@ -20,10 +20,10 @@
...
@@ -20,10 +20,10 @@
/*jslint nomen: true */
/*jslint nomen: true */
/*global indexedDB, Blob, sinon, IDBDatabase,
/*global indexedDB, Blob, sinon, IDBDatabase,
IDBTransaction, IDBIndex, IDBObjectStore, IDBCursor, IDBKeyRange,
IDBTransaction, IDBIndex, IDBObjectStore, IDBCursor, IDBKeyRange,
DOMException,
Rusha*/
Rusha*/
(
function
(
jIO
,
QUnit
,
indexedDB
,
Blob
,
sinon
,
IDBDatabase
,
(
function
(
jIO
,
QUnit
,
indexedDB
,
Blob
,
sinon
,
IDBDatabase
,
IDBTransaction
,
IDBIndex
,
IDBObjectStore
,
IDBCursor
,
IDBKeyRange
,
IDBTransaction
,
IDBIndex
,
IDBObjectStore
,
IDBCursor
,
IDBKeyRange
,
DOMException
,
Rusha
)
{
Rusha
)
{
"
use strict
"
;
"
use strict
"
;
var
test
=
QUnit
.
test
,
var
test
=
QUnit
.
test
,
stop
=
QUnit
.
stop
,
stop
=
QUnit
.
stop
,
...
@@ -190,26 +190,17 @@
...
@@ -190,26 +190,17 @@
});
});
});
});
function
startsWith
(
str
,
prefix
)
{
return
str
.
substr
(
0
,
prefix
.
length
)
===
prefix
;
}
test
(
"
version decrease
"
,
function
()
{
test
(
"
version decrease
"
,
function
()
{
var
context
=
this
;
var
context
=
this
;
expect
(
8
);
expect
(
1
);
return
setupDBMigrationTest
(
context
,
{
version
:
3
},
return
setupDBMigrationTest
(
context
,
{
version
:
3
},
{
version
:
2
},
function
(
evt
)
{
{
version
:
2
},
function
(
msg
)
{
ok
(
evt
.
target
.
error
instanceof
DOMException
);
ok
(
startsWith
(
msg
,
"
Connection to: jio:qunit failed:
"
));
equal
(
evt
.
target
.
error
.
name
,
'
VersionError
'
);
ok
(
context
.
spy_open
.
calledOnce
,
"
open count
"
+
context
.
spy_open
.
callCount
);
equal
(
context
.
spy_open
.
firstCall
.
args
[
0
],
"
jio:qunit
"
,
"
open first argument
"
);
equal
(
context
.
spy_create_store
.
callCount
,
0
,
"
createObjectStore count
"
);
equal
(
context
.
spy_store
.
callCount
,
0
,
"
objectStore count
"
);
equal
(
context
.
spy_create_index
.
callCount
,
0
,
"
createIndex count
"
);
equal
(
context
.
spy_delete_index
.
callCount
,
0
,
"
deleteIndex count
"
);
});
});
});
});
...
@@ -2054,4 +2045,4 @@
...
@@ -2054,4 +2045,4 @@
}(
jIO
,
QUnit
,
indexedDB
,
Blob
,
sinon
,
IDBDatabase
,
}(
jIO
,
QUnit
,
indexedDB
,
Blob
,
sinon
,
IDBDatabase
,
IDBTransaction
,
IDBIndex
,
IDBObjectStore
,
IDBCursor
,
IDBKeyRange
,
IDBTransaction
,
IDBIndex
,
IDBObjectStore
,
IDBCursor
,
IDBKeyRange
,
DOMException
,
Rusha
));
Rusha
));
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment