Commit 66237e3c authored by Romain Courteaud's avatar Romain Courteaud

erp5_web_renderjs_ui: add compatibility for Firefox in private mode

Firefox disables IndexedDB in private mode.
Use memory storage in such case. This allows user to have a normal erp5js usage until the window is reloaded.
parent 72046a82
......@@ -387,8 +387,14 @@
.push(function (result) {
setting_gadget = result;
return setting_gadget.createJio({
type: "indexeddb",
database: "setting"
type: "fallback",
sub_storage: {
type: "indexeddb",
database: "setting"
},
fallback_storage: {
type: "memory"
}
});
})
.push(function () {
......
......@@ -234,7 +234,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>994.35438.36279.54937</string> </value>
<value> <string>994.54001.34070.45704</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -252,7 +252,7 @@
</tuple>
<state>
<tuple>
<float>1630683787.8</float>
<float>1631797534.82</float>
<string>UTC</string>
</tuple>
</state>
......
/*global window, rJS, RSVP, document, jIO, URI, URL, Blob */
/*global window, rJS, RSVP, document, jIO, URI, URL, Blob, navigator */
/*jslint nomen: true, indent: 2 */
(function (window, rJS, RSVP, loopEventListener, document, jIO, URI, URL, Blob) {
(function (window, rJS, RSVP, loopEventListener, document, jIO, URI, URL, Blob,
navigator) {
"use strict";
// Keep reference of the latest allDocs params which reach to this view
......@@ -1069,8 +1070,14 @@
return jio_gadget.createJio({
type: "sha",
sub_storage: {
type: "indexeddb",
database: "selection"
type: "fallback",
sub_storage: {
type: "indexeddb",
database: "selection"
},
fallback_storage: {
type: "memory"
}
}
});
});
......@@ -1082,8 +1089,14 @@
return jio_gadget.createJio({
type: "query",
sub_storage: {
type: "indexeddb",
database: "navigation_history"
type: "fallback",
sub_storage: {
type: "indexeddb",
database: "navigation_history"
},
fallback_storage: {
type: "memory"
}
}
});
});
......@@ -1093,8 +1106,14 @@
.push(function (jio_gadget) {
gadget.props.jio_state_gadget = jio_gadget;
return jio_gadget.createJio({
type: "indexeddb",
database: "document_state"
type: "fallback",
sub_storage: {
type: "indexeddb",
database: "document_state"
},
fallback_storage: {
type: "memory"
}
});
});
}()),
......@@ -1177,6 +1196,19 @@
gadget.props.keep_message = false;
gadget.props.is_cancelled = false;
return result;
/*
})
.push(undefined, function (error) {
if (!navigator.onLine) {
console.log('not online');
// XXX couscous
return loopEventListener(window, 'online', false,
function backOnline() {
return location.reload();
});
}
throw error;
*/
});
}
});
......@@ -1239,4 +1271,5 @@
false
);
});
}(window, rJS, RSVP, rJS.loopEventListener, document, jIO, URI, URL, Blob));
\ No newline at end of file
}(window, rJS, RSVP, rJS.loopEventListener, document, jIO, URI, URL, Blob,
navigator));
\ No newline at end of file
......@@ -236,7 +236,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>991.63596.55319.30839</string> </value>
<value> <string>994.53726.18332.61542</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -254,7 +254,7 @@
</tuple>
<state>
<tuple>
<float>1620663195.92</float>
<float>1631797697.91</float>
<string>UTC</string>
</tuple>
</state>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment