Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Romain Courteaud
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
Show 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 @@
"
use strict
"
;
/* Safari does not define DOMError */
/* + compat issue with private Firefox */
if
(
window
.
DOMError
===
undefined
)
{
window
.
DOMError
=
{};
window
.
DOMError
=
function
FakeDOMError
(
message
)
{
this
.
message
=
message
;
};
}
var
util
=
{},
...
...
src/jio.storage/indexeddbstorage.js
View file @
58c970e5
...
...
@@ -43,10 +43,10 @@
/*jslint nomen: true */
/*global indexedDB, jIO, RSVP, Blob, Math, IDBKeyRange, IDBOpenDBRequest,
DOMError, Set*/
DOMError,
DOMException,
Set*/
(
function
(
indexedDB
,
jIO
,
RSVP
,
Blob
,
Math
,
IDBKeyRange
,
IDBOpenDBRequest
,
DOMError
,
Set
)
{
DOMError
,
DOMException
,
Set
)
{
"
use strict
"
;
// Read only as changing it can lead to data corruption
...
...
@@ -145,7 +145,8 @@
canceller
();
if
((
error
!==
undefined
)
&&
(
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:
"
+
error
.
target
.
error
.
message
);
}
else
{
...
...
@@ -709,4 +710,4 @@
jIO
.
addStorage
(
"
indexeddb
"
,
IndexedDBStorage
);
}(
indexedDB
,
jIO
,
RSVP
,
Blob
,
Math
,
IDBKeyRange
,
IDBOpenDBRequest
,
DOMError
,
Set
));
DOMException
,
Set
));
test/jio.storage/indexeddbstorage.tests.js
View file @
58c970e5
...
...
@@ -20,10 +20,10 @@
/*jslint nomen: true */
/*global indexedDB, Blob, sinon, IDBDatabase,
IDBTransaction, IDBIndex, IDBObjectStore, IDBCursor, IDBKeyRange,
DOMException,
Rusha*/
Rusha*/
(
function
(
jIO
,
QUnit
,
indexedDB
,
Blob
,
sinon
,
IDBDatabase
,
IDBTransaction
,
IDBIndex
,
IDBObjectStore
,
IDBCursor
,
IDBKeyRange
,
DOMException
,
Rusha
)
{
Rusha
)
{
"
use strict
"
;
var
test
=
QUnit
.
test
,
stop
=
QUnit
.
stop
,
...
...
@@ -190,26 +190,17 @@
});
});
function
startsWith
(
str
,
prefix
)
{
return
str
.
substr
(
0
,
prefix
.
length
)
===
prefix
;
}
test
(
"
version decrease
"
,
function
()
{
var
context
=
this
;
expect
(
8
);
expect
(
1
);
return
setupDBMigrationTest
(
context
,
{
version
:
3
},
{
version
:
2
},
function
(
evt
)
{
ok
(
evt
.
target
.
error
instanceof
DOMException
);
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
"
);
{
version
:
2
},
function
(
msg
)
{
ok
(
startsWith
(
msg
,
"
Connection to: jio:qunit failed:
"
));
});
});
...
...
@@ -2054,4 +2045,4 @@
}(
jIO
,
QUnit
,
indexedDB
,
Blob
,
sinon
,
IDBDatabase
,
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